1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-26 03:52:03 +02:00
Tyler Yahn e53841a4b4
Support Instrumentation Library Info in Trace Export Pipeline (#805)
* Update Tracer API with instrumentation version

Add option to the `Provider.Tracer` method to specify the
instrumentation version.

Update the global, noop, opentracing bridge, and default SDK
implementations.

This does not propagate the instrumentation library version to the
exported span. That is left for a follow-on PR.

* Revert trace_test.go

This is for the next PR.

* Support instrumentation library in SDK trace exports

* Update Jaeger exporter to export instrumentation
2020-06-09 22:15:53 -07:00

93 lines
2.8 KiB
Go

// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package trace // import "go.opentelemetry.io/otel/sdk/export/trace"
import (
"context"
"time"
"google.golang.org/grpc/codes"
"go.opentelemetry.io/otel/api/kv"
apitrace "go.opentelemetry.io/otel/api/trace"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/resource"
)
// SpanSyncer is a type for functions that receive a single sampled trace span.
//
// The ExportSpan method is called synchronously. Therefore, it should not take
// forever to process the span.
//
// The SpanData should not be modified.
type SpanSyncer interface {
ExportSpan(context.Context, *SpanData)
}
// SpanBatcher is a type for functions that receive batched of sampled trace
// spans.
//
// The ExportSpans method is called asynchronously. However its should not take
// forever to process the spans.
//
// The SpanData should not be modified.
type SpanBatcher interface {
ExportSpans(context.Context, []*SpanData)
}
// SpanData contains all the information collected by a span.
type SpanData struct {
SpanContext apitrace.SpanContext
ParentSpanID apitrace.SpanID
SpanKind apitrace.SpanKind
Name string
StartTime time.Time
// The wall clock time of EndTime will be adjusted to always be offset
// from StartTime by the duration of the span.
EndTime time.Time
Attributes []kv.KeyValue
MessageEvents []Event
Links []apitrace.Link
StatusCode codes.Code
StatusMessage string
HasRemoteParent bool
DroppedAttributeCount int
DroppedMessageEventCount int
DroppedLinkCount int
// ChildSpanCount holds the number of child span created for this span.
ChildSpanCount int
// Resource contains attributes representing an entity that produced this span.
Resource *resource.Resource
// InstrumentationLibrary defines the instrumentation library used to
// providing instrumentation.
InstrumentationLibrary instrumentation.Library
}
// Event is used to describe an Event with a message string and set of
// Attributes.
type Event struct {
// Name is the name of this event
Name string
// Attributes contains a list of kv pairs.
Attributes []kv.KeyValue
// Time is the time at which this event was recorded.
Time time.Time
}