-
Notifications
You must be signed in to change notification settings - Fork 91
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
Custom SDK implementation #954
Comments
@MrAlias What do you think should be included in the prototype? |
Ideally, something like this: package main
import (
"fmt"
"time"
)
var Flag bool
func main() {
for {
fmt.Printf("Flag: %t", Flag)
time.Sleep(time.Second)
}
// Output: Flag: false
// Auto-instrumentation added
// Output: Flag: true
} |
We may also need to look into having the global package call something like: func (t *tracer) start(eBPFFlag *bool, ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
/* ... */
} and instrument that instead of |
@MrAlias I did a POC for the second option we talked about. It is in main...RonFed:opentelemetry-go-instrumentation_fork:flag_POC Here are some logs from the app being instrumented and the agent:
|
Awesome! Let me see about getting an issue created in https://github.com/open-telemetry/opentelemetry-go to make the proposal based on these findings. |
opentelemetry-go proposal: open-telemetry/opentelemetry-go#5702 @RonFed PTAL |
@MrAlias LGTM, |
I was thinking |
Yea, that sounds good, we'll need to have a return probe for that function as well simillar to what we have today - in order to save the returned span pointer in a map. |
Correct. |
Adds a new go.opentelemetry.io/auto/sdk module that holds the OpenTelemetry SDK implementation used by auto-instrumentation. Part of open-telemetry#954 Split from open-telemetry#1045
Adds a new go.opentelemetry.io/auto/sdk module that holds the OpenTelemetry SDK implementation used by auto-instrumentation. Part of open-telemetry#954 Split from open-telemetry#1045
With the custom sdk we're providing, do we still need the probes for the global instrumentation that we already have? Or could we just implement those functions in our sdk (Start, End, SetAttributes, etc)? In that case we would only need to auto-instrument the custom sdk's |
Correct. After we have opentelemetry-go use our SDK we won't need to instrument the |
We will still need to instrument the initial call to |
Hmm, we could also look into just instrumenting a |
* Add the auto-instrumentation SDK wireframe Adds a new go.opentelemetry.io/auto/sdk module that holds the OpenTelemetry SDK implementation used by auto-instrumentation. Part of #954 Split from #1045 * Add dependabot entry * Ignore the sdk module until it is finished * Set Go mod go directive to 1.21.0 * Fix lint
* Add the auto-instrumentation SDK wireframe Adds a new go.opentelemetry.io/auto/sdk module that holds the OpenTelemetry SDK implementation used by auto-instrumentation. Part of open-telemetry#954 Split from open-telemetry#1045 * Add dependabot entry * Ignore the sdk module until it is finished * Set Go mod go directive to 1.21.0 * Fix lint
* Test SDK's Span.IsRecording Part of #954 * Fix merge
* Test the SDK's Span.SpanContext method Part of #954 * Fix merge
* Implement the Span.SetName method Part of #954 * Update sdk/trace_test.go
With #1195 merged, the remaining tasks for this are to publish the |
Done. There are still some clean-up tasks that can be addressed in their own issues. |
Initial support for interoperability with manual instrumentation was added in #523. This approach has issues when trying to implement methods like
IsRecording
,RecordError
, andAddEvent
, as well as the inability to capture theSpanStartOptions
which contain important definitions about the span.Provide our own SDK
An alternate solution for this interoperability was proposed in #352 (comment):
Providing an SDK implementation like this would allow us to design minimal overhead in the Go implementation to resolve all the issues found with the current approach. Namely:
IsRecording
, the span implementation could read its value from the spanstruct
field that could be set in the eBPF spaceRecordError
could call a method like `func (s span) recordError(errMsg, errName string, cfg trace.EventConfig). This method would have all the needed information for the probe already resolved.RecordError
,AddEvent
could call aaddEvent
method designed to have all the information for the probe already resolved in the call arguments.Interoperability
The remaining issues with providing a custom SDK, is how this would be integrated into users code?
The original idea was to offer this SDK as a package under
go.opentelemetry.io/auto
. This could still be provided, but if this is the only way this solution is integrated it means user code needs to be updated to inter-op with auto-instrumentation.Requiring user code to be updated to work with auto-instrumentation is not desired. The whole point of auto-instrumentation is this kind of action would not be required.
Instead, we would like to have the default global
otel
implementation inter-op with this new SDK:var
) would be addedgo.opentelemetry.io/otel/internal/global
.false
by defaulttrue
Tracer
implementation creates a new span it will check this added flag (i.e. here), and iftrue
will return our custom SDK implementation of theSpan
instead of thenonRecordingSpan
Action Items
The text was updated successfully, but these errors were encountered: