Skip to main content

No project description provided

Project description

signalflow-client-python

PyPI - Version PyPI - Python Version


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.

  1. Install the signalflow-client-python package:

    pip install signalflow-client-python
    
  2. Create a .py file 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()
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

signalflow_client_python-1.3.8.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

signalflow_client_python-1.3.8-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file signalflow_client_python-1.3.8.tar.gz.

File metadata

  • Download URL: signalflow_client_python-1.3.8.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.11.14 HTTPX/0.28.1

File hashes

Hashes for signalflow_client_python-1.3.8.tar.gz
Algorithm Hash digest
SHA256 51da667f0bcb61d37cebec12732e10d01a411c39d912995dae09a9ccda42be30
MD5 da1e77a122fda9e8dce140c5849dea33
BLAKE2b-256 04c7fe6e0e10343baea94bdd610b17ccba45340c9975bf960359ccdd36c5668b

See more details on using hashes here.

File details

Details for the file signalflow_client_python-1.3.8-py3-none-any.whl.

File metadata

File hashes

Hashes for signalflow_client_python-1.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e7fcabe155493c95455a305ae8b3bccdbdb56dcfebc441f2c0a5b03020b8b641
MD5 6f2962b517136f1bc80d37d242bf16f9
BLAKE2b-256 758bbd7c226f00aa238b5d55a2860dc8b3f6a9579617be2bc6fa8dff2ca623eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page