forked from open-telemetry/opentelemetry-collector
-
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.
Consolidate AddEvent and Event methods, add FinishOptions (open-telem…
…etry#99) * Merge two event methods in span API There was an agreement to get rid of the Event interface and consolidate the two methods for adding events into one. See open-telemetry#57. * Eliminate the use of the Event interface There is no need for the SDK to provide the implementation of the Event interface - it is used nowhere. * Drop the Event interface It's dead code now. * Make it possible to override a finish timestamp through options Opentracing to opentelemetry bridge will certainly use this feature. * Obey the start time option * Add tests for events and custom start/end times
- Loading branch information
Showing
15 changed files
with
297 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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,60 @@ | ||
// 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 internal // import "go.opentelemetry.io/experimental/streaming/sdk/internal" | ||
|
||
import ( | ||
"go.opentelemetry.io/experimental/streaming/exporter/observer" | ||
) | ||
|
||
type eventsMap map[observer.EventType][]observer.Event | ||
|
||
type TestObserver struct { | ||
events eventsMap | ||
} | ||
|
||
var _ observer.Observer = &TestObserver{} | ||
|
||
func NewRegisteredObserver() *TestObserver { | ||
o := &TestObserver{} | ||
observer.RegisterObserver(o) | ||
return o | ||
} | ||
|
||
func (o *TestObserver) Unregister() { | ||
observer.UnregisterObserver(o) | ||
} | ||
|
||
func (o *TestObserver) Observe(e observer.Event) { | ||
if o.events == nil { | ||
o.events = make(eventsMap) | ||
} | ||
o.events[e.Type] = append(o.events[e.Type], e) | ||
} | ||
|
||
func (o *TestObserver) Clear() { | ||
o.events = nil | ||
} | ||
|
||
func (o *TestObserver) ClearAndUnregister() { | ||
o.Clear() | ||
o.Unregister() | ||
} | ||
|
||
func (o *TestObserver) Events(eType observer.EventType) []observer.Event { | ||
if o.events == nil { | ||
return nil | ||
} | ||
return o.events[eType] | ||
} |
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
Oops, something went wrong.