Skip to main content

Considerations

Before enabling infer DB attributes, please note the following:
  • Currently, only trace signals are supported.
  • The action parses db.query.text when present, otherwise db.statement.
  • Existing db.operation.name / db.collection.name (or legacy db.operation / db.sql.table) values are not overwritten.
  • Attributes are added only when inference is unambiguous: a single SQL operation and a single table/collection.
  • When new operation (and optionally collection) attributes are added, the span name may be updated to OPERATION collection (e.g. SELECT users) if it does not already contain those values.
  • Spans without a db.system / db.system.name attribute, or with a known non-SQL system (e.g. MongoDB, Redis), are skipped.

Use Cases

Enrich incomplete database spans
  • Some instrumentations record only the raw query text. This action derives OpenTelemetry semantic attributes (db.operation.name, db.collection.name) so backends can filter and group by operation and table.
Better span names and metrics
  • Normalized span names such as SELECT users make traces easier to read and improve aggregations when span metrics are enabled.
Consistent attributes across languages
  • Apply the same inference rules cluster-wide, regardless of which language or library produced the span.

Configuration Options

The InferDbAttributes action is configured using the odigos.io/v1alpha1.Action CRD with the inferDbAttributes configuration section.
actionName string : Allows you to attach a meaningful name to the action for convenience.
  • This field is optional
  • Odigos does not use or assume any meaning from this field
notes string : Allows you to attach notes regarding the action for convenience.
  • This field is optional
  • Odigos does not use or assume any meaning from this field
disabled boolean : Allows you to temporarily disable the action, but keep it saved for future use.
  • This field is optional, and defaults to false
signals string[] : An array with the signals that the action will operate on.
  • This field is required
  • Supported values: TRACES
inferDbAttributes object : Configuration for the InferDbAttributes action.
  • This field is required for this action type
  • No additional options are required; an empty object enables inference for matching sources.
scopes object : Limits which sources this config applies to.
  • This field is optional
  • If unset or empty, the config is applied to all sources.
  • If multiple source scopes are set, they must all match simultaneously (AND logic).
sources object[] : A list of workloads to apply this action to.
  • Each entry requires name, namespace, and kind (Deployment, StatefulSet, or DaemonSet).
namespaces string[] : Apply this action to all sources in the listed namespaces.
languages string[] : Apply this action only to containers instrumented with the listed programming languages.

Basic Example

Given a span with:
and without db.operation.name / db.collection.name, the action adds: and updates the span name to SELECT users if it hasn’t been set to that already.
1
Create a YAML file with the following content:
infer-db-attributes.yaml
2
Apply the action to the cluster:

Scoped Example

To limit inference to specific workloads, add scopes. Omit scopes (or leave it empty) to apply the action to all sources.
infer-db-attributes-scoped.yaml
Pair this action with DB Query Templatization to both infer semantic attributes and replace literals in the query text.