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

feat: implement opentelemetry for distributed tracing #706

Merged
merged 15 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: avoid shadowing
Signed-off-by: namkyu1999 <[email protected]>
namkyu1999 committed Oct 9, 2024
commit 2d476f8837b8bd1cfb88dee9694a5fd27692cede
10 changes: 5 additions & 5 deletions bin/experiment/experiment.go
Original file line number Diff line number Diff line change
@@ -80,23 +80,23 @@ func init() {
}

func main() {
ctx := context.Background()
initCtx := context.Background()

// Set up Observability.
if otelExporterEndpoint := os.Getenv(telemetry.OTELExporterOTLPEndpoint); otelExporterEndpoint != "" {
shutdown, err := telemetry.InitOTelSDK(ctx, true, otelExporterEndpoint)
shutdown, err := telemetry.InitOTelSDK(initCtx, true, otelExporterEndpoint)
if err != nil {
return
namkyu1999 marked this conversation as resolved.
Show resolved Hide resolved
}
defer func() {
err = errors.Join(err, shutdown(ctx))
err = errors.Join(err, shutdown(initCtx))
}()
ctx = telemetry.GetTraceParentContext()
initCtx = telemetry.GetTraceParentContext()
}

clients := cli.ClientSets{}

ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "ExecuteExperiment")
ctx, span := otel.Tracer(telemetry.TracerName).Start(initCtx, "ExecuteExperiment")
defer span.End()

// parse the experiment name
2 changes: 1 addition & 1 deletion bin/helper/helper.go
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ func main() {

clients := cli.ClientSets{}

ctx, span := otel.Tracer(telemetry.TracerName).Start(ctx, "ExecuteExperimentHelper")
_, span := otel.Tracer(telemetry.TracerName).Start(ctx, "ExecuteExperimentHelper")
defer span.End()

// parse the helper name