1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

use LinkedTo rather than ChildOf for PublicEndpoint (#272)

This causes us to no longer emit missing root spans if we do not have the trace associated with the tracing headers we receive on public endpoints.
This commit is contained in:
Liz Fong-Jones
2019-11-04 14:03:40 +01:00
committed by GitHub
parent ecf3bb9d7c
commit 9f82c642f5
3 changed files with 15 additions and 5 deletions

View File

@ -103,6 +103,7 @@ type SpanOption func(*SpanOptions)
type SpanOptions struct {
Attributes []core.KeyValue
StartTime time.Time
Links []Link
Relation Relation
Record bool
SpanKind SpanKind
@ -197,6 +198,13 @@ func FollowsFrom(sc core.SpanContext) SpanOption {
}
}
// LinkedTo allows instantiating a Span with initial Links.
func LinkedTo(sc core.SpanContext, attrs ...core.KeyValue) SpanOption {
return func(o *SpanOptions) {
o.Links = append(o.Links, Link{sc, attrs})
}
}
// WithSpanKind specifies the role a Span on a Trace.
func WithSpanKind(sk SpanKind) SpanOption {
return func(o *SpanOptions) {