2019-06-27 07:03:09 +02:00
|
|
|
// Copyright 2019, 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 (
|
|
|
|
"context"
|
2019-09-25 08:12:22 +02:00
|
|
|
"time"
|
2019-06-27 07:03:09 +02:00
|
|
|
|
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
|
2019-11-01 20:40:29 +02:00
|
|
|
"go.opentelemetry.io/otel/api/core"
|
2019-06-27 07:03:09 +02:00
|
|
|
)
|
|
|
|
|
2019-08-14 01:03:41 +02:00
|
|
|
type NoopSpan struct {
|
2019-06-28 07:59:13 +02:00
|
|
|
}
|
|
|
|
|
2019-08-14 01:03:41 +02:00
|
|
|
var _ Span = (*NoopSpan)(nil)
|
2019-06-27 07:03:09 +02:00
|
|
|
|
|
|
|
// SpancContext returns an invalid span context.
|
2019-08-14 01:03:41 +02:00
|
|
|
func (NoopSpan) SpanContext() core.SpanContext {
|
2019-08-12 19:59:35 +02:00
|
|
|
return core.EmptySpanContext()
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
2019-10-11 03:07:35 +02:00
|
|
|
// IsRecording always returns false for NoopSpan.
|
|
|
|
func (NoopSpan) IsRecording() bool {
|
2019-06-27 07:03:09 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetStatus does nothing.
|
2019-08-14 01:03:41 +02:00
|
|
|
func (NoopSpan) SetStatus(status codes.Code) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetError does nothing.
|
2019-08-14 01:03:41 +02:00
|
|
|
func (NoopSpan) SetError(v bool) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetAttributes does nothing.
|
2019-08-14 01:03:41 +02:00
|
|
|
func (NoopSpan) SetAttributes(attributes ...core.KeyValue) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
2019-09-27 19:48:10 +02:00
|
|
|
// End does nothing.
|
|
|
|
func (NoopSpan) End(options ...EndOption) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Tracer returns noop implementation of Tracer.
|
2019-08-14 01:03:41 +02:00
|
|
|
func (NoopSpan) Tracer() Tracer {
|
|
|
|
return NoopTracer{}
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// AddEvent does nothing.
|
2019-12-18 20:13:05 +02:00
|
|
|
func (NoopSpan) AddEvent(ctx context.Context, name string, attrs ...core.KeyValue) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
2019-08-26 20:53:12 +02:00
|
|
|
|
2019-09-25 08:12:22 +02:00
|
|
|
// AddEventWithTimestamp does nothing.
|
2019-12-18 20:13:05 +02:00
|
|
|
func (NoopSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, name string, attrs ...core.KeyValue) {
|
2019-09-25 08:12:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-26 20:53:12 +02:00
|
|
|
// SetName does nothing.
|
|
|
|
func (NoopSpan) SetName(name string) {
|
2019-11-28 09:20:34 +02:00
|
|
|
}
|