2020-03-24 07:41:10 +02:00
|
|
|
// Copyright The 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.
|
|
|
|
|
2020-11-16 19:30:54 +02:00
|
|
|
package global_test
|
2019-12-24 09:03:04 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2020-11-16 19:30:54 +02:00
|
|
|
"go.opentelemetry.io/otel"
|
|
|
|
"go.opentelemetry.io/otel/internal/global"
|
2019-12-24 09:03:04 +02:00
|
|
|
)
|
|
|
|
|
2020-07-28 19:47:08 +02:00
|
|
|
func BenchmarkStartEndSpanNoSDK(b *testing.B) {
|
|
|
|
// Compare with BenchmarkStartEndSpan() in
|
2020-11-16 19:30:54 +02:00
|
|
|
// ../../sdk/trace/benchmark_test.go.
|
|
|
|
global.ResetForTest()
|
|
|
|
t := otel.Tracer("Benchmark StartEndSpan")
|
2019-12-24 09:03:04 +02:00
|
|
|
ctx := context.Background()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-07-28 19:47:08 +02:00
|
|
|
_, span := t.Start(ctx, "/foo")
|
|
|
|
span.End()
|
2020-01-02 23:20:38 +02:00
|
|
|
}
|
|
|
|
}
|