1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-03 00:27:03 +02:00

Consolidate AddEvent and Event methods, add FinishOptions (#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 #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
This commit is contained in:
Krzesimir Nowak
2019-09-03 20:03:51 +02:00
committed by rghetia
parent 3fc6025071
commit a776e95c61
15 changed files with 297 additions and 98 deletions

View File

@ -63,7 +63,7 @@ func main() {
err := tracer.WithSpan(ctx, "operation", func(ctx context.Context) error {
trace.CurrentSpan(ctx).Event(ctx, "Nice operation!", key.New("bogons").Int(100))
trace.CurrentSpan(ctx).AddEvent(ctx, "Nice operation!", key.New("bogons").Int(100))
trace.CurrentSpan(ctx).SetAttributes(anotherKey.String("yes"))
@ -75,7 +75,7 @@ func main() {
func(ctx context.Context) error {
trace.CurrentSpan(ctx).SetAttribute(lemonsKey.String("five"))
trace.CurrentSpan(ctx).Event(ctx, "Sub span event")
trace.CurrentSpan(ctx).AddEvent(ctx, "Sub span event")
stats.Record(ctx, measureTwo.M(1.3))