Skip to content

graphsignal/graphsignal-python

Repository files navigation

Graphsignal: AI Performance Profiler

License Version

Graphsignal is an AI optimization platform, enabling developers to achieve faster, more efficient models and applications. With Graphsignal, developers can:

  • Identify and optimize the most significant contributors to latency.
  • Analyze model API costs for deployments, models, sessions, or any custom tags.
  • Ensure optimal model configuration and inference performance for hosted models.
  • Track errors and monitor APIs, compute, and GPU utilization.

Dashboards

Learn more at graphsignal.com.

Install

Install the Graphsignal library.

pip install --upgrade graphsignal

Configure

Configure Graphsignal tracer by specifying your API key directly or via GRAPHSIGNAL_API_KEY environment variable.

import graphsignal

graphsignal.configure(api_key='my-api-key', deployment='my-app')

To get an API key, sign up for a free account at graphsignal.com. The key can then be found in your account's Settings / API Keys page.

Alternatively, you can add Graphsignal tracer from the command line, when running your module or script. Environment variables GRAPHSIGNAL_API_KEY and GRAPHSIGNAL_DEPLOYMENT must be set.

python -m graphsignal <script>
python -m graphsignal -m <module>

Integrate

Graphsignal auto-instruments and traces libraries and frameworks, such as OpenAI and LangChain. Traces, errors, and data, such as prompts and completions, are automatically recorded and available for analysis at app.graphsignal.com.

Refer to the guides below for detailed information on:

See API reference for full documentation.

Integration examples are available in examples repository.

Analyze

Log in to Graphsignal to monitor and analyze your application.

Overhead

Graphsignal tracer is highly lightweight. The overhead per trace is measured to be less than 100 microseconds.

Security and Privacy

The Graphsignal tracer only establishes outbound connections to api.graphsignal.com to send data; inbound connections or commands are not possible.

Payloads, such as prompts and completions, are recorded by default in case of automatic tracing. To disable, set record_payloads=False in graphsignal.configure.

Troubleshooting

To enable debug logging, add debug_mode=True to configure(). If the debug log doesn’t provide hints for resolving the issue, report it to our support team via your account.

In case of connection issues, please make sure outgoing connections to https://api.graphsignal.com are allowed.