-
Notifications
You must be signed in to change notification settings - Fork 526
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
Update default span/transaction type for OTel #6834
Conversation
b093d8b
to
33b23c5
Compare
33b23c5
to
0c0e517
Compare
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
(cherry picked from commit b571545) # Conflicts: # changelogs/head.asciidoc
…6841) * Update default span/transaction type for OTel (#6834) (cherry picked from commit b571545) # Conflicts: # changelogs/head.asciidoc * Delete head.asciidoc Co-authored-by: Andrew Wilkins <[email protected]>
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
Confirmed with 50edba1 package main
import (
"context"
"log"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp"
"go.opentelemetry.io/otel/exporters/otlp/otlpgrpc"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
oteltrace "go.opentelemetry.io/otel/trace"
)
var tracer = otel.Tracer("mux-server")
func main() {
tp := initTracer()
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
}
}()
// Change SpanKind here.
_, span := tracer.Start(context.Background(), "span", oteltrace.WithSpanKind(oteltrace.SpanKindClient))
defer span.End()
}
func initTracer() *sdktrace.TracerProvider {
ctx := context.Background()
endpoint := "localhost:8200"
driver := otlpgrpc.NewDriver(
otlpgrpc.WithInsecure(),
otlpgrpc.WithEndpoint(endpoint),
)
exporter, err := otlp.NewExporter(ctx, driver)
if err != nil {
log.Fatal(err)
}
resources := resource.NewWithAttributes(
attribute.String("host.name", "slaptop"),
)
tp := sdktrace.NewTracerProvider(
sdktrace.WithSampler(sdktrace.AlwaysSample()),
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(resources),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(
propagation.NewCompositeTextMapPropagator(
propagation.TraceContext{},
propagation.Baggage{},
),
)
return tp
} |
Motivation/summary
Align OpenTelemetry span type/subtype with the agent bridge spec:
app.internal
for internal spansunknown
for non-internal spansunknown
for transactions${component}
attribute handlingChecklist
- [ ] Update package changelog.yml (only if changes toapmpackage
have been made)- [ ] Documentation has been updatedHow to test these changes
Related issues
Closes #6543