AutoMerge is generally available

Last updated:

Move Attributes

Move an attribute between the resource, the scope, and the record with a Move step in a transform rule.

A Move step moves an attribute, with the same key, from one context to another. Use it when an attribute arrives at the wrong level, for example a host.name sent on every log record that belongs on the resource.

Move step that moves k8s.pod.name from the Resource context to the Span context, and the OTTL it writes

Add a Move Step

  1. In the rule editor, click + Transformation and set Transformation to Move. Or hover the attribute in Input sample data, click Add a transformation step, and pick Move.
  2. Fill in the fields:
  • Source context: Where the attribute is now: Resource, Scope, or the record, such as Span or Log record.
  • Source attribute: The attribute to move, for example host.name.
  • Target context: Where to move it. It must differ from the source context.
  1. Check the Output panel: the attribute shows as removed in its old section and added in the new one.

Example

Moving host.name from the log record to the resource writes these OpenTelemetry Transformation Language (OTTL) statements:

text
set(resource.attributes["host.name"], attributes["host.name"])
delete_key(attributes, "host.name")

Limits

  • Contexts the rule reaches: A rule with the Resource context has a single context, so it offers no Move. A rule with the Scope context moves between Resource and Scope.
  • Attributes only: OTLP fields can't be moved. To put a field's value in an attribute, use Copy.
  • Writable keys: Move changes the attribute in both contexts, so it may not be protected or read-only in either.

Further Reading