Skip to content

Commit

Permalink
Add immediate flag
Browse files Browse the repository at this point in the history
  • Loading branch information
asuresh4 committed Mar 27, 2018
1 parent ffa5665 commit fe20abf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
12 changes: 7 additions & 5 deletions examples/signalflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
signalflow = client.signalflow()

signalflow.execute("data('cpu.utilization').publish()").each_message do |msg, comp|
case msg[:type]
when "data"
puts "#{'Host'.center(40, ' ')} | cpu.utilization"
msg[:data].each do |tsid,value|
puts "#{comp.metadata[tsid][:host][0..40].center(40, ' ')} | #{value}"
unless msg.nil?
case msg[:type]
when "data"
puts "#{'Host'.center(40, ' ')} | cpu.utilization"
msg[:data].each do |tsid,value|
puts "#{comp.metadata[tsid][:host][0..40].center(40, ' ')} | #{value}"
end
end
end
puts ""
Expand Down
3 changes: 2 additions & 1 deletion lib/signalfx/signalflow/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ def initialize(api_token, api_endpoint, stream_endpoint)
# @option options [Fixnum] :resolution
# @option options [Fixnum] :max_delay
# @option options [Boolean] :persistent
# @option options [Boolean] :immediate
#
# @return [Computation] A {Computation} instance with an active channel
def execute(program, **options)
@transport.execute(program, **options)
end

# Start and attach to a computation that tells how many times a detector
# would have fired in a time range between `start` and `stop`.
#
Expand Down
4 changes: 2 additions & 2 deletions lib/signalfx/signalflow/websocket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def start_job
end
end

def execute(program, start: nil, stop: nil, resolution: nil, max_delay: nil, persistent: nil)
def execute(program, start: nil, stop: nil, resolution: nil, max_delay: nil, persistent: nil, immediate: false)
start_job do |channel_name|
send_msg({
:type => "execute",
Expand All @@ -93,6 +93,7 @@ def execute(program, start: nil, stop: nil, resolution: nil, max_delay: nil, per
:resolution => resolution,
:max_delay => max_delay,
:persistent => persistent,
:immediate => immediate,
:compress => @compress,
}.reject!{|k,v| v.nil?}.to_json)
end
Expand Down Expand Up @@ -313,4 +314,3 @@ def make_new_channel
end
private :make_new_channel
end

0 comments on commit fe20abf

Please sign in to comment.