Skip to content

inject {{traceparent}} into commands passed to otel-cli exec #81

@tobert

Description

@tobert

A common use case for otel-cli exec is to wrap curl. When a traceparent is already in the environment, it's pretty straightforward: otel-cli exec curl -H "traceparent: ${TRACEPARENT}" $url. Even when that's present sometimes we want a separate span around the exec, and currently doing that is clunky / hard.

If we add templating for command arguments passing through otel-cli exec it could be come straightforward to do:

otel-cli exec curl -H "traceparent: {{traceparent}}"

Where, otel-cli exec would start the span then inject that traceparent into the curl command's header, and then things should all line up nicely.

This code should be careful to only pass a traceparent it generated to avoid any security issues around command injection. It's not a terribly likely path of attack but worth keeping in mind when dealing with command manipulation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestminorminor semver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions