-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
sdk/log/xlog: Add FilterProcessor and EnabledParameters #6286
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Sam Xie <[email protected]>
Co-authored-by: Sam Xie <[email protected]>
I think that we can make it working if we use |
sdk/log/go.mod
Outdated
@@ -10,6 +10,7 @@ require ( | |||
go.opentelemetry.io/otel v1.34.0 | |||
go.opentelemetry.io/otel/log v0.10.0 | |||
go.opentelemetry.io/otel/sdk v1.34.0 | |||
go.opentelemetry.io/otel/sdk/log/xlog v0.0.0-00010101000000-000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is interesting if the dependency is used only used in tests then it does not come up as an indirect dependency for modules using go.opentelemetry.io/otel/sdk/log
🎉
It looks like the Go module graph pruning has been improved at some point.
I think that it means that we could get rid of test
modules 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit strange. I've just tried that for otelhttp, and the SDK does come as an indirect dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think we cannot rely on the Go modules pruning and I will get rid of this dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adressed 08ac146
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit strange. I've just tried that for otelhttp, and the SDK does come as an indirect dependency.
@dmathieu , I tried it once more and actually it does NOT come as an indirect dependency.
See: open-telemetry/opentelemetry-go-contrib#6763
I had to run make go-mod-tidy
twice. Probably if we used crosslink tidylist
then it would not be necessary
We can could consider revert 08ac146. But I am fine with the current approach as well. It looks cleaner. I propose to keep the current way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it looks like the difference is that you used a different package name. So that'd be the trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it looks like the difference is that you used a different package name. So that'd be the trick.
I do not follow. The SDK is used in tests of both of otelhttp
and otelhttp_test
packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but when I tried it, I kept the otelhttp
package name for the tests. I think that's why the dependency still showed up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests still use it. Can you double check it? Make sure to run make go-mod-tidy
more than once 😉
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6286 +/- ##
=======================================
- Coverage 81.8% 81.6% -0.3%
=======================================
Files 283 284 +1
Lines 24892 24954 +62
=======================================
- Hits 20379 20370 -9
- Misses 4109 4179 +70
- Partials 404 405 +1 |
@@ -40,4 +40,5 @@ module-sets: | |||
- go.opentelemetry.io/otel/schema | |||
excluded-modules: | |||
- go.opentelemetry.io/otel/internal/tools | |||
- go.opentelemetry.io/otel/sdk/log/xlog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that relying on git hashes may be very annoying for the users.
It would be hard for them to keep sdk/log
and sdk/log/xlog
in sync.
- We are making commits very frequently so they may even not bump it
- It would be hard to figure it out which version of
xlog
is compatible withlog
with we do any breaking change.
On the other side, we can wait for making a release until people actually complain.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For comparison, the collector keeps x packages within the normal release process.
I have doubts about the idea, but if we want to allow folks to be able to get very fresh code, we could setup auto nightly/weekly releases for the x packages. Then, they wouldn't rely on commits, but would remain on the latest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add a linter to ensure no stable module uses an x
one?
Co-authored-by: Damien Mathieu <[email protected]>
I created #6298 to avoid scope creeping. |
Per #6271 (comment)
This introduces a new
go.opentelemetry.io/otel/sdk/log/xlog
module.I created it because of two reasons:
go.opentelemetry.io/otel/sdk/log
module does not expose these experimental feature in its exported API; it is only available in docs and example test. The user would have to explicitly opt-in by using thego.opentelemetry.io/otel/sdk/log/xlog
module which will always havev0.x.y
versions. Hopefully at some point of time the features are added togo.opentelemetry.io/otel/sdk/log
, deprecated ingo.opentelemetry.io/otel/sdk/log/xlog
and afterwards removed fromgo.opentelemetry.io/otel/sdk/log/xlog
. I think that for at one release we would need to support both the deprecatedgo.opentelemetry.io/otel/sdk/xlog.FilterProcessor
and newgo.opentelemetry.io/otel/sdk/log.FilterProcessor
to facilitate the migration process. The module name is inspired byxerrors
.xlog
is undersdk/log
so that it could have access to packages undersdk/log/internal
if necessary. The SDK supportsxlog
usingreflect
(duck typing) and thesdk/log
production code does not depend onxlog
so users should never experience build failures because of breaking changes inxlog
.Fixes #6298