Observability
A copy of every request, as a trace, in your own monitoring tool.
1. Pick the destination
A destination is where the traces go: a tool you already run, or any address that takes a webhook. Once it is added and on, every request a key sends is copied there as a trace.
| Destination | type | config needs |
|---|---|---|
| Arize AX | arize | apiKey, spaceKey, modelId |
| Braintrust | braintrust | apiKey, projectId |
| ClickHouse | clickhouse | host, database, username, password |
| Comet Opik | opik | apiKey, workspace, projectName |
| Datadog | datadog | apiKey, mlApp |
| Google BigQuery | bigquery | projectId, serviceAccountKey |
| Grafana Cloud | grafana | apiKey, instanceId |
| Langfuse | langfuse | secretKey, publicKey |
| LangSmith | langsmith | apiKey |
| New Relic | newrelic | licenseKey |
| OpenTelemetry | otel-collector | endpoint |
| PostHog | posthog | apiKey |
| Raindrop | raindrop | writeKey |
| Ramp | ramp | apiKey |
| S3 | s3 | bucketName, accessKeyId, secretAccessKey |
| Sentry | sentry | otlpEndpoint, dsn |
| Snowflake | snowflake | account, token |
| W&B Weave | weave | apiKey, entity, project |
| a webhook | webhook | url |
The secrets in config are your tool's, never an OpenDunes key. Every read of a destination masks them.
2. Add it
Yacine wants Souk Bot's requests beside the rest of his logs. The sample adds a webhook destination, switched off, so nothing is sent before the address is his.
The observability routes take a management keyManagement keyThe key that runs your account through the API: the balance, the usage history, your keys, guardrails, observability. It never calls a model.More on API keys →, never an API keyAPI keyThe key you create and send with every request that calls a model.More on API keys →. Set OPENDUNES_MANAGEMENT_KEY to your management key in the terminal that runs this sample. An API key gets a 401. See API keys.
import json
import os
import urllib.request
MANAGEMENT_KEY = os.environ["OPENDUNES_MANAGEMENT_KEY"]
base_url = "https://opendunes.com/v1"
webhook_url = "https://example.com/opendunes-traces"
destination = {
"name": "Souk Bot logs",
"type": "webhook",
"config": {"url": webhook_url},
"enabled": False,
}
request = urllib.request.Request(
base_url + "/observability/destinations",
data=json.dumps(destination).encode(),
headers={
"Authorization": "Bearer " + MANAGEMENT_KEY,
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request) as response:
added = json.load(response)["data"]
print(added["id"], added["enabled"])201, with the destination under data and its id.
| You send | Holds |
|---|---|
name | your name for it |
type | the destination, from the table above |
config | what that destination needs |
enabled | true to send traces, false to hold them |
api_key_hashes | only the requests of these keys; every key when it is not sent |
sampling_rate | the share of requests copied, from 0.0001 to 1 |
privacy_mode | true to send the trace without the prompt and the answer |
A trace carries the prompt and the answer, your customers' words included. To send it without them, set privacy_mode to true.
3. Switch it on
Send your own address and enabled to PATCH /v1/observability/destinations/{id}. Only the fields you send change.
{
"config": {
"url": "https://logs.souk-bot.example/opendunes"
},
"enabled": true
}From then on, each request is copied there once it ends.
| Route | Does |
|---|---|
GET /v1/observability/destinations | lists your destinations |
GET /v1/observability/destinations/{id} | reads one, its secrets masked |
PATCH /v1/observability/destinations/{id} | changes one |
DELETE /v1/observability/destinations/{id} | removes one; nothing more is sent there |
Every observability route is free. Every field: Trace destinations.
Don't send a masked secret back: a masked value is ignored.
Do send the new secret in full, inside config, to change it.
Errors
The body says why.
| Status | When |
|---|---|
| 400 | type is not in the table, or config lacks what that destination needs |
| 401 | the key is missing, wrong, disabled or expired, or it is an API key |
| 404 | no destination of yours has this id |
| 409 | your account holds as many destinations of this type as it can |
What to do on each: Errors and retries.
Last modified on