forked from open-telemetry/opentelemetry-go-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move span, trace and event implementation to sdk. (#27)
* move event to sdk. * move trace and span implementation to sdk. - also added noop implementation of span and trace. * fix review comments.
- Loading branch information
Showing
14 changed files
with
1,120 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// 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" | ||
|
||
"github.com/open-telemetry/opentelemetry-go/api/core" | ||
"github.com/open-telemetry/opentelemetry-go/api/event" | ||
) | ||
|
||
var _ Span = (*noopSpan)(nil) | ||
|
||
// SpancContext returns an invalid span context. | ||
func (sp *noopSpan) SpanContext() core.SpanContext { | ||
return core.INVALID_SPAN_CONTEXT | ||
} | ||
|
||
// IsRecordingEvents always returns false for noopSpan. | ||
func (sp *noopSpan) IsRecordingEvents() bool { | ||
return false | ||
} | ||
|
||
// SetStatus does nothing. | ||
func (sp *noopSpan) SetStatus(status codes.Code) { | ||
return | ||
} | ||
|
||
// ScopeID returns and empty ScopeID. | ||
func (sp *noopSpan) ScopeID() core.ScopeID { | ||
return core.ScopeID{} | ||
} | ||
|
||
// SetError does nothing. | ||
func (sp *noopSpan) SetError(v bool) { | ||
return | ||
} | ||
|
||
// SetAttribute does nothing. | ||
func (sp *noopSpan) SetAttribute(attribute core.KeyValue) { | ||
return | ||
} | ||
|
||
// SetAttributes does nothing. | ||
func (sp *noopSpan) SetAttributes(attributes ...core.KeyValue) { | ||
return | ||
} | ||
|
||
// ModifyAttribute does nothing. | ||
func (sp *noopSpan) ModifyAttribute(mutator core.Mutator) { | ||
return | ||
} | ||
|
||
// ModifyAttributes does nothing. | ||
func (sp *noopSpan) ModifyAttributes(mutators ...core.Mutator) { | ||
return | ||
} | ||
|
||
// Finish does nothing. | ||
func (sp *noopSpan) Finish() { | ||
return | ||
} | ||
|
||
// Tracer returns noop implementation of Tracer. | ||
func (sp *noopSpan) Tracer() Tracer { | ||
return t | ||
} | ||
|
||
// AddEvent does nothing. | ||
func (sp *noopSpan) AddEvent(ctx context.Context, event event.Event) { | ||
} | ||
|
||
// Record does nothing. | ||
func (sp *noopSpan) Record(ctx context.Context, m ...core.Measurement) { | ||
} | ||
|
||
// RecordSingle does nothing. | ||
func (sp *noopSpan) RecordSingle(ctx context.Context, m core.Measurement) { | ||
} |
Oops, something went wrong.