migrate containerd/pkg/tracing - #24
Open
thaJeztah wants to merge 10 commits into
Open
Conversation
Member
Author
|
Oh! We need to update GolangCi lint, because it's now running go1.27 |
thaJeztah
force-pushed
the
integrate_tracing
branch
from
August 23, 2026 11:55
561b1f0 to
f12351d
Compare
thaJeztah
marked this pull request as draft
August 23, 2026 11:56
This adds valuable logging data to the open telemetry traces. When the trace is not recording we don't bother doing anything as it is relatively expensive to convert logrus data to otel just due to the nature of how logrus works. The way this works is that we now set a context on the logrus.Entry that gets passed around which the hook then uses to determine if there is an active span to forward the logs to. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This fixes the issue with the usage of the deprecated attribute.Any function that original caused build issues. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Swagat Bora <sbora@amazon.com>
Signed-off-by: Swagat Bora <sbora@amazon.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
While the hook is intended to be used with logrus, we don't need to have the direct import; use the aliases provided by the containerd/log module instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Check span.IsRecording first, as it's a more lightweight check than span.SpanContext().IsValid() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Introduce functional options to NewLogrusHook to allow optional Trace ID injection into log fields. This enables log-trace correlation via the [debug] config without breaking existing external consumers of pkg/tracing. Signed-off-by: Hasan Siddiqui <hasiddiqui@google.com>
Make the otel package a separate module, so that containerd/log does not inherit the otel dependencies. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Log fields which contain an error currently fall through to JSON
marshaling, which may produce an unhelpful value such as "{}" instead
of the error message.
Handle error values explicitly and use fmt.Sprint when formatting error
and fmt.Stringer values. Besides preserving their textual
representation, fmt handles typed-nil implementations without
propagating a panic from their Error or String method.
Also simplify the final fmt.Sprintf("%v", v) fallback to fmt.Sprint(v).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah
force-pushed
the
integrate_tracing
branch
from
August 23, 2026 15:48
f12351d to
aee2c9b
Compare
thaJeztah
marked this pull request as ready for review
August 23, 2026 15:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
migrate containerd/pkg/tracing
This migrates the log-related code from github.com/containerd/containerd/v2/pkg/tracing
Code was taken at this commit https://github.com/containerd/containerd/commits/fd399bd7b8cfdd47fb4f6cc021db417e5397a42f/pkg/tracing
Strategy taken:
otel: fix imports, remove testify, add go.mod
Make the otel package a separate module, so that containerd/log
does not inherit the otel dependencies.
otel: handle error and typed-nil Stringer attributes
Log fields which contain an error currently fall through to JSON
marshaling, which may produce an unhelpful value such as "{}" instead
of the error message.
Handle error values explicitly and use fmt.Sprint when formatting error
and fmt.Stringer values. Besides preserving their textual
representation, fmt handles typed-nil implementations without
propagating a panic from their Error or String method.
Also simplify the final fmt.Sprintf("%v", v) fallback to fmt.Sprint(v).