opendunes
Your account · 3 min
Copy page ▾

Observability

A copy of every request, as a trace, in your own monitoring tool.

  1. Pick the destination.
  2. Add it.
  3. Switch it on.

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.

Destinationtypeconfig needs
Arize AXarizeapiKey, spaceKey, modelId
BraintrustbraintrustapiKey, projectId
ClickHouseclickhousehost, database, username, password
Comet OpikopikapiKey, workspace, projectName
DatadogdatadogapiKey, mlApp
Google BigQuerybigqueryprojectId, serviceAccountKey
Grafana CloudgrafanaapiKey, instanceId
LangfuselangfusesecretKey, publicKey
LangSmithlangsmithapiKey
New RelicnewreliclicenseKey
OpenTelemetryotel-collectorendpoint
PostHogposthogapiKey
RaindropraindropwriteKey
RamprampapiKey
S3s3bucketName, accessKeyId, secretAccessKey
SentrysentryotlpEndpoint, dsn
Snowflakesnowflakeaccount, token
W&B WeaveweaveapiKey, entity, project
a webhookwebhookurl

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.

Watch out

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 sendHolds
nameyour name for it
typethe destination, from the table above
configwhat that destination needs
enabledtrue to send traces, false to hold them
api_key_hashesonly the requests of these keys; every key when it is not sent
sampling_ratethe share of requests copied, from 0.0001 to 1
privacy_modetrue to send the trace without the prompt and the answer
Watch out

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.

JSON
{
  "config": {
    "url": "https://logs.souk-bot.example/opendunes"
  },
  "enabled": true
}

From then on, each request is copied there once it ends.

RouteDoes
GET /v1/observability/destinationslists 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

Don't send a masked secret back: a masked value is ignored.

Do

Do send the new secret in full, inside config, to change it.

Errors

The body says why.

StatusWhen
400type is not in the table, or config lacks what that destination needs
401the key is missing, wrong, disabled or expired, or it is an API key
404no destination of yours has this id
409your account holds as many destinations of this type as it can

What to do on each: Errors and retries.

Last modified on