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"
|
|
|
|
|
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
|
2019-07-15 23:49:21 +02:00
|
|
|
"go.opentelemetry.io/api/core"
|
|
|
|
"go.opentelemetry.io/api/event"
|
|
|
|
"go.opentelemetry.io/api/tag"
|
2019-06-27 07:03:09 +02:00
|
|
|
)
|
|
|
|
|
2019-06-28 07:59:13 +02:00
|
|
|
type noopSpan struct {
|
|
|
|
}
|
|
|
|
|
2019-06-27 07:03:09 +02:00
|
|
|
var _ Span = (*noopSpan)(nil)
|
|
|
|
|
|
|
|
// SpancContext returns an invalid span context.
|
2019-07-12 00:28:38 +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
|
|
|
}
|
|
|
|
|
|
|
|
// IsRecordingEvents always returns false for noopSpan.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) IsRecordingEvents() bool {
|
2019-06-27 07:03:09 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetStatus does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) SetStatus(status codes.Code) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetError does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) SetError(v bool) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetAttribute does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) SetAttribute(attribute core.KeyValue) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetAttributes does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) SetAttributes(attributes ...core.KeyValue) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ModifyAttribute does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) ModifyAttribute(mutator tag.Mutator) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ModifyAttributes does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) ModifyAttributes(mutators ...tag.Mutator) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Finish does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) Finish() {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Tracer returns noop implementation of Tracer.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) Tracer() Tracer {
|
|
|
|
return noopTracer{}
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// AddEvent does nothing.
|
2019-07-12 00:28:38 +02:00
|
|
|
func (noopSpan) AddEvent(ctx context.Context, event event.Event) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 00:28:38 +02:00
|
|
|
// Event does nothing.
|
|
|
|
func (noopSpan) Event(ctx context.Context, msg string, attrs ...core.KeyValue) {
|
2019-06-27 07:03:09 +02:00
|
|
|
}
|