No project description provided
Project description
signalflow-client-python
Table of Contents
SignalFlow is the SignalFx real-time analytics computation language. The SignalFlow API allows SignalFx users to execute real-time streaming analytics computations on the SignalFx platform. For more information, see the Splunk Observability Cloud developer documentation:
The SignalFlow Python library is a client that opens a connection to SignalFx, allowing you to execute SignalFlow programs against the back end and then stream data back to the client.
The following SignalFlow program returns the current number of users in your organization:
data('sf.org.num.orguser').publish()
[!TIP] The SignalFx UI uses the SignalFlow language to produce charts, graphs, and alerts. You can reuse SignalFlow programs from the UI in the code that you write using the SignalFlow Python client library.
Installation
To install the SignalFlow Python client library, open a terminal and run the following command:
pip install signalflow-client-python
Run a SignalFlow computation
The following example allows you run a SignalFlow computation from the command line. For additional examples, see the examples directory.
-
Install the
signalflow-client-pythonpackage:pip install signalflow-client-python -
Create a
.pyfile that includes the following content:
#!/usr/bin/env python
import argparse
from signalfx.signalflow import SignalFlowClient
def main():
parser = argparse.ArgumentParser(
description="SignalFx SignalFlow streaming analytics demo"
)
parser.add_argument(
"--stream-endpoint",
help="SignalFx SignalFlow stream API endpoint",
default="https://stream.signalfx.com",
)
parser.add_argument("token", help="Your SignalFx API access token")
parser.add_argument("program", help="SignalFlow program to execute")
options = parser.parse_args()
client = SignalFlowClient(
token=options.token,
endpoint=options.stream_endpoint,
)
try:
# Execute the computation and iterate over the message stream
print("Requesting computation: {0}".format(options.program))
c = client.execute(options.program)
print("Waiting for data...")
for msg in c.stream():
print(f"Message: {msg}")
except KeyboardInterrupt:
print("Detaching from computation...")
finally:
client.close()
print("Done.")
if __name__ == "__main__":
main()
-
Run the Python script, specifying values for the streaming endpoint (optional), the API access token, and the SignalFlow program.
For example:
python <file-name>.py --stream-endpoint https://stream.us0.signalfx.com <api-token> "data('sf.org.num.orguser').publish()"
License
signalflow-client-python is distributed under the terms of the Apache-2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file signalflow_client_python-1.3.4.tar.gz.
File metadata
- Download URL: signalflow_client_python-1.3.4.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9b6a1005cc9762f40fdb581766a42d80e348d5d6af4583efab668774b73df6f
|
|
| MD5 |
f9a2b2d4294a9cd8cd964b9381402f7d
|
|
| BLAKE2b-256 |
d1af912dfeda5d6fa642cfc4073fbd9736727f3cfb7251abd6bab6993a5b4d42
|
File details
Details for the file signalflow_client_python-1.3.4-py3-none-any.whl.
File metadata
- Download URL: signalflow_client_python-1.3.4-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7218e6bdf443c2e5eff3795a11a1f8b65491f0aff17a421653c5042d75fda39
|
|
| MD5 |
afd1350bf379c1b25a24924168495e0c
|
|
| BLAKE2b-256 |
a7a7710173ddfe4c6a701c8b735595f7ad8b7d2f993ff691a8afaa553b1906fd
|