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

create spans directly using protobuf structures #175

Merged
merged 20 commits into from
May 3, 2023
Merged

Conversation

tobert
Copy link
Collaborator

@tobert tobert commented Mar 13, 2023

otel-cli was always a problem child user of opentelemetry-go. From the very start the otelclicarrier.go file was working around intentional limitations in the SDK. This set of changes moves otel-cli to directly create spans using the protocol buffer structures from OTLP, and then sends them along using the opentelemetry-collector backend.

It doesn't look like this reduced dependencies significantly, which is expected since the OTel SDK is mostly defensive coding to make API use consistent.

Somewhat inspired by #173, which may be doable through the SDK, but this makes features like that request a breeze.

Amy Tobey added 4 commits March 13, 2023 18:54
otel-cli was always a problem child user of opentelemetry-go. From the
very start the otelclicarrier.go file was working around intentional
limitations in the SDK. This set of changes moves otel-cli to directly
create spans using the protocol buffer structures from OTLP, and then
sends them along using the opentelemetry-collector backend.

It doesn't look like this reduced dependencies significantly, which is
expected since the OTel SDK is mostly defensive coding to make API use
consistent.
@tobert
Copy link
Collaborator Author

tobert commented Mar 14, 2023

Unit tests are clean. Functional tests aren't passing yet. Will work on that more tomorrow.

Amy Tobey added 9 commits March 14, 2023 11:19
Looks like the previous code was wrong anyways. It didn't make sense to
me to have the ignoreEnv option checked before setting current span to
traceparent so I removed it. Test passes now.
I think this was doing the wrong thing before.
This should have broken before! The example config set traceparent
required and a carrier file that doesn't exist so it should not have
worked. The test broke when the bug in otel-cli was fixed.
Added commented out detectors too. Those should probably be off by
default and some options provided to turn them on. At least need a
way to turn them off for testing.
This makes it possible to implement prior behavior in --tp-print cases
by passing the span down to propagation functions. I'm not convinced
this is worth preserving but want to get everything running without
changing tests too much.
@@ -375,7 +375,7 @@ var suites = []FixtureSuite{
WithTraceparentIgnoreEnv(true).
WithTraceparentPrint(true).
WithTraceparentPrintExport(true).
WithTraceparentRequired(true).
WithTraceparentRequired(false).
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was a bug that this didn't break before. The example TP file wasn't ever available, so --tp-required wasn't working right in this case. It's fixed in this PR so the test broke.

Amy Tobey added 7 commits March 14, 2023 13:14
Moved some helpers to the protobuf_span.go along with the tests. Mostly
code organization but also some renames and additional tests to firm
things up.
Refactored id generators to accept a config instead of using the global,
which meant moving id generation to WithConfig which makes more sense
anyways.
@tobert tobert marked this pull request as ready for review March 27, 2023 15:07
@tobert tobert merged commit 7565b2c into main May 3, 2023
@tobert tobert deleted the replace-otel-sdk branch May 3, 2023 20:53
This was referenced May 4, 2023
tobert pushed a commit that referenced this pull request May 22, 2023
As predicted, this was straightforward after #175 :)
tobert added a commit that referenced this pull request May 23, 2023
* add span options to status command

Useful to test the new --force-span-id and --force-trace-id options.

* add --force-trace-id and --force-span-id and test

As predicted, this was straightforward after #175 :)

* correct option names in comments

* match json key names to command line flags
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