Considerations
Use Cases
Accessing deeply nested attributes within strings- Easily extract and access values of deeply nested attributes within payloads of JSONs, SQL statements or URLs.
- Extract domain-specific identifiers (e.g.
order_id,user_id,study_id) embedded inside payloads, SQL statements, or URL paths into top-level span attributes so they can be indexed, filtered, and aggregated by your backend.
- Lift correlation IDs that are buried inside structured payloads (JSON envelopes, request/response bodies) onto the span itself so traces can be searched and joined by business identifiers.
- Avoid sending the full payload to your backend by extracting only the meaningful fields, then dropping or masking the original payload attribute with another action.
Configuration Options
The ExtractAttribute action is configured using theodigos.io/v1alpha1.Action CRD with the extractAttribute configuration section.
actionName
actionName
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
notes
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
disabled
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 *
signals *
signals
string[] : An array with the signals that the action will operate on.- This field is required
- Supported values:
TRACES
extractAttribute *
extractAttribute *
extractAttribute
object : Configuration for the ExtractAttribute action.- This field is required for this action type
extractions *
extractions *
extractions
object[] : An ordered array of extraction rules to apply to each span. Must contain at least one entry.- This field is required
targetAttributeName *
targetAttributeName *
targetAttributeName
string : The name of the new span attribute the extracted value will be written to.- This field is required
- Must be unique across all extractions in the same action.
lookupKey
lookupKey
lookupKey
string : The literal key to look up inside the scanned attributes (resolved via dataFormat into a regex).- This field is required when
dataFormatis set, and must be omitted whenregexis set.
dataFormat
dataFormat
dataFormat
string : A pre-set format that defines how lookupKey is matched inside the scanned attributes.- This field is required when
lookupKeyis set, and must be omitted whenregexis set. - Supported values:
json— matcheskey: valuepairs in JSON envelopes (e.g.{"order_id": "42"}ororder_id: 42).sql— matcheskey = valuepairs in SQL statements (e.g.WHERE order_id = '42'ororder_id=42).resource_path— matcheskey/valuesegments inside URL paths (e.g./projects/test-project), stopping at the next/, whitespace,?,&,#, or quote.
regex
regex
regex
string : A custom regular expression with a single capture group whose value is written to the attribute named targetAttributeName.- This field is required when
lookupKeyanddataFormatare not set. - The first capture group of the first match is used.
Basic Example
The following example demonstrates the four extraction variations against a single span that has the following attributes:messaging.message.payload:{"task_id": "task-7f3a9b2c", "status": "Completed"}http.request.payload:tenants/acme-corp/regions/us-east/workspaces/main/services/analytics/jobs/task-7f3a9b2c/runs/run-001db.statement:SELECT * FROM invoices WHERE invoice_id = '42' -- request_id req-xyz9
| New attribute name | Extracted value |
|---|---|
extracted.json.task_id | task-7f3a9b2c |
extracted.sql.invoice_id | 42 |
extracted.url.tenant | acme-corp |
extracted.url.region | us-east |
extracted.url.job | task-7f3a9b2c |
extracted.regex.request_id | xyz9 |