Skip to content

Conversation

@tobert
Copy link
Contributor

@tobert tobert commented Feb 23, 2024

Adds a feature to otel-cli exec to make it easier to get a traceparent into the child's command line args.

solves #306 #81

export TRACEPARENT=00-5b28ee2bf1f1796cca65bef26fb90c35-9d699b596c3dced3-01
./otel-cli exec --endpoint localhost:4317 -- \
   curl --verbose -H 'traceparent: {{traceparent}}' http://tobert.org
*   Trying 45.33.3.11:80...
* Connected to tobert.org (45.33.3.11) port 80 (#0)
> GET / HTTP/1.1
> Host: tobert.org
> User-Agent: curl/7.81.0
> Accept: */*
> traceparent: 00-5b28ee2bf1f1796cca65bef26fb90c35-433d7e8620e9ccea-01

Amy Tobey added 3 commits February 23, 2024 14:00
```
$ go build && TRACEPARENT=00-5b28ee2bf1f1796cca65bef26fb90c35-9d699b596c3dced3-01 ./otel-cli exec --endpoint localhost:4317 -- curl --verbose -H 'traceparent: {{tr
aceparent}}' http://tobert.org
*   Trying 45.33.3.11:80...
* Connected to tobert.org (45.33.3.11) port 80 (#0)
> GET / HTTP/1.1
> Host: tobert.org
> User-Agent: curl/7.81.0
> Accept: */*
> traceparent: 00-5b28ee2bf1f1796cca65bef26fb90c35-433d7e8620e9ccea-01
```
config.Attributes["arguments"] = buf.String()

child = exec.CommandContext(cmdCtx, args[0], args[1:]...)
child = exec.CommandContext(cmdCtx, args[0], tpArgs...)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a command-line arg to enable/disable this feature?

@tobert tobert changed the title add support to template traceparent into exec command args #81 template traceparent into exec command args Feb 23, 2024
@tobert tobert merged commit b23efba into main Mar 11, 2024
@tobert tobert deleted the otel-exec-template-traceparent branch March 11, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants