Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#81 template traceparent into exec command args #308

Merged
merged 7 commits into from
Mar 11, 2024

Conversation

tobert
Copy link
Collaborator

@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
Collaborator 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
1 check passed
@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.

1 participant