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

Tart/Vetu: log *exec.Cmd standard output/error streams to OpenTelemetry #825

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

edigaryev
Copy link
Contributor

Looks like this:

Screenshot 2025-01-15 at 15 29 20

Tried to use log/slog, but unfortunately its OpenTelemetry bridge lacks context propagation and log/slog has no handy adapters like go.uber.org/zap/zapio.

@edigaryev edigaryev requested a review from fkorotkov January 15, 2025 11:29
errChan chan error
ident string
env map[string]string
backgroundCtxWithSpan context.Context
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just in place use something like

trace.ContextWithSpan(context.Background(), trace.SpanFromContext(vm.runningVMCtx))

for all Cmd invocations? Why storing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why storing it?

Because (vm *VM) Close() needs it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It can do it in in place:

ctx := trace.ContextWithSpan(context.Background(), trace.SpanFromContext(vm.runningVMCtx))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See c233d04.

@edigaryev edigaryev merged commit 1a1a4b2 into master Jan 15, 2025
9 of 11 checks passed
@edigaryev edigaryev deleted the log-exec-cmd-to-opentelemetry branch January 15, 2025 15:07
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