The tag keys the tracer itself reads or writes, by name.
Two kinds of key live here, and nothing else does.
Keys the tracer intercepts. set_tag/2 with one of these does not
write a tag at all: it does what the key means — sets a span field, the
error flag, or the trace's fate — and the key never reaches meta.
Writing "service.name" is another way of saying
DDTrace.update_span(service: ...), and "manual.keep"
another way of saying DDTrace.keep_trace/0; the direct call is usually
the clearer one. These exist because integrations and hand-written
instrumentation reach Datadog's well-known keys naturally.
service_name/0,resource_name/0,span_type/0— span fieldserror/0— the error flagmanual_keep/0,manual_drop/0— the trace's sampling decision, exactly asDDTrace.keep_trace/0andDDTrace.drop_trace/0make it
Keys the tracer writes. error_type/0, error_message/0 and
error_stack/0 describe a failure; trace_id_upper/0 carries the upper
half of a 128-bit trace id and decision_maker/0 says what decided the
trace's sampling priority; origin/0 says where the trace entered
Datadog and propagation_error/0 what went wrong carrying it across a
service boundary; sampling_priority/0 and measured/0 are numeric and
live in metrics, not meta, and so do rule_psr/0, limit_psr/0 and
agent_psr/0, the rates the trace's sampling decision was made at.
Ordinary tag keys the Datadog UI attaches meaning to — http.method,
span.kind, peer.service — are not here: the tracer treats them like
any other string tag, and their names belong to whichever integration
writes them.
The functions exist to spell the keys without a typo; the raw strings are equally valid everywhere. A string has no singleton type, so what a spec can check here is the function name, not the value — which is precisely the typo these prevent.
Examples
iex> DDTrace.Tags.trace_id_upper()
"_dd.p.tid"
Summary
Functions
The agent's rate for the trace's service when the agent's feedback
decided it, a metric key: "_dd.agent_psr".
What decided the trace's sampling priority: "_dd.p.dm".
The deployment environment, as a tag key: "env".
The span's error flag, as a tag key: "error".
What the failure said: "error.message".
Where the failure came from: "error.stack".
What kind of thing went wrong: "error.type".
The rate limiter's effective rate when it ran on a rule-kept trace, a
metric key: "_dd.limit_psr".
Drop this trace, as a tag key: "manual.drop".
Keep this trace, as a tag key: "manual.keep".
Opts a span into trace metrics, a metric key: "_dd.measured".
Where the trace entered Datadog: "_dd.origin".
What went wrong propagating the trace: "_dd.propagation_error".
The span's resource, as a tag key: "resource.name".
The rate of the sampling rule that decided the trace, a metric key:
"_dd.rule_psr".
The trace's sampling priority, a metric key: "_sampling_priority_v1".
The span's service, as a tag key: "service.name".
The span's Datadog type, as a tag key: "span.type".
The upper 64 bits of a 128-bit trace id: "_dd.p.tid".
The application version, as a tag key: "version".
Functions
@spec agent_psr() :: String.t()
The agent's rate for the trace's service when the agent's feedback
decided it, a metric key: "_dd.agent_psr".
@spec decision_maker() :: String.t()
What decided the trace's sampling priority: "_dd.p.dm".
A hyphen and the mechanism's number — "-0" is the tracer's default.
@spec env() :: String.t()
The deployment environment, as a tag key: "env".
One of the three keys unified service
tagging
is built on, beside the span's service and version/0.
@spec error() :: String.t()
The span's error flag, as a tag key: "error".
@spec error_message() :: String.t()
What the failure said: "error.message".
@spec error_stack() :: String.t()
Where the failure came from: "error.stack".
@spec error_type() :: String.t()
What kind of thing went wrong: "error.type".
@spec limit_psr() :: String.t()
The rate limiter's effective rate when it ran on a rule-kept trace, a
metric key: "_dd.limit_psr".
@spec manual_drop() :: String.t()
Drop this trace, as a tag key: "manual.drop".
The tag form of DDTrace.drop_trace/0, on the same terms: any value but
false or nil makes the decision, and the key never reaches meta.
DDTrace.set_tag(DDTrace.Tags.manual_drop(), true)
@spec manual_keep() :: String.t()
Keep this trace, as a tag key: "manual.keep".
The tag form of DDTrace.keep_trace/0. Any value but false or nil
makes the decision; the key never reaches meta either way.
DDTrace.set_tag(DDTrace.Tags.manual_keep(), true)
@spec measured() :: String.t()
Opts a span into trace metrics, a metric key: "_dd.measured".
@spec origin() :: String.t()
Where the trace entered Datadog: "_dd.origin".
Set by a Datadog product upstream — "synthetics", "rum" — and carried
by every service the trace passes through. The tracer never mints one.
@spec propagation_error() :: String.t()
What went wrong propagating the trace: "_dd.propagation_error".
Written when the x-datadog-tags header could not be read or could not
be written. The trace still connects; the _dd.p.* tags it would have
carried do not.
@spec resource_name() :: String.t()
The span's resource, as a tag key: "resource.name".
@spec rule_psr() :: String.t()
The rate of the sampling rule that decided the trace, a metric key:
"_dd.rule_psr".
@spec sampling_priority() :: String.t()
The trace's sampling priority, a metric key: "_sampling_priority_v1".
@spec service_name() :: String.t()
The span's service, as a tag key: "service.name".
@spec span_type() :: String.t()
The span's Datadog type, as a tag key: "span.type".
@spec trace_id_upper() :: String.t()
The upper 64 bits of a 128-bit trace id: "_dd.p.tid".
@spec version() :: String.t()
The application version, as a tag key: "version".
The third of the unified service tagging keys. Written only on spans belonging to the configured service — a span naming a different service is describing somebody else's deployment, whose version this is not.