2020-03-24 07:41:10 +02:00
|
|
|
// Copyright The OpenTelemetry Authors
|
2019-06-27 07:03:09 +02:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
2020-01-03 19:38:05 +02:00
|
|
|
// SpanContext returns an invalid span context.
|
2020-05-02 14:17:11 +02:00
|
|
|
func (NoopSpan) SpanContext() SpanContext {
|
|
|
|
return 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.
|
2020-03-07 20:38:59 +02:00
|
|
|
func (NoopSpan) SetStatus(status codes.Code, msg string) {
|
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
|
|
|
}
|
|
|
|
|
2020-04-28 23:24:47 +02:00
|
|
|
// SetAttribute does nothing.
|
|
|
|
func (NoopSpan) SetAttribute(k string, v interface{}) {
|
|
|
|
}
|
|
|
|
|
2019-09-27 19:48:10 +02:00
|
|
|
// End does nothing.
|
|
|
|
func (NoopSpan) End(options ...EndOption) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
2020-02-28 23:44:53 +02:00
|
|
|
// RecordError does nothing.
|
|
|
|
func (NoopSpan) RecordError(ctx context.Context, err error, opts ...ErrorOption) {
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|