Class: SignalFlowClient
- Inherits:
-
Object
- Object
- SignalFlowClient
- Defined in:
- lib/signalfx/signalflow/client.rb
Overview
A SignalFlow client that uses the WebSockets interface.
See developers.signalfx.com/v2/reference#signalflowconnect for low-level API details and information on the SignalFlow language.
See https://github.com/signalfx/signalfx-ruby/blob/master/examples/signalflow.rb for an example script that uses the client.
The messages passed into the ‘computation.each_message*` blocks will be decoded forms of what is described in our API reference for SignalFlow. Hash keys will be symbols instead of strings.
Instance Method Summary collapse
-
#close ⇒ Object
Stop everything and close any open connections.
-
#execute(program, **options) ⇒ Computation
Start a computation and attach to its output.
-
#initialize(api_token, stream_endpoint) ⇒ SignalFlowClient
constructor
A new instance of SignalFlowClient.
-
#preflight(program, start, stop, **options) ⇒ Computation
Start and attach to a computation that tells how many times a detector would have fired in a time range between ‘start` and `stop`.
-
#start(program, **options) ⇒ Computation
Start a computation without attaching to it.
Constructor Details
#initialize(api_token, stream_endpoint) ⇒ SignalFlowClient
Returns a new instance of SignalFlowClient.
22 23 24 |
# File 'lib/signalfx/signalflow/client.rb', line 22 def initialize(api_token, stream_endpoint) @transport = SignalFlowWebsocketTransport.new(api_token, stream_endpoint) end |
Instance Method Details
#close ⇒ Object
Stop everything and close any open connections.
71 72 73 |
# File 'lib/signalfx/signalflow/client.rb', line 71 def close @transport.close end |
#execute(program, **options) ⇒ Computation
Start a computation and attach to its output. If using WebSockets (the default), the channel name is handled internally so you do not need to supply it.
See developers.signalfx.com/reference#section-execute-a-computation
40 41 42 |
# File 'lib/signalfx/signalflow/client.rb', line 40 def execute(program, **) @transport.execute(program, **) end |
#preflight(program, start, stop, **options) ⇒ Computation
Start and attach to a computation that tells how many times a detector would have fired in a time range between ‘start` and `stop`.
See developers.signalfx.com/v2/reference#signalflowpreflight
54 55 56 |
# File 'lib/signalfx/signalflow/client.rb', line 54 def preflight(program, start, stop, **) @transport.preflight(program, start, stop, **) end |
#start(program, **options) ⇒ Computation
Start a computation without attaching to it
The ‘publish()` call in the program must specify a `metric` to publish the output to since you cannot currently attach to the output.
Optional parameters are the same as #execute.
66 67 68 |
# File 'lib/signalfx/signalflow/client.rb', line 66 def start(program, **) @transport.start(program, **) end |