Skip to content

Adding or partially overriding attributes #358

@mechie

Description

@mechie

Unsure whether I'm not spotting the right incantation/flag to do this, or it is a feature request.

Under the following circumstances, it would be useful to be able to append/override attributes instead of overwriting them:

  1. When calling span end on a span that already has attributes:
    TEST_SOCK=$(mktemp -d)
    otel-cli span background \
        --name "test" \
        --sockdir "${TEST_SOCK}" \
        --attr "color=red,size=large" \
        &
    # ...
    otel-cli span end \
        --sockdir "${TEST_SOCK}" \
        --attr "weight=100,size=small"
    # Want span with attributes { color=red, size=small, weight=100 }
  2. When calling any command with --attr when OTEL_CLI_ATTRIBUTES is non-empty:
    OTEL_CLI_ATTRIBUTES="color=red,size=large"
    otel-cli exec \
        --name "test" \
        --attr "weight=100,size=small" \
        work
    # Want span with attributes { color=red, size=small, weight=100 }

In OTel terms of other languages/instrumentations, it would give us Set Attributes-like capabilities. This could be an additional attribute argument (--add-attr and OTEL_CLI_ADDITIONAL_ATTRIBUTES?), or a flag (--preserve-attr and OTEL_CLI_PRESERVE_EXISTING_ATTRIBUTES?) modifying the behavior of --attr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions