Last updated:
Rename Attributes
Give an attribute a new key with a Rename step in a transform rule, for example to align attribute names across services.
A Rename step gives an attribute a new key and keeps its value, within the same context. Use it to align attribute names across services, for example when one service sends userId and another sends user.id.
Add a Rename Step
- In the rule editor, click + Transformation and set Transformation to Rename. Or hover the attribute in Input sample data, click Add a transformation step, and pick Rename. That fills in the source for you.
- Fill in the fields:
- Source context: Where the attribute is: Resource, Scope, or the record, such as Span or Log record.
- Source attribute: The key to rename, for example
http.route. - Target attribute: The new key, for example
route.
- Check the Output panel: the old key shows as removed and the new key as added, with the same value.
Example
Renaming userId to user.id on spans writes these OpenTelemetry Transformation Language (OTTL) statements:
text
set(attributes["user.id"], attributes["userId"])
delete_key(attributes, "userId")Limits
- Attributes only: OTLP fields, such as
otel.span.nameorotel.log.body, can't be renamed. To put a field's value in an attribute, use Copy. - Same context: The attribute stays in its context. To move it to another context, use Move.
- Writable keys: Rename changes both keys, so neither may be protected or read-only.
Further Reading
-
About Signal Transformation. Add a transform rule and learn the parts of the rule editor.
-
Copy Attributes. Keep the original attribute and write its value under a second key.
-
Move Attributes. Move an attribute to the resource, the scope, or the record.
