Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Metadata, tags, environments and releases

Use these four labels to slice your traces by customer, feature, deployment or version.

Label What it is for Shape
Metadata Facts about a request that you want to read or filter on: a plan, a customer, a feature flag. Key and value pairs
Tags Short labels that mark a trace: beta, vip, retry. A list of strings
Environment The deployment: production, staging, dev. One string
Release The version of your code: a Git SHA or a version number. One string

Metadata and tags go in a context block. Every span started inside the block carries them. Environment and release are set once, in init().

import cetra
cetra.init(environment="production", release="1.4.2")
@cetra.observe(name="turn")
def turn() -> None: ...
with cetra.context(tags=["beta"], metadata={"plan": "pro", "customer": "acme"}):
turn()
cetra.flush()

To add metadata to one span, call set_metadata on a manual span.

import cetra
cetra.init()
with cetra.span("rerank", kind="reranker") as s:
s.set_metadata(model="bge")
cetra.flush()

Metadata keys use letters, digits, _, . and -. The SDK skips a key that does not. Keep personal data out of metadata, or mask it. See Masking, sampling and truncation.

The environments cetra-eval and cetra-playground are reserved for cetra’s own evaluator and playground runs, and experiment is the default for experiment runs. cetra renames cetra-eval and cetra-playground on spans you send to cetra-eval-external and cetra-playground-external.

The trace list has columns for tags and environment. The trace header shows the tags, environment and release. The Attributes tab of a span shows its metadata.

Filter Finds
metadata['customer'] = 'acme' Traces with that metadata value.
tags @> ['beta'] Traces with the tag beta.
environment = 'production' Traces from one environment.
release = '1.4.2' Traces from one release.

See the filter language.

  • A trace’s metadata comes from its root span. Keys from other spans are added when the root does not have them.
  • A trace’s tags are the tags of all its spans together.
  • Metadata values are stored as text. A number is stored as its text form.