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

[cli] Add otel export to convert-trace #15439

Merged
merged 1 commit into from
Feb 16, 2024
Merged

Conversation

pgavlin
Copy link
Member

@pgavlin pgavlin commented Feb 15, 2024

These changes add support for converting a trace file into OpenTelemetry spans and sending them to a collector for further processing.

@pgavlin pgavlin added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Feb 15, 2024
@pgavlin
Copy link
Member Author

pgavlin commented Feb 15, 2024

This seems to be most useful when paired with the Jaeger all-in-one image running locally:

$ docker run --rm --name jaeger -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one:1.54
$ OTEL_SERVICE_NAME=pulumi OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 pulumi convert-trace --otel --ignore-log-spans [trace file]
converting trace...
dialing collector...
exporting spans for trace [trace ID]...
shutting down...
$ open http://localhost:16686/trace/[trace ID]

@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2024-02-15)

Copy link
Contributor

@PollRobots PollRobots left a comment

Choose a reason for hiding this comment

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

LGTM

@pgavlin pgavlin added this pull request to the merge queue Feb 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 15, 2024
These changes add support for converting a trace file into OpenTelemetry
spans and sending them to a collector for further processing.
@pgavlin pgavlin added this pull request to the merge queue Feb 16, 2024
Merged via the queue into master with commit 1c68e3f Feb 16, 2024
46 checks passed
@pgavlin pgavlin deleted the pgavlin/convert-trace-otel branch February 16, 2024 00:58
@justinvp
Copy link
Member

Nice! Can you add some tests?

@pgavlin
Copy link
Member Author

pgavlin commented Feb 16, 2024

Nice! Can you add some tests?

I can, yes. Wasn't aware that we wanted coverage for debug-only commands

@justinvp
Copy link
Member

We do. Even for experimental/debug commands. If it's shipping in the product, it needs tests.

@pgavlin
Copy link
Member Author

pgavlin commented Feb 16, 2024

We do. Even for experimental/debug commands. If it's shipping in the product, it needs tests.

Roger that. I’ll come up with a way to test this.

github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2024
# Description

Re #15439


I was trying out the `--otel` flag for trace export and got a nil
pointer in `span.InstrumentationScope`

```
Pulumi Version:   3.106.1-dev.0
Go Version:       go1.21.7
Go Compiler:      gc
Architecture:     arm64
Operating System: darwin
Panic:            runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
runtime/debug.Stack()
        /opt/homebrew/Cellar/go/1.21.7/libexec/src/runtime/debug/stack.go:24 +0x64
main.panicHandler(0x1400231feff)
        /Users/julien/Projects/pulumi/pulumi/pkg/cmd/pulumi/main.go:35 +0x44
panic({0x107033d20?, 0x1087b94c0?})
        /opt/homebrew/Cellar/go/1.21.7/libexec/src/runtime/panic.go:914 +0x218
main.(*otelSpan).InstrumentationScope(0x1072ffe40?)
        <autogenerated>:1 +0x34
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform.Spans({0x140015a3000, 0x1, 0x1?})
        /Users/julien/Projects/go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.19.0/internal/tracetransform/span.go:51 +0x168
go.opentelemetry.io/otel/exporters/otlp/otlptrace.(*Exporter).ExportSpans(0x14002000050, {0x107482ec8, 0x1089ffe20}, {0x140015a3000?, 0x1400231fb08?, 0x1?})
        /Users/julien/Projects/go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.19.0/exporter.go:44 +0x38
main.exportTraceToOtel({0x10745ae08, 0x140015155a0}, 0x1)
        /Users/julien/Projects/pulumi/pulumi/pkg/cmd/pulumi/convert-trace.go:645 +0x3c0
main.newConvertTraceCmd.func1(0x0?, {0x14001515540, 0x1, 0x0?})
        /Users/julien/Projects/pulumi/pulumi/pkg/cmd/pulumi/convert-trace.go:677 +0xf8
main.newConvertTraceCmd.RunFunc.func2(0x0?, {0x14001515540?, 0x0?, 0x0?})
        /Users/julien/Projects/pulumi/pulumi/sdk/go/common/util/cmdutil/exit.go:99 +0x28
main.newConvertTraceCmd.RunFunc.RunResultFunc.func5(0x1400157a900?, {0x14001515540, 0x1, 0x2})
        /Users/julien/Projects/pulumi/pulumi/sdk/go/common/util/cmdutil/exit.go:115 +0x34
github.com/spf13/cobra.(*Command).execute(0x14001592600, {0x14001515520, 0x2, 0x2})
        /Users/julien/Projects/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x654
github.com/spf13/cobra.(*Command).ExecuteC(0x14000d5f800)
        /Users/julien/Projects/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/julien/Projects/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
        /Users/julien/Projects/pulumi/pulumi/pkg/cmd/pulumi/main.go:56 +0x54
```

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants