From 6324adaa6623a0999441e87fc84f4a6ef36d7aa9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 13 May 2021 21:43:19 +0000 Subject: [PATCH] Add tracer option argument to global Tracer function (#1902) * Add tracer opt arg to global Tracer func * Update PR number --- CHANGELOG.md | 1 + trace.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5e0078b..67a5b9a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Unembed `SpanContext` in `Link`. (#1877) - Semantic conventions are now generated from the specification YAML. (#1891) - Spans created by the global `Tracer` obtained from `go.opentelemetry.io/otel`, prior to a functioning `TracerProvider` being set, now propagate the span context from their parent if one exists. (#1901) +- The `"go.opentelemetry.io/otel".Tracer` function now accepts tracer options. (#1902) - Move the `go.opentelemetry.io/otel/unit` package to `go.opentelemetry.io/otel/metric/unit`. (#1903) ### Deprecated diff --git a/trace.go b/trace.go index 1d5ffb8ea..b1e8e56bd 100644 --- a/trace.go +++ b/trace.go @@ -22,9 +22,9 @@ import ( // Tracer creates a named tracer that implements Tracer interface. // If the name is an empty string then provider uses default name. // -// This is short for GetTracerProvider().Tracer(name) -func Tracer(name string) trace.Tracer { - return GetTracerProvider().Tracer(name) +// This is short for GetTracerProvider().Tracer(name, opts...) +func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + return GetTracerProvider().Tracer(name, opts...) } // GetTracerProvider returns the registered global trace provider.