Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.latitude.so/llms.txt

Use this file to discover all available pages before exploring further.

Metadata

Metadata adds structured key-value context to traces for investigation, filtering, and grouping. Common metadata includes:
  • request id
  • account id
  • plan or tier
  • region
  • environment
  • feature flag or experiment id
  • product surface

Send metadata

Pass metadata through capture().
import { capture } from "@latitude-data/telemetry"

await capture(
  "support-agent-turn",
  async () => {
    return agent.run(userMessage)
  },
  {
    metadata: {
      requestId: request.id,
      accountId: account.id,
      plan: account.plan,
      environment: "production",
    },
  },
)
Nested captures inherit parent metadata. Child metadata is shallow-merged with parent metadata.

Use metadata in Latitude

Metadata appears on traces and in filters, so you can review cohorts such as:
  • production traces for one account
  • failed traces for a specific feature flag
  • expensive traces from one region
  • issue examples from a specific plan tier
Metadata filters use dot notation, such as metadata.environment = production.

Metadata vs tags

Use metadata for structured fields with values, such as environment, release, commit SHA, deployment id, or log level. Use tags for simple labels that do not need key-value structure.
  • Tags: Add lightweight labels
  • Filters: Filter by metadata fields
  • Search: Combine metadata filters with semantic search