summaryrefslogtreecommitdiff
path: root/vendor/go.opentelemetry.io
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.opentelemetry.io')
-rw-r--r--vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/LICENSE201
-rw-r--r--vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go142
-rw-r--r--vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/option.go90
-rw-r--r--vendor/go.opentelemetry.io/otel/.gitignore2
-rw-r--r--vendor/go.opentelemetry.io/otel/.golangci.yml2
-rw-r--r--vendor/go.opentelemetry.io/otel/CHANGELOG.md161
-rw-r--r--vendor/go.opentelemetry.io/otel/CODEOWNERS2
-rw-r--r--vendor/go.opentelemetry.io/otel/CONTRIBUTING.md97
-rw-r--r--vendor/go.opentelemetry.io/otel/Makefile2
-rw-r--r--vendor/go.opentelemetry.io/otel/README.md7
-rw-r--r--vendor/go.opentelemetry.io/otel/attribute/set.go20
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md2
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/header.go (renamed from vendor/go.opentelemetry.io/otel/exporters/otlp/internal/header.go)11
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go3
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go5
-rw-r--r--vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go (renamed from vendor/go.opentelemetry.io/otel/metric/unit/doc.go)12
-rw-r--r--vendor/go.opentelemetry.io/otel/handler.go64
-rw-r--r--vendor/go.opentelemetry.io/otel/internal/global/handler.go103
-rw-r--r--vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go19
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go258
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/asyncint64.go256
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/config.go25
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/doc.go124
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go234
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/global/global.go42
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/global/metric.go49
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument.go332
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go131
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go131
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/deprecation.go452
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go90
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go86
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go86
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go167
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go42
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/meter.go81
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/noop.go198
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/syncfloat64.go162
-rw-r--r--vendor/go.opentelemetry.io/otel/metric/syncint64.go162
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go10
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/internal/internal.go11
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/auto.go58
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go4
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/config.go5
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go120
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go (renamed from vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/doc.go)16
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go19
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go29
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go (renamed from vendor/go.opentelemetry.io/otel/metric/unit/unit.go)15
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go28
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go36
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go48
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/resource/resource.go14
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/provider.go99
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go9
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/span.go4
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go4
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/version.go (renamed from vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/version.go)12
-rw-r--r--vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go18
-rw-r--r--vendor/go.opentelemetry.io/otel/trace/noop.go4
-rw-r--r--vendor/go.opentelemetry.io/otel/version.go2
-rw-r--r--vendor/go.opentelemetry.io/otel/versions.yaml10
69 files changed, 3058 insertions, 1584 deletions
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/LICENSE b/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go b/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go
deleted file mode 100644
index 6e445967b..000000000
--- a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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.
-
-// Based on https://github.com/DataDog/dd-trace-go/blob/8fb554ff7cf694267f9077ae35e27ce4689ed8b6/contrib/gin-gonic/gin/gintrace.go
-
-package otelgin // import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
-
-import (
- "fmt"
-
- "github.com/gin-gonic/gin"
-
- "go.opentelemetry.io/otel"
- "go.opentelemetry.io/otel/codes"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/propagation"
- semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
- "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv"
- oteltrace "go.opentelemetry.io/otel/trace"
-)
-
-const (
- tracerKey = "otel-go-contrib-tracer"
- tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
-)
-
-// Middleware returns middleware that will trace incoming requests.
-// The service parameter should describe the name of the (virtual)
-// server handling the request.
-func Middleware(service string, opts ...Option) gin.HandlerFunc {
- cfg := config{}
- for _, opt := range opts {
- opt.apply(&cfg)
- }
- if cfg.TracerProvider == nil {
- cfg.TracerProvider = otel.GetTracerProvider()
- }
- tracer := cfg.TracerProvider.Tracer(
- tracerName,
- oteltrace.WithInstrumentationVersion(SemVersion()),
- )
- if cfg.Propagators == nil {
- cfg.Propagators = otel.GetTextMapPropagator()
- }
- return func(c *gin.Context) {
- for _, f := range cfg.Filters {
- if !f(c.Request) {
- // Serve the request to the next middleware
- // if a filter rejects the request.
- c.Next()
- return
- }
- }
- c.Set(tracerKey, tracer)
- savedCtx := c.Request.Context()
- defer func() {
- c.Request = c.Request.WithContext(savedCtx)
- }()
- ctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(c.Request.Header))
- opts := []oteltrace.SpanStartOption{
- oteltrace.WithAttributes(httpconv.ServerRequest(service, c.Request)...),
- oteltrace.WithSpanKind(oteltrace.SpanKindServer),
- }
- var spanName string
- if cfg.SpanNameFormatter == nil {
- spanName = c.FullPath()
- } else {
- spanName = cfg.SpanNameFormatter(c.Request)
- }
- if spanName == "" {
- spanName = fmt.Sprintf("HTTP %s route not found", c.Request.Method)
- } else {
- rAttr := semconv.HTTPRoute(spanName)
- opts = append(opts, oteltrace.WithAttributes(rAttr))
- }
- ctx, span := tracer.Start(ctx, spanName, opts...)
- defer span.End()
-
- // pass the span through the request context
- c.Request = c.Request.WithContext(ctx)
-
- // serve the request to the next middleware
- c.Next()
-
- status := c.Writer.Status()
- span.SetStatus(httpconv.ServerStatus(status))
- if status > 0 {
- span.SetAttributes(semconv.HTTPStatusCode(status))
- }
- if len(c.Errors) > 0 {
- span.SetAttributes(attribute.String("gin.errors", c.Errors.String()))
- }
- }
-}
-
-// HTML will trace the rendering of the template as a child of the
-// span in the given context. This is a replacement for
-// gin.Context.HTML function - it invokes the original function after
-// setting up the span.
-func HTML(c *gin.Context, code int, name string, obj interface{}) {
- var tracer oteltrace.Tracer
- tracerInterface, ok := c.Get(tracerKey)
- if ok {
- tracer, ok = tracerInterface.(oteltrace.Tracer)
- }
- if !ok {
- tracer = otel.GetTracerProvider().Tracer(
- tracerName,
- oteltrace.WithInstrumentationVersion(SemVersion()),
- )
- }
- savedContext := c.Request.Context()
- defer func() {
- c.Request = c.Request.WithContext(savedContext)
- }()
- opt := oteltrace.WithAttributes(attribute.String("go.template", name))
- _, span := tracer.Start(savedContext, "gin.renderer.html", opt)
- defer func() {
- if r := recover(); r != nil {
- err := fmt.Errorf("error rendering template:%s: %s", name, r)
- span.RecordError(err)
- span.SetStatus(codes.Error, "template failure")
- span.End()
- panic(r)
- } else {
- span.End()
- }
- }()
- c.HTML(code, name, obj)
-}
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/option.go b/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/option.go
deleted file mode 100644
index c13c3dad8..000000000
--- a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/option.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.
-
-// Based on https://github.com/DataDog/dd-trace-go/blob/8fb554ff7cf694267f9077ae35e27ce4689ed8b6/contrib/gin-gonic/gin/option.go
-
-package otelgin // import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
-
-import (
- "net/http"
-
- "go.opentelemetry.io/otel/propagation"
- oteltrace "go.opentelemetry.io/otel/trace"
-)
-
-type config struct {
- TracerProvider oteltrace.TracerProvider
- Propagators propagation.TextMapPropagator
- Filters []Filter
- SpanNameFormatter SpanNameFormatter
-}
-
-// Filter is a predicate used to determine whether a given http.request should
-// be traced. A Filter must return true if the request should be traced.
-type Filter func(*http.Request) bool
-
-// SpanNameFormatter is used to set span name by http.request.
-type SpanNameFormatter func(r *http.Request) string
-
-// Option specifies instrumentation configuration options.
-type Option interface {
- apply(*config)
-}
-
-type optionFunc func(*config)
-
-func (o optionFunc) apply(c *config) {
- o(c)
-}
-
-// WithPropagators specifies propagators to use for extracting
-// information from the HTTP requests. If none are specified, global
-// ones will be used.
-func WithPropagators(propagators propagation.TextMapPropagator) Option {
- return optionFunc(func(cfg *config) {
- if propagators != nil {
- cfg.Propagators = propagators
- }
- })
-}
-
-// WithTracerProvider specifies a tracer provider to use for creating a tracer.
-// If none is specified, the global provider is used.
-func WithTracerProvider(provider oteltrace.TracerProvider) Option {
- return optionFunc(func(cfg *config) {
- if provider != nil {
- cfg.TracerProvider = provider
- }
- })
-}
-
-// WithFilter adds a filter to the list of filters used by the handler.
-// If any filter indicates to exclude a request then the request will not be
-// traced. All filters must allow a request to be traced for a Span to be created.
-// If no filters are provided then all requests are traced.
-// Filters will be invoked for each processed request, it is advised to make them
-// simple and fast.
-func WithFilter(f ...Filter) Option {
- return optionFunc(func(c *config) {
- c.Filters = append(c.Filters, f...)
- })
-}
-
-// WithSpanNameFormatter takes a function that will be called on every
-// request and the returned string will become the Span Name.
-func WithSpanNameFormatter(f func(r *http.Request) string) Option {
- return optionFunc(func(c *config) {
- c.SpanNameFormatter = f
- })
-}
diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore
index 0b605b3d6..cf29d10a7 100644
--- a/vendor/go.opentelemetry.io/otel/.gitignore
+++ b/vendor/go.opentelemetry.io/otel/.gitignore
@@ -7,6 +7,8 @@ Thumbs.db
*.iml
*.so
coverage.*
+go.work
+go.work.sum
gen/
diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml
index 0f099f575..e28904f6a 100644
--- a/vendor/go.opentelemetry.io/otel/.golangci.yml
+++ b/vendor/go.opentelemetry.io/otel/.golangci.yml
@@ -85,6 +85,8 @@ linters-settings:
- "**/internal/matchers/*.go"
godot:
exclude:
+ # Exclude links.
+ - '^ *\[[^]]+\]:'
# Exclude sentence fragments for lists.
- '^[ ]*[-•]'
# Exclude sentences prefixing a list.
diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md
index 1d9726f60..7630a4f33 100644
--- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md
+++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md
@@ -8,6 +8,147 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [Unreleased]
+## [1.15.1/0.38.1] 2023-05-02
+
+### Fixed
+
+- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041)
+
+## [1.15.0/0.38.0] 2023-04-27
+
+### Added
+
+- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916)
+- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949)
+- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970)
+- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971)
+ - The `AddConfig` used to hold configuration for addition measurements
+ - `NewAddConfig` used to create a new `AddConfig`
+ - `AddOption` used to configure an `AddConfig`
+ - The `RecordConfig` used to hold configuration for recorded measurements
+ - `NewRecordConfig` used to create a new `RecordConfig`
+ - `RecordOption` used to configure a `RecordConfig`
+ - The `ObserveConfig` used to hold configuration for observed measurements
+ - `NewObserveConfig` used to create a new `ObserveConfig`
+ - `ObserveOption` used to configure an `ObserveConfig`
+- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`.
+ They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971)
+- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956)
+- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956)
+
+### Changed
+
+- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870)
+- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`.
+ This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916)
+- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941)
+ - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider`
+- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966)
+- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974)
+- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971)
+ - The `Int64Counter.Add` method now accepts `...AddOption`
+ - The `Float64Counter.Add` method now accepts `...AddOption`
+ - The `Int64UpDownCounter.Add` method now accepts `...AddOption`
+ - The `Float64UpDownCounter.Add` method now accepts `...AddOption`
+ - The `Int64Histogram.Record` method now accepts `...RecordOption`
+ - The `Float64Histogram.Record` method now accepts `...RecordOption`
+ - The `Int64Observer.Observe` method now accepts `...ObserveOption`
+ - The `Float64Observer.Observe` method now accepts `...ObserveOption`
+- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971)
+ - The `Observer.ObserveInt64` method now accepts `...ObserveOption`
+ - The `Observer.ObserveFloat64` method now accepts `...ObserveOption`
+- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986)
+
+### Fixed
+
+- `TracerProvider` allows calling `Tracer()` while it's shutting down.
+ It used to deadlock. (#3924)
+- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949)
+- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951)
+- Automatically figure out the default aggregation with `aggregation.Default`. (#3967)
+
+### Deprecated
+
+- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated.
+ Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018)
+
+## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23
+
+This is a release candidate for the v1.15.0/v0.38.0 release.
+That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API.
+See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
+
+### Added
+
+- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812)
+- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828)
+- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`.
+ Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849)
+- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895)
+- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900)
+- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854)
+
+### Changed
+
+- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832)
+- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832)
+- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833)
+- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844)
+- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849)
+- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853)
+- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892)
+- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895)
+- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895)
+- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900)
+
+### Fixed
+
+- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845)
+
+### Removed
+
+- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829)
+- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892)
+- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`.
+ Use the added `float64` instrument configuration instead. (#3895)
+- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`.
+ Use the added `int64` instrument configuration instead. (#3895)
+- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893)
+
+## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01
+
+This is a release candidate for the v1.15.0/v0.38.0 release.
+That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API.
+See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
+
+This release drops the compatibility guarantee of [Go 1.18].
+
+### Added
+
+- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818)
+ - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`.
+ - Use `GetMeterProivder` for a global `metric.MeterProvider`.
+ - Use `SetMeterProivder` to set the global `metric.MeterProvider`.
+
+### Changed
+
+- Dropped compatibility testing for [Go 1.18].
+ The project no longer guarantees support for this version of Go. (#3813)
+
+### Fixed
+
+- Handle empty environment variable as it they were not set. (#3764)
+- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823)
+
+### Deprecated
+
+- The `go.opentelemetry.io/otel/metric/global` package is deprecated.
+ Use `go.opentelemetry.io/otel` instead. (#3818)
+
+### Removed
+
+- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814)
+
## [1.14.0/0.37.0/0.0.4] 2023-02-27
This release is the last to support [Go 1.18].
@@ -121,7 +262,7 @@ The next release will require at least [Go 1.19].
- The `go.opentelemetry.io/otel/semconv/v1.16.0` package.
The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579)
- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`.
- These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586)
+ These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586)
- `Float64ObservableCounter` replaces the `asyncfloat64.Counter`
- `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter`
- `Float64ObservableGauge` replaces the `asyncfloat64.Gauge`
@@ -144,7 +285,7 @@ The next release will require at least [Go 1.19].
### Changed
- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500)
-- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and confguration based on the instrument type. (#3507)
+- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507)
- Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`.
- Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`.
- Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`.
@@ -157,7 +298,7 @@ The next release will require at least [Go 1.19].
- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551)
- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions.
This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557)
-- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in erros identifying their signal name.
+- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name.
Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516)
- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514)
- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562)
@@ -266,7 +407,7 @@ The next release will require at least [Go 1.19].
- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398)
- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340)
- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436)
-- Reenabled Attribute Filters in the Metric SDK. (#3396)
+- Re-enabled Attribute Filters in the Metric SDK. (#3396)
- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408)
- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432)
- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440)
@@ -847,7 +988,7 @@ This release includes an API and SDK for the tracing signal that will comply wit
- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140)
- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169)
- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120)
-- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly ommit timestamps. (#2195)
+- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195)
- Fixed typos in resources.go. (#2201)
## [1.0.0-RC2] - 2021-07-26
@@ -1293,7 +1434,7 @@ with major version 0.
- `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369)
- Added documentation about the project's versioning policy. (#1388)
- Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418)
-- Added codeql worfklow to GitHub Actions (#1428)
+- Added codeql workflow to GitHub Actions (#1428)
- Added Gosec workflow to GitHub Actions (#1429)
- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420)
- Add an OpenCensus exporter bridge. (#1444)
@@ -2136,7 +2277,7 @@ There is still a possibility of breaking changes.
### Fixed
-- Use stateful batcher on Prometheus exporter fixing regresion introduced in #395. (#428)
+- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428)
## [0.2.1] - 2020-01-08
@@ -2302,7 +2443,11 @@ It contains api and sdk for trace and meter.
- CircleCI build CI manifest files.
- CODEOWNERS file to track owners of this project.
-[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.14.0...HEAD
+[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.1...HEAD
+[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1
+[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0
+[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2
+[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1
[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0
[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0
[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0
diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS
index c4012ed6c..f6f6a313b 100644
--- a/vendor/go.opentelemetry.io/otel/CODEOWNERS
+++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS
@@ -12,6 +12,6 @@
# https://help.github.com/en/articles/about-code-owners
#
-* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu
+* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu
CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod
diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
index a6928bfdf..f521d6543 100644
--- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
+++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
@@ -6,7 +6,7 @@ OpenTelemetry
repo for information on this and other language SIGs.
See the [public meeting
-notes](https://docs.google.com/document/d/1A63zSWX0x2CyCK_LoNhmQC4rqhLpYXJzXbEPDUQ2n6w/edit#heading=h.9tngw7jdwd6b)
+notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit)
for a summary description of past meetings. To request edit access,
join the meeting or get in touch on
[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT).
@@ -94,30 +94,58 @@ request ID to the entry you added to `CHANGELOG.md`.
### How to Get PRs Merged
-A PR is considered to be **ready to merge** when:
-
-* It has received two approvals from Collaborators/Maintainers (at
- different companies). This is not enforced through technical means
- and a PR may be **ready to merge** with a single approval if the change
- and its approach have been discussed and consensus reached.
-* Feedback has been addressed.
-* Any substantive changes to your PR will require that you clear any prior
- Approval reviews, this includes changes resulting from other feedback. Unless
- the approver explicitly stated that their approval will persist across
- changes it should be assumed that the PR needs their review again. Other
- project members (e.g. approvers, maintainers) can help with this if there are
- any questions or if you forget to clear reviews.
-* It has been open for review for at least one working day. This gives
- people reasonable time to review.
-* Trivial changes (typo, cosmetic, doc, etc.) do not have to wait for
- one day and may be merged with a single Maintainer's approval.
-* `CHANGELOG.md` has been updated to reflect what has been
- added, changed, removed, or fixed.
-* `README.md` has been updated if necessary.
-* Urgent fix can take exception as long as it has been actively
- communicated.
-
-Any Maintainer can merge the PR once it is **ready to merge**.
+A PR is considered **ready to merge** when:
+
+* It has received two qualified approvals[^1].
+
+ This is not enforced through automation, but needs to be validated by the
+ maintainer merging.
+ * The qualified approvals need to be from [Approver]s/[Maintainer]s
+ affiliated with different companies. Two qualified approvals from
+ [Approver]s or [Maintainer]s affiliated with the same company counts as a
+ single qualified approval.
+ * PRs introducing changes that have already been discussed and consensus
+ reached only need one qualified approval. The discussion and resolution
+ needs to be linked to the PR.
+ * Trivial changes[^2] only need one qualified approval.
+
+* All feedback has been addressed.
+ * All PR comments and suggestions are resolved.
+ * All GitHub Pull Request reviews with a status of "Request changes" have
+ been addressed. Another review by the objecting reviewer with a different
+ status can be submitted to clear the original review, or the review can be
+ dismissed by a [Maintainer] when the issues from the original review have
+ been addressed.
+ * Any comments or reviews that cannot be resolved between the PR author and
+ reviewers can be submitted to the community [Approver]s and [Maintainer]s
+ during the weekly SIG meeting. If consensus is reached among the
+ [Approver]s and [Maintainer]s during the SIG meeting the objections to the
+ PR may be dismissed or resolved or the PR closed by a [Maintainer].
+ * Any substantive changes to the PR require existing Approval reviews be
+ cleared unless the approver explicitly states that their approval persists
+ across changes. This includes changes resulting from other feedback.
+ [Approver]s and [Maintainer]s can help in clearing reviews and they should
+ be consulted if there are any questions.
+
+* The PR branch is up to date with the base branch it is merging into.
+ * To ensure this does not block the PR, it should be configured to allow
+ maintainers to update it.
+
+* It has been open for review for at least one working day. This gives people
+ reasonable time to review.
+ * Trivial changes[^2] do not have to wait for one day and may be merged with
+ a single [Maintainer]'s approval.
+
+* All required GitHub workflows have succeeded.
+* Urgent fix can take exception as long as it has been actively communicated
+ among [Maintainer]s.
+
+Any [Maintainer] can merge the PR once the above criteria have been met.
+
+[^1]: A qualified approval is a GitHub Pull Request review with "Approve"
+ status from an OpenTelemetry Go [Approver] or [Maintainer].
+[^2]: Trivial changes include: typo corrections, cosmetic non-substantive
+ changes, documentation corrections or updates, dependency updates, etc.
## Design Choices
@@ -216,7 +244,7 @@ Meaning a `config` from one package should not be directly used by another. The
one exception is the API packages. The configs from the base API, eg.
`go.opentelemetry.io/otel/trace.TracerConfig` and
`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed
-by the SDK therefor it is expected that these are exported.
+by the SDK therefore it is expected that these are exported.
When a config is exported we want to maintain forward and backward
compatibility, to achieve this no fields should be exported but should
@@ -234,12 +262,12 @@ func newConfig(options ...Option) config {
for _, option := range options {
config = option.apply(config)
}
- // Preform any validation here.
+ // Perform any validation here.
return config
}
```
-If validation of the `config` options is also preformed this can return an
+If validation of the `config` options is also performed this can return an
error as well that is expected to be handled by the instantiation function
or propagated to the user.
@@ -438,7 +466,7 @@ their parameters appropriately named.
#### Interface Stability
All exported stable interfaces that include the following warning in their
-doumentation are allowed to be extended with additional methods.
+documentation are allowed to be extended with additional methods.
> Warning: methods may be added to this interface in minor releases.
@@ -500,27 +528,30 @@ interface that defines the specific functionality should be preferred.
## Approvers and Maintainers
-Approvers:
+### Approvers
- [Evan Torrie](https://github.com/evantorrie), Verizon Media
-- [Josh MacDonald](https://github.com/jmacd), LightStep
- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics
- [David Ashpole](https://github.com/dashpole), Google
- [Robert PajÄ…k](https://github.com/pellared), Splunk
- [Chester Cheung](https://github.com/hanyuancheung), Tencent
- [Damien Mathieu](https://github.com/dmathieu), Elastic
-Maintainers:
+### Maintainers
- [Aaron Clawson](https://github.com/MadVikingGod), LightStep
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
- [Tyler Yahn](https://github.com/MrAlias), Splunk
-Emeritus:
+### Emeritus
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
+- [Josh MacDonald](https://github.com/jmacd), LightStep
### Become an Approver or a Maintainer
See the [community membership document in OpenTelemetry community
repo](https://github.com/open-telemetry/community/blob/main/community-membership.md).
+
+[Approver]: #approvers
+[Maintainer]: #maintainers
diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile
index 0e6ffa284..91ead91b4 100644
--- a/vendor/go.opentelemetry.io/otel/Makefile
+++ b/vendor/go.opentelemetry.io/otel/Makefile
@@ -156,7 +156,7 @@ go-mod-tidy/%: DIR=$*
go-mod-tidy/%: | crosslink
@echo "$(GO) mod tidy in $(DIR)" \
&& cd $(DIR) \
- && $(GO) mod tidy -compat=1.18
+ && $(GO) mod tidy -compat=1.19
.PHONY: lint-modules
lint-modules: go-mod-tidy
diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md
index 878d87e58..e138a8a07 100644
--- a/vendor/go.opentelemetry.io/otel/README.md
+++ b/vendor/go.opentelemetry.io/otel/README.md
@@ -14,7 +14,7 @@ It provides a set of APIs to directly measure performance and behavior of your s
| Signal | Status | Project |
| ------- | ---------- | ------- |
| Traces | Stable | N/A |
-| Metrics | Alpha | N/A |
+| Metrics | Beta | N/A |
| Logs | Frozen [1] | N/A |
- [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics.
@@ -52,19 +52,14 @@ Currently, this project supports the following environments.
| ------- | ---------- | ------------ |
| Ubuntu | 1.20 | amd64 |
| Ubuntu | 1.19 | amd64 |
-| Ubuntu | 1.18 | amd64 |
| Ubuntu | 1.20 | 386 |
| Ubuntu | 1.19 | 386 |
-| Ubuntu | 1.18 | 386 |
| MacOS | 1.20 | amd64 |
| MacOS | 1.19 | amd64 |
-| MacOS | 1.18 | amd64 |
| Windows | 1.20 | amd64 |
| Windows | 1.19 | amd64 |
-| Windows | 1.18 | amd64 |
| Windows | 1.20 | 386 |
| Windows | 1.19 | 386 |
-| Windows | 1.18 | 386 |
While this project should work for other systems, no compatibility guarantees
are made for those systems currently.
diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go
index 26be59832..b976367e4 100644
--- a/vendor/go.opentelemetry.io/otel/attribute/set.go
+++ b/vendor/go.opentelemetry.io/otel/attribute/set.go
@@ -18,6 +18,7 @@ import (
"encoding/json"
"reflect"
"sort"
+ "sync"
)
type (
@@ -62,6 +63,12 @@ var (
iface: [0]KeyValue{},
},
}
+
+ // sortables is a pool of Sortables used to create Sets with a user does
+ // not provide one.
+ sortables = sync.Pool{
+ New: func() interface{} { return new(Sortable) },
+ }
)
// EmptySet returns a reference to a Set with no elements.
@@ -91,7 +98,7 @@ func (l *Set) Len() int {
// Get returns the KeyValue at ordered position idx in this set.
func (l *Set) Get(idx int) (KeyValue, bool) {
- if l == nil {
+ if l == nil || !l.equivalent.Valid() {
return KeyValue{}, false
}
value := l.equivalent.reflectValue()
@@ -107,7 +114,7 @@ func (l *Set) Get(idx int) (KeyValue, bool) {
// Value returns the value of a specified key in this set.
func (l *Set) Value(k Key) (Value, bool) {
- if l == nil {
+ if l == nil || !l.equivalent.Valid() {
return Value{}, false
}
rValue := l.equivalent.reflectValue()
@@ -191,7 +198,9 @@ func NewSet(kvs ...KeyValue) Set {
if len(kvs) == 0 {
return empty()
}
- s, _ := NewSetWithSortableFiltered(kvs, new(Sortable), nil)
+ srt := sortables.Get().(*Sortable)
+ s, _ := NewSetWithSortableFiltered(kvs, srt, nil)
+ sortables.Put(srt)
return s
}
@@ -218,7 +227,10 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
if len(kvs) == 0 {
return empty(), nil
}
- return NewSetWithSortableFiltered(kvs, new(Sortable), filter)
+ srt := sortables.Get().(*Sortable)
+ s, filtered := NewSetWithSortableFiltered(kvs, srt, filter)
+ sortables.Put(srt)
+ return s, filtered
}
// NewSetWithSortableFiltered returns a new Set.
diff --git a/vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md b/vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md
index 598c569a5..9b9d370dd 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md
+++ b/vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md
@@ -47,4 +47,4 @@ When re-generating Thrift code in the future, please adapt import paths as neces
- [Jaeger](https://www.jaegertracing.io/)
- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md)
-- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md)
+- [OpenTelemetry Environment Variable Specification](https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/#general-sdk-configuration)
diff --git a/vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go b/vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go
index a7253e483..460fb5e13 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go
@@ -37,7 +37,7 @@ const (
// envOr returns an env variable's value if it is exists or the default if not.
func envOr(key, defaultValue string) string {
- if v, ok := os.LookupEnv(key); ok && v != "" {
+ if v := os.Getenv(key); v != "" {
return v
}
return defaultValue
diff --git a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go
index 53bf862ea..630b938f0 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go
@@ -77,7 +77,7 @@ const (
// WrapTException wraps an error into TException.
//
// If err is nil or already TException, it's returned as-is.
-// Otherwise it will be wraped into TException with TExceptionType() returning
+// Otherwise it will be wrapped into TException with TExceptionType() returning
// TExceptionTypeUnknown, and Unwrap() returning the original error.
func WrapTException(err error) TException {
if err == nil {
diff --git a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go
index ba2738a8d..d68d0b317 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go
@@ -56,7 +56,7 @@ type stringWriter interface {
WriteString(s string) (n int, err error)
}
-// This is "enchanced" transport with extra capabilities. You need to use one of these
+// This is "enhanced" transport with extra capabilities. You need to use one of these
// to construct protocol.
// Notably, TSocket does not implement this interface, and it is always a mistake to use
// TSocket directly in protocol.
diff --git a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go
index 4292ffcad..b24f1b05c 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go
@@ -40,7 +40,7 @@ const (
LIST = 15
UTF8 = 16
UTF16 = 17
- //BINARY = 18 wrong and unusued
+ //BINARY = 18 wrong and unused
)
var typeNames = map[int]string{
diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/header.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/header.go
index 9aa62ed9e..7fcd89a40 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/otlp/internal/header.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/header.go
@@ -12,13 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package internal contains common functionality for all OTLP exporters.
-package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal"
+package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal"
-import "go.opentelemetry.io/otel"
+import (
+ "go.opentelemetry.io/otel/exporters/otlp/otlptrace"
+)
-// GetUserAgentHeader return an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}"
+// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}"
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent
func GetUserAgentHeader() string {
- return "OTel OTLP Exporter Go/" + otel.Version()
+ return "OTel OTLP Exporter Go/" + otlptrace.Version()
}
diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go
index c48ffd530..1a6bb423b 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go
@@ -27,6 +27,7 @@ import (
"go.opentelemetry.io/otel/exporters/otlp/internal"
"go.opentelemetry.io/otel/exporters/otlp/internal/retry"
+ otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal"
)
const (
@@ -97,7 +98,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
Timeout: DefaultTimeout,
},
RetryConfig: retry.DefaultConfig,
- DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())},
+ DialOptions: []grpc.DialOption{grpc.WithUserAgent(otinternal.GetUserAgentHeader())},
}
cfg = ApplyGRPCEnvConfigs(cfg)
for _, opt := range opts {
diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
index fe23f8e37..2ab2a6e14 100644
--- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
@@ -130,13 +130,16 @@ var errAlreadyStopped = errors.New("the client is already stopped")
// If the client has already stopped, an error will be returned describing
// this.
func (c *client) Stop(ctx context.Context) error {
+ // Make sure to return context error if the context is done when calling this method.
+ err := ctx.Err()
+
// Acquire the c.tscMu lock within the ctx lifetime.
acquired := make(chan struct{})
go func() {
c.tscMu.Lock()
close(acquired)
}()
- var err error
+
select {
case <-ctx.Done():
// The Stop timeout is reached. Kill any remaining exports to force
diff --git a/vendor/go.opentelemetry.io/otel/metric/unit/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go
index f8e723593..851e8d1b0 100644
--- a/vendor/go.opentelemetry.io/otel/metric/unit/doc.go
+++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package unit provides units.
-//
-// This package is currently in a pre-GA phase. Backwards incompatible changes
-// may be introduced in subsequent minor version releases as we work to track
-// the evolving OpenTelemetry specification and user feedback.
-package unit // import "go.opentelemetry.io/otel/metric/unit"
+package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace"
+
+// Version is the current release version of the OpenTelemetry OTLP trace exporter in use.
+func Version() string {
+ return "1.15.1"
+}
diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go
index ecd363ab5..4115fe3bb 100644
--- a/vendor/go.opentelemetry.io/otel/handler.go
+++ b/vendor/go.opentelemetry.io/otel/handler.go
@@ -15,58 +15,16 @@
package otel // import "go.opentelemetry.io/otel"
import (
- "log"
- "os"
- "sync/atomic"
- "unsafe"
+ "go.opentelemetry.io/otel/internal/global"
)
var (
- // globalErrorHandler provides an ErrorHandler that can be used
- // throughout an OpenTelemetry instrumented project. When a user
- // specified ErrorHandler is registered (`SetErrorHandler`) all calls to
- // `Handle` and will be delegated to the registered ErrorHandler.
- globalErrorHandler = defaultErrorHandler()
-
- // Compile-time check that delegator implements ErrorHandler.
- _ ErrorHandler = (*delegator)(nil)
- // Compile-time check that errLogger implements ErrorHandler.
- _ ErrorHandler = (*errLogger)(nil)
+ // Compile-time check global.ErrDelegator implements ErrorHandler.
+ _ ErrorHandler = (*global.ErrDelegator)(nil)
+ // Compile-time check global.ErrLogger implements ErrorHandler.
+ _ ErrorHandler = (*global.ErrLogger)(nil)
)
-type delegator struct {
- delegate unsafe.Pointer
-}
-
-func (d *delegator) Handle(err error) {
- d.getDelegate().Handle(err)
-}
-
-func (d *delegator) getDelegate() ErrorHandler {
- return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate))
-}
-
-// setDelegate sets the ErrorHandler delegate.
-func (d *delegator) setDelegate(eh ErrorHandler) {
- atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh))
-}
-
-func defaultErrorHandler() *delegator {
- d := &delegator{}
- d.setDelegate(&errLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
- return d
-}
-
-// errLogger logs errors if no delegate is set, otherwise they are delegated.
-type errLogger struct {
- l *log.Logger
-}
-
-// Handle logs err if no delegate is set, otherwise it is delegated.
-func (h *errLogger) Handle(err error) {
- h.l.Print(err)
-}
-
// GetErrorHandler returns the global ErrorHandler instance.
//
// The default ErrorHandler instance returned will log all errors to STDERR
@@ -76,9 +34,7 @@ func (h *errLogger) Handle(err error) {
//
// Subsequent calls to SetErrorHandler after the first will not forward errors
// to the new ErrorHandler for prior returned instances.
-func GetErrorHandler() ErrorHandler {
- return globalErrorHandler
-}
+func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() }
// SetErrorHandler sets the global ErrorHandler to h.
//
@@ -86,11 +42,7 @@ func GetErrorHandler() ErrorHandler {
// GetErrorHandler will send errors to h instead of the default logging
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
// delegate errors to h.
-func SetErrorHandler(h ErrorHandler) {
- globalErrorHandler.setDelegate(h)
-}
+func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) }
// Handle is a convenience function for ErrorHandler().Handle(err).
-func Handle(err error) {
- GetErrorHandler().Handle(err)
-}
+func Handle(err error) { global.Handle(err) }
diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go
new file mode 100644
index 000000000..3dcd1caae
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go
@@ -0,0 +1,103 @@
+// 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.
+
+package global // import "go.opentelemetry.io/otel/internal/global"
+
+import (
+ "log"
+ "os"
+ "sync/atomic"
+ "unsafe"
+)
+
+var (
+ // GlobalErrorHandler provides an ErrorHandler that can be used
+ // throughout an OpenTelemetry instrumented project. When a user
+ // specified ErrorHandler is registered (`SetErrorHandler`) all calls to
+ // `Handle` and will be delegated to the registered ErrorHandler.
+ GlobalErrorHandler = defaultErrorHandler()
+
+ // Compile-time check that delegator implements ErrorHandler.
+ _ ErrorHandler = (*ErrDelegator)(nil)
+ // Compile-time check that errLogger implements ErrorHandler.
+ _ ErrorHandler = (*ErrLogger)(nil)
+)
+
+// ErrorHandler handles irremediable events.
+type ErrorHandler interface {
+ // Handle handles any error deemed irremediable by an OpenTelemetry
+ // component.
+ Handle(error)
+}
+
+type ErrDelegator struct {
+ delegate unsafe.Pointer
+}
+
+func (d *ErrDelegator) Handle(err error) {
+ d.getDelegate().Handle(err)
+}
+
+func (d *ErrDelegator) getDelegate() ErrorHandler {
+ return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate))
+}
+
+// setDelegate sets the ErrorHandler delegate.
+func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
+ atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh))
+}
+
+func defaultErrorHandler() *ErrDelegator {
+ d := &ErrDelegator{}
+ d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
+ return d
+}
+
+// ErrLogger logs errors if no delegate is set, otherwise they are delegated.
+type ErrLogger struct {
+ l *log.Logger
+}
+
+// Handle logs err if no delegate is set, otherwise it is delegated.
+func (h *ErrLogger) Handle(err error) {
+ h.l.Print(err)
+}
+
+// GetErrorHandler returns the global ErrorHandler instance.
+//
+// The default ErrorHandler instance returned will log all errors to STDERR
+// until an override ErrorHandler is set with SetErrorHandler. All
+// ErrorHandler returned prior to this will automatically forward errors to
+// the set instance instead of logging.
+//
+// Subsequent calls to SetErrorHandler after the first will not forward errors
+// to the new ErrorHandler for prior returned instances.
+func GetErrorHandler() ErrorHandler {
+ return GlobalErrorHandler
+}
+
+// SetErrorHandler sets the global ErrorHandler to h.
+//
+// The first time this is called all ErrorHandler previously returned from
+// GetErrorHandler will send errors to h instead of the default logging
+// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
+// delegate errors to h.
+func SetErrorHandler(h ErrorHandler) {
+ GlobalErrorHandler.setDelegate(h)
+}
+
+// Handle is a convenience function for ErrorHandler().Handle(err).
+func Handle(err error) {
+ GetErrorHandler().Handle(err)
+}
diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
index 293c08961..5951fd06d 100644
--- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
+++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
@@ -24,7 +24,7 @@ import (
"github.com/go-logr/stdr"
)
-// globalLogger is the logging interface used within the otel api and sdk provide deatails of the internals.
+// globalLogger is the logging interface used within the otel api and sdk provide details of the internals.
//
// The default logger uses stdr which is backed by the standard `log.Logger`
// interface. This logger will only show messages at the Error Level.
@@ -36,8 +36,9 @@ func init() {
// SetLogger overrides the globalLogger with l.
//
-// To see Info messages use a logger with `l.V(1).Enabled() == true`
-// To see Debug messages use a logger with `l.V(5).Enabled() == true`.
+// To see Warn messages use a logger with `l.V(1).Enabled() == true`
+// To see Info messages use a logger with `l.V(4).Enabled() == true`
+// To see Debug messages use a logger with `l.V(8).Enabled() == true`.
func SetLogger(l logr.Logger) {
atomic.StorePointer(&globalLogger, unsafe.Pointer(&l))
}
@@ -47,9 +48,9 @@ func getLogger() logr.Logger {
}
// Info prints messages about the general state of the API or SDK.
-// This should usually be less then 5 messages a minute.
+// This should usually be less than 5 messages a minute.
func Info(msg string, keysAndValues ...interface{}) {
- getLogger().V(1).Info(msg, keysAndValues...)
+ getLogger().V(4).Info(msg, keysAndValues...)
}
// Error prints messages about exceptional states of the API or SDK.
@@ -59,5 +60,11 @@ func Error(err error, msg string, keysAndValues ...interface{}) {
// Debug prints messages about all internal changes in the API or SDK.
func Debug(msg string, keysAndValues ...interface{}) {
- getLogger().V(5).Info(msg, keysAndValues...)
+ getLogger().V(8).Info(msg, keysAndValues...)
+}
+
+// Warn prints messages about warnings in the API or SDK.
+// Not an error but is likely more important than an informational event.
+func Warn(msg string, keysAndValues ...interface{}) {
+ getLogger().V(1).Info(msg, keysAndValues...)
}
diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
new file mode 100644
index 000000000..e2ffb6738
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
@@ -0,0 +1,258 @@
+// 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.
+
+package metric // import "go.opentelemetry.io/otel/metric"
+
+import (
+ "context"
+
+ "go.opentelemetry.io/otel/metric/embedded"
+)
+
+// Float64Observable describes a set of instruments used asynchronously to
+// record float64 measurements once per collection cycle. Observations of
+// these instruments are only made within a callback.
+//
+// Warning: Methods may be added to this interface in minor releases.
+type Float64Observable interface {
+ Observable
+
+ float64Observable()
+}
+
+// Float64ObservableCounter is an instrument used to asynchronously record
+// increasing float64 measurements once per collection cycle. Observations are
+// only made within a callback for this instrument. The value observed is
+// assumed the to be the cumulative sum of the count.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64ObservableCounter interface {
+ embedded.Float64ObservableCounter
+
+ Float64Observable
+}
+
+// Float64ObservableCounterConfig contains options for asynchronous counter
+// instruments that record int64 values.
+type Float64ObservableCounterConfig struct {
+ description string
+ unit string
+ callbacks []Float64Callback
+}
+
+// NewFloat64ObservableCounterConfig returns a new
+// [Float64ObservableCounterConfig] with all opts applied.
+func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig {
+ var config Float64ObservableCounterConfig
+ for _, o := range opts {
+ config = o.applyFloat64ObservableCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64ObservableCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64ObservableCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback {
+ return c.callbacks
+}
+
+// Float64ObservableCounterOption applies options to a
+// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and [Option]
+// for other options that can be used as a Float64ObservableCounterOption.
+type Float64ObservableCounterOption interface {
+ applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig
+}
+
+// Float64ObservableUpDownCounter is an instrument used to asynchronously
+// record float64 measurements once per collection cycle. Observations are only
+// made within a callback for this instrument. The value observed is assumed
+// the to be the cumulative sum of the count.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64ObservableUpDownCounter interface {
+ embedded.Float64ObservableUpDownCounter
+
+ Float64Observable
+}
+
+// Float64ObservableUpDownCounterConfig contains options for asynchronous
+// counter instruments that record int64 values.
+type Float64ObservableUpDownCounterConfig struct {
+ description string
+ unit string
+ callbacks []Float64Callback
+}
+
+// NewFloat64ObservableUpDownCounterConfig returns a new
+// [Float64ObservableUpDownCounterConfig] with all opts applied.
+func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig {
+ var config Float64ObservableUpDownCounterConfig
+ for _, o := range opts {
+ config = o.applyFloat64ObservableUpDownCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64ObservableUpDownCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64ObservableUpDownCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback {
+ return c.callbacks
+}
+
+// Float64ObservableUpDownCounterOption applies options to a
+// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and
+// [Option] for other options that can be used as a
+// Float64ObservableUpDownCounterOption.
+type Float64ObservableUpDownCounterOption interface {
+ applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig
+}
+
+// Float64ObservableGauge is an instrument used to asynchronously record
+// instantaneous float64 measurements once per collection cycle. Observations
+// are only made within a callback for this instrument.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64ObservableGauge interface {
+ embedded.Float64ObservableGauge
+
+ Float64Observable
+}
+
+// Float64ObservableGaugeConfig contains options for asynchronous counter
+// instruments that record int64 values.
+type Float64ObservableGaugeConfig struct {
+ description string
+ unit string
+ callbacks []Float64Callback
+}
+
+// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig]
+// with all opts applied.
+func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig {
+ var config Float64ObservableGaugeConfig
+ for _, o := range opts {
+ config = o.applyFloat64ObservableGauge(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64ObservableGaugeConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64ObservableGaugeConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback {
+ return c.callbacks
+}
+
+// Float64ObservableGaugeOption applies options to a
+// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and
+// [Option] for other options that can be used as a
+// Float64ObservableGaugeOption.
+type Float64ObservableGaugeOption interface {
+ applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig
+}
+
+// Float64Observer is a recorder of float64 measurements.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64Observer interface {
+ embedded.Float64Observer
+
+ // Observe records the float64 value.
+ Observe(value float64, opts ...ObserveOption)
+}
+
+// Float64Callback is a function registered with a Meter that makes
+// observations for a Float64Observerable instrument it is registered with.
+// Calls to the Float64Observer record measurement values for the
+// Float64Observable.
+//
+// The function needs to complete in a finite amount of time and the deadline
+// of the passed context is expected to be honored.
+//
+// The function needs to make unique observations across all registered
+// Float64Callbacks. Meaning, it should not report measurements with the same
+// attributes as another Float64Callbacks also registered for the same
+// instrument.
+//
+// The function needs to be concurrent safe.
+type Float64Callback func(context.Context, Float64Observer) error
+
+// Float64ObservableOption applies options to float64 Observer instruments.
+type Float64ObservableOption interface {
+ Float64ObservableCounterOption
+ Float64ObservableUpDownCounterOption
+ Float64ObservableGaugeOption
+}
+
+type float64CallbackOpt struct {
+ cback Float64Callback
+}
+
+func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+// WithFloat64Callback adds callback to be called for an instrument.
+func WithFloat64Callback(callback Float64Callback) Float64ObservableOption {
+ return float64CallbackOpt{callback}
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go
new file mode 100644
index 000000000..a56b3d7a6
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go
@@ -0,0 +1,256 @@
+// 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.
+
+package metric // import "go.opentelemetry.io/otel/metric"
+
+import (
+ "context"
+
+ "go.opentelemetry.io/otel/metric/embedded"
+)
+
+// Int64Observable describes a set of instruments used asynchronously to record
+// int64 measurements once per collection cycle. Observations of these
+// instruments are only made within a callback.
+//
+// Warning: Methods may be added to this interface in minor releases.
+type Int64Observable interface {
+ Observable
+
+ int64Observable()
+}
+
+// Int64ObservableCounter is an instrument used to asynchronously record
+// increasing int64 measurements once per collection cycle. Observations are
+// only made within a callback for this instrument. The value observed is
+// assumed the to be the cumulative sum of the count.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64ObservableCounter interface {
+ embedded.Int64ObservableCounter
+
+ Int64Observable
+}
+
+// Int64ObservableCounterConfig contains options for asynchronous counter
+// instruments that record int64 values.
+type Int64ObservableCounterConfig struct {
+ description string
+ unit string
+ callbacks []Int64Callback
+}
+
+// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig]
+// with all opts applied.
+func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig {
+ var config Int64ObservableCounterConfig
+ for _, o := range opts {
+ config = o.applyInt64ObservableCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64ObservableCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64ObservableCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback {
+ return c.callbacks
+}
+
+// Int64ObservableCounterOption applies options to a
+// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and [Option] for
+// other options that can be used as an Int64ObservableCounterOption.
+type Int64ObservableCounterOption interface {
+ applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig
+}
+
+// Int64ObservableUpDownCounter is an instrument used to asynchronously record
+// int64 measurements once per collection cycle. Observations are only made
+// within a callback for this instrument. The value observed is assumed the to
+// be the cumulative sum of the count.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64ObservableUpDownCounter interface {
+ embedded.Int64ObservableUpDownCounter
+
+ Int64Observable
+}
+
+// Int64ObservableUpDownCounterConfig contains options for asynchronous counter
+// instruments that record int64 values.
+type Int64ObservableUpDownCounterConfig struct {
+ description string
+ unit string
+ callbacks []Int64Callback
+}
+
+// NewInt64ObservableUpDownCounterConfig returns a new
+// [Int64ObservableUpDownCounterConfig] with all opts applied.
+func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig {
+ var config Int64ObservableUpDownCounterConfig
+ for _, o := range opts {
+ config = o.applyInt64ObservableUpDownCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64ObservableUpDownCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64ObservableUpDownCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback {
+ return c.callbacks
+}
+
+// Int64ObservableUpDownCounterOption applies options to a
+// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and
+// [Option] for other options that can be used as an
+// Int64ObservableUpDownCounterOption.
+type Int64ObservableUpDownCounterOption interface {
+ applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig
+}
+
+// Int64ObservableGauge is an instrument used to asynchronously record
+// instantaneous int64 measurements once per collection cycle. Observations are
+// only made within a callback for this instrument.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64ObservableGauge interface {
+ embedded.Int64ObservableGauge
+
+ Int64Observable
+}
+
+// Int64ObservableGaugeConfig contains options for asynchronous counter
+// instruments that record int64 values.
+type Int64ObservableGaugeConfig struct {
+ description string
+ unit string
+ callbacks []Int64Callback
+}
+
+// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig]
+// with all opts applied.
+func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig {
+ var config Int64ObservableGaugeConfig
+ for _, o := range opts {
+ config = o.applyInt64ObservableGauge(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64ObservableGaugeConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64ObservableGaugeConfig) Unit() string {
+ return c.unit
+}
+
+// Callbacks returns the configured callbacks.
+func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback {
+ return c.callbacks
+}
+
+// Int64ObservableGaugeOption applies options to a
+// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and [Option] for
+// other options that can be used as an Int64ObservableGaugeOption.
+type Int64ObservableGaugeOption interface {
+ applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig
+}
+
+// Int64Observer is a recorder of int64 measurements.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64Observer interface {
+ embedded.Int64Observer
+
+ // Observe records the int64 value.
+ Observe(value int64, opts ...ObserveOption)
+}
+
+// Int64Callback is a function registered with a Meter that makes observations
+// for an Int64Observerable instrument it is registered with. Calls to the
+// Int64Observer record measurement values for the Int64Observable.
+//
+// The function needs to complete in a finite amount of time and the deadline
+// of the passed context is expected to be honored.
+//
+// The function needs to make unique observations across all registered
+// Int64Callbacks. Meaning, it should not report measurements with the same
+// attributes as another Int64Callbacks also registered for the same
+// instrument.
+//
+// The function needs to be concurrent safe.
+type Int64Callback func(context.Context, Int64Observer) error
+
+// Int64ObservableOption applies options to int64 Observer instruments.
+type Int64ObservableOption interface {
+ Int64ObservableCounterOption
+ Int64ObservableUpDownCounterOption
+ Int64ObservableGaugeOption
+}
+
+type int64CallbackOpt struct {
+ cback Int64Callback
+}
+
+func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
+ cfg.callbacks = append(cfg.callbacks, o.cback)
+ return cfg
+}
+
+// WithInt64Callback adds callback to be called for an instrument.
+func WithInt64Callback(callback Int64Callback) Int64ObservableOption {
+ return int64CallbackOpt{callback}
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go
index 621e4c5fc..778ad2d74 100644
--- a/vendor/go.opentelemetry.io/otel/metric/config.go
+++ b/vendor/go.opentelemetry.io/otel/metric/config.go
@@ -14,17 +14,30 @@
package metric // import "go.opentelemetry.io/otel/metric"
+import "go.opentelemetry.io/otel/attribute"
+
// MeterConfig contains options for Meters.
type MeterConfig struct {
instrumentationVersion string
schemaURL string
+ attrs attribute.Set
+
+ // Ensure forward compatibility by explicitly making this not comparable.
+ noCmp [0]func() //nolint: unused // This is indeed used.
}
-// InstrumentationVersion is the version of the library providing instrumentation.
+// InstrumentationVersion returns the version of the library providing
+// instrumentation.
func (cfg MeterConfig) InstrumentationVersion() string {
return cfg.instrumentationVersion
}
+// InstrumentationAttributes returns the attributes associated with the library
+// providing instrumentation.
+func (cfg MeterConfig) InstrumentationAttributes() attribute.Set {
+ return cfg.attrs
+}
+
// SchemaURL is the schema_url of the library providing instrumentation.
func (cfg MeterConfig) SchemaURL() string {
return cfg.schemaURL
@@ -60,6 +73,16 @@ func WithInstrumentationVersion(version string) MeterOption {
})
}
+// WithInstrumentationAttributes sets the instrumentation attributes.
+//
+// The passed attributes will be de-duplicated.
+func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption {
+ return meterOptionFunc(func(config MeterConfig) MeterConfig {
+ config.attrs = attribute.NewSet(attr...)
+ return config
+ })
+}
+
// WithSchemaURL sets the schema URL.
func WithSchemaURL(schemaURL string) MeterOption {
return meterOptionFunc(func(config MeterConfig) MeterConfig {
diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go
index bd6f43437..bda14e10a 100644
--- a/vendor/go.opentelemetry.io/otel/metric/doc.go
+++ b/vendor/go.opentelemetry.io/otel/metric/doc.go
@@ -13,11 +13,125 @@
// limitations under the License.
/*
-Package metric provides an implementation of the metrics part of the
-OpenTelemetry API.
+Package metric provides the OpenTelemetry API used to measure metrics about
+source code operation.
-This package is currently in a pre-GA phase. Backwards incompatible changes
-may be introduced in subsequent minor version releases as we work to track the
-evolving OpenTelemetry specification and user feedback.
+This API is separate from its implementation so the instrumentation built from
+it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official
+OpenTelemetry implementation of this API.
+
+All measurements made with this package are made via instruments. These
+instruments are created by a [Meter] which itself is created by a
+[MeterProvider]. Applications need to accept a [MeterProvider] implementation
+as a starting point when instrumenting. This can be done directly, or by using
+the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an
+appropriately named [Meter] from the accepted [MeterProvider], instrumentation
+can then be built from the [Meter]'s instruments.
+
+# Instruments
+
+Each instrument is designed to make measurements of a particular type. Broadly,
+all instruments fall into two overlapping logical categories: asynchronous or
+synchronous, and int64 or float64.
+
+All synchronous instruments ([Int64Counter], [Int64UpDownCounter],
+[Int64Histogram], [Float64Counter], [Float64UpDownCounter], [Float64Histogram])
+are used to measure the operation and performance of source code during the
+source code execution. These instruments only make measurements when the source
+code they instrument is run.
+
+All asynchronous instruments ([Int64ObservableCounter],
+[Int64ObservableUpDownCounter], [Int64ObservableGauge],
+[Float64ObservableCounter], [Float64ObservableUpDownCounter],
+[Float64ObservableGauge]) are used to measure metrics outside of the execution
+of source code. They are said to make "observations" via a callback function
+called once every measurement collection cycle.
+
+Each instrument is also grouped by the value type it measures. Either int64 or
+float64. The value being measured will dictate which instrument in these
+categories to use.
+
+Outside of these two broad categories, instruments are described by the
+function they are designed to serve. All Counters ([Int64Counter],
+[Float64Counter], [Int64ObservableCounter], [Float64ObservableCounter]) are
+designed to measure values that never decrease in value, but instead only
+incrementally increase in value. UpDownCounters ([Int64UpDownCounter],
+[Float64UpDownCounter], [Int64ObservableUpDownCounter],
+[Float64ObservableUpDownCounter]) on the other hand, are designed to measure
+values that can increase and decrease. When more information
+needs to be conveyed about all the synchronous measurements made during a
+collection cycle, a Histogram ([Int64Histogram], [Float64Histogram]) should be
+used. Finally, when just the most recent measurement needs to be conveyed about an
+asynchronous measurement, a Gauge ([Int64ObservableGauge],
+[Float64ObservableGauge]) should be used.
+
+See the [OpenTelemetry documentation] for more information about instruments
+and their intended use.
+
+# API Implementations
+
+This package does not conform to the standard Go versioning policy, all of its
+interfaces may have methods added to them without a package major version bump.
+This non-standard API evolution could surprise an uninformed implementation
+author. They could unknowingly build their implementation in a way that would
+result in a runtime panic for their users that update to the new API.
+
+The API is designed to help inform an instrumentation author about this
+non-standard API evolution. It requires them to choose a default behavior for
+unimplemented interface methods. There are three behavior choices they can
+make:
+
+ - Compilation failure
+ - Panic
+ - Default to another implementation
+
+All interfaces in this API embed a corresponding interface from
+[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default
+behavior of their implementations to be a compilation failure, signaling to
+their users they need to update to the latest version of that implementation,
+they need to embed the corresponding interface from
+[go.opentelemetry.io/otel/metric/embedded] in their implementation. For
+example,
+
+ import "go.opentelemetry.io/otel/metric/embedded"
+
+ type MeterProvider struct {
+ embedded.MeterProvider
+ // ...
+ }
+
+If an author wants the default behavior of their implementations to a panic,
+they need to embed the API interface directly.
+
+ import "go.opentelemetry.io/otel/metric"
+
+ type MeterProvider struct {
+ metric.MeterProvider
+ // ...
+ }
+
+This is not a recommended behavior as it could lead to publishing packages that
+contain runtime panics when users update other package that use newer versions
+of [go.opentelemetry.io/otel/metric].
+
+Finally, an author can embed another implementation in theirs. The embedded
+implementation will be used for methods not defined by the author. For example,
+an author who want to default to silently dropping the call can use
+[go.opentelemetry.io/otel/metric/noop]:
+
+ import "go.opentelemetry.io/otel/metric/noop"
+
+ type MeterProvider struct {
+ noop.MeterProvider
+ // ...
+ }
+
+It is strongly recommended that authors only embed
+[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior.
+That implementation is the only one OpenTelemetry authors can guarantee will
+fully implement all the API interfaces when a user updates their API.
+
+[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/
+[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider
*/
package metric // import "go.opentelemetry.io/otel/metric"
diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
new file mode 100644
index 000000000..ae0bdbd2e
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
@@ -0,0 +1,234 @@
+// 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.
+
+// Package embedded provides interfaces embedded within the [OpenTelemetry
+// metric API].
+//
+// Implementers of the [OpenTelemetry metric API] can embed the relevant type
+// from this package into their implementation directly. Doing so will result
+// in a compilation error for users when the [OpenTelemetry metric API] is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+//
+// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric
+package embedded // import "go.opentelemetry.io/otel/metric/embedded"
+
+// MeterProvider is embedded in
+// [go.opentelemetry.io/otel/metric.MeterProvider].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to
+// experience a compilation error, signaling they need to update to your latest
+// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type MeterProvider interface{ meterProvider() }
+
+// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a
+// compilation error, signaling they need to update to your latest
+// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface
+// is extended (which is something that can happen without a major version bump
+// of the API package).
+type Meter interface{ meter() }
+
+// Float64Observer is embedded in
+// [go.opentelemetry.io/otel/metric.Float64Observer].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64Observer] if you want
+// users to experience a compilation error, signaling they need to update to
+// your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64Observer] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Float64Observer interface{ float64Observer() }
+
+// Int64Observer is embedded in
+// [go.opentelemetry.io/otel/metric.Int64Observer].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users
+// to experience a compilation error, signaling they need to update to your
+// latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64Observer] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Int64Observer interface{ int64Observer() }
+
+// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a
+// compilation error, signaling they need to update to your latest
+// implementation, when the [go.opentelemetry.io/otel/metric.Observer]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Observer interface{ observer() }
+
+// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Registration] if you want users to
+// experience a compilation error, signaling they need to update to your latest
+// implementation, when the [go.opentelemetry.io/otel/metric.Registration]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Registration interface{ registration() }
+
+// Float64Counter is embedded in
+// [go.opentelemetry.io/otel/metric.Float64Counter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64Counter] if you want
+// users to experience a compilation error, signaling they need to update to
+// your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64Counter] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Float64Counter interface{ float64Counter() }
+
+// Float64Histogram is embedded in
+// [go.opentelemetry.io/otel/metric.Float64Histogram].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want
+// users to experience a compilation error, signaling they need to update to
+// your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Float64Histogram interface{ float64Histogram() }
+
+// Float64ObservableCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Float64ObservableCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you
+// want users to experience a compilation error, signaling they need to update
+// to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Float64ObservableCounter interface{ float64ObservableCounter() }
+
+// Float64ObservableGauge is embedded in
+// [go.opentelemetry.io/otel/metric.Float64ObservableGauge].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you
+// want users to experience a compilation error, signaling they need to update
+// to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Float64ObservableGauge interface{ float64ObservableGauge() }
+
+// Float64ObservableUpDownCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]
+// if you want users to experience a compilation error, signaling they need to
+// update to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() }
+
+// Float64UpDownCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Float64UpDownCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you
+// want users to experience a compilation error, signaling they need to update
+// to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface
+// is extended (which is something that can happen without a major version bump
+// of the API package).
+type Float64UpDownCounter interface{ float64UpDownCounter() }
+
+// Int64Counter is embedded in
+// [go.opentelemetry.io/otel/metric.Int64Counter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users
+// to experience a compilation error, signaling they need to update to your
+// latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64Counter] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Int64Counter interface{ int64Counter() }
+
+// Int64Histogram is embedded in
+// [go.opentelemetry.io/otel/metric.Int64Histogram].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want
+// users to experience a compilation error, signaling they need to update to
+// your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Int64Histogram interface{ int64Histogram() }
+
+// Int64ObservableCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Int64ObservableCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you
+// want users to experience a compilation error, signaling they need to update
+// to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Int64ObservableCounter interface{ int64ObservableCounter() }
+
+// Int64ObservableGauge is embedded in
+// [go.opentelemetry.io/otel/metric.Int64ObservableGauge].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you
+// want users to experience a compilation error, signaling they need to update
+// to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface
+// is extended (which is something that can happen without a major version bump
+// of the API package).
+type Int64ObservableGauge interface{ int64ObservableGauge() }
+
+// Int64ObservableUpDownCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if
+// you want users to experience a compilation error, signaling they need to
+// update to your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]
+// interface is extended (which is something that can happen without a major
+// version bump of the API package).
+type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() }
+
+// Int64UpDownCounter is embedded in
+// [go.opentelemetry.io/otel/metric.Int64UpDownCounter].
+//
+// Embed this interface in your implementation of the
+// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want
+// users to experience a compilation error, signaling they need to update to
+// your latest implementation, when the
+// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is
+// extended (which is something that can happen without a major version bump of
+// the API package).
+type Int64UpDownCounter interface{ int64UpDownCounter() }
diff --git a/vendor/go.opentelemetry.io/otel/metric/global/global.go b/vendor/go.opentelemetry.io/otel/metric/global/global.go
deleted file mode 100644
index 05a67c2e9..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/global/global.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.
-
-package global // import "go.opentelemetry.io/otel/metric/global"
-
-import (
- "go.opentelemetry.io/otel/metric"
- "go.opentelemetry.io/otel/metric/internal/global"
-)
-
-// Meter returns a Meter from the global MeterProvider. The
-// instrumentationName must be the name of the library providing
-// instrumentation. This name may be the same as the instrumented code only if
-// that code provides built-in instrumentation. If the instrumentationName is
-// empty, then a implementation defined default name will be used instead.
-//
-// This is short for MeterProvider().Meter(name).
-func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter {
- return MeterProvider().Meter(instrumentationName, opts...)
-}
-
-// MeterProvider returns the registered global trace provider.
-// If none is registered then a No-op MeterProvider is returned.
-func MeterProvider() metric.MeterProvider {
- return global.MeterProvider()
-}
-
-// SetMeterProvider registers `mp` as the global meter provider.
-func SetMeterProvider(mp metric.MeterProvider) {
- global.SetMeterProvider(mp)
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/global/metric.go b/vendor/go.opentelemetry.io/otel/metric/global/metric.go
new file mode 100644
index 000000000..2723df292
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/global/metric.go
@@ -0,0 +1,49 @@
+// 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.
+
+package global // import "go.opentelemetry.io/otel/metric/global"
+
+import (
+ "go.opentelemetry.io/otel/metric"
+ "go.opentelemetry.io/otel/metric/internal/global"
+)
+
+// Meter returns a Meter from the global MeterProvider. The name must be the
+// name of the library providing instrumentation. This name may be the same as
+// the instrumented code only if that code provides built-in instrumentation.
+// If the name is empty, then a implementation defined default name will be
+// used instead.
+//
+// If this is called before a global MeterProvider is registered the returned
+// Meter will be a No-op implementation of a Meter. When a global MeterProvider
+// is registered for the first time, the returned Meter, and all the
+// instruments it has created or will create, are recreated automatically from
+// the new MeterProvider.
+//
+// This is short for GetMeterProvider().Meter(name).
+func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter {
+ return MeterProvider().Meter(instrumentationName, opts...)
+}
+
+// MeterProvider returns the registered global meter provider.
+//
+// If no global MeterProvider has been registered, a No-op MeterProvider implementation is returned. When a global MeterProvider is registered for the first time, the returned MeterProvider, and all the Meters it has created or will create, are recreated automatically from the new MeterProvider.
+func MeterProvider() metric.MeterProvider {
+ return global.MeterProvider()
+}
+
+// SetMeterProvider registers mp as the global MeterProvider.
+func SetMeterProvider(mp metric.MeterProvider) {
+ global.SetMeterProvider(mp)
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go
new file mode 100644
index 000000000..268b2f155
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go
@@ -0,0 +1,332 @@
+// 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.
+
+package metric // import "go.opentelemetry.io/otel/metric"
+
+import "go.opentelemetry.io/otel/attribute"
+
+// Observable is used as a grouping mechanism for all instruments that are
+// updated within a Callback.
+type Observable interface {
+ observable()
+}
+
+// InstrumentOption applies options to all instruments.
+type InstrumentOption interface {
+ Int64CounterOption
+ Int64UpDownCounterOption
+ Int64HistogramOption
+ Int64ObservableCounterOption
+ Int64ObservableUpDownCounterOption
+ Int64ObservableGaugeOption
+
+ Float64CounterOption
+ Float64UpDownCounterOption
+ Float64HistogramOption
+ Float64ObservableCounterOption
+ Float64ObservableUpDownCounterOption
+ Float64ObservableGaugeOption
+}
+
+type descOpt string
+
+func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
+ c.description = string(o)
+ return c
+}
+
+func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
+ c.description = string(o)
+ return c
+}
+
+// WithDescription sets the instrument description.
+func WithDescription(desc string) InstrumentOption { return descOpt(desc) }
+
+type unitOpt string
+
+func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
+ c.unit = string(o)
+ return c
+}
+
+func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
+ c.unit = string(o)
+ return c
+}
+
+// WithUnit sets the instrument unit.
+func WithUnit(u string) InstrumentOption { return unitOpt(u) }
+
+// AddOption applies options to an addition measurement. See
+// [MeasurementOption] for other options that can be used as a AddOption.
+type AddOption interface {
+ applyAdd(AddConfig) AddConfig
+}
+
+// AddConfig contains options for an addition measurement.
+type AddConfig struct {
+ attrs attribute.Set
+}
+
+// NewAddConfig returns a new [AddConfig] with all opts applied.
+func NewAddConfig(opts []AddOption) AddConfig {
+ config := AddConfig{attrs: *attribute.EmptySet()}
+ for _, o := range opts {
+ config = o.applyAdd(config)
+ }
+ return config
+}
+
+// Attributes returns the configured attribute set.
+func (c AddConfig) Attributes() attribute.Set {
+ return c.attrs
+}
+
+// RecordOption applies options to an addition measurement. See
+// [MeasurementOption] for other options that can be used as a RecordOption.
+type RecordOption interface {
+ applyRecord(RecordConfig) RecordConfig
+}
+
+// RecordConfig contains options for a recorded measurement.
+type RecordConfig struct {
+ attrs attribute.Set
+}
+
+// NewRecordConfig returns a new [RecordConfig] with all opts applied.
+func NewRecordConfig(opts []RecordOption) RecordConfig {
+ config := RecordConfig{attrs: *attribute.EmptySet()}
+ for _, o := range opts {
+ config = o.applyRecord(config)
+ }
+ return config
+}
+
+// Attributes returns the configured attribute set.
+func (c RecordConfig) Attributes() attribute.Set {
+ return c.attrs
+}
+
+// ObserveOption applies options to an addition measurement. See
+// [MeasurementOption] for other options that can be used as a ObserveOption.
+type ObserveOption interface {
+ applyObserve(ObserveConfig) ObserveConfig
+}
+
+// ObserveConfig contains options for an observed measurement.
+type ObserveConfig struct {
+ attrs attribute.Set
+}
+
+// NewObserveConfig returns a new [ObserveConfig] with all opts applied.
+func NewObserveConfig(opts []ObserveOption) ObserveConfig {
+ config := ObserveConfig{attrs: *attribute.EmptySet()}
+ for _, o := range opts {
+ config = o.applyObserve(config)
+ }
+ return config
+}
+
+// Attributes returns the configured attribute set.
+func (c ObserveConfig) Attributes() attribute.Set {
+ return c.attrs
+}
+
+// MeasurementOption applies options to all instrument measurement.
+type MeasurementOption interface {
+ AddOption
+ RecordOption
+ ObserveOption
+}
+
+type attrOpt struct {
+ set attribute.Set
+}
+
+// mergeSets returns the union of keys between a and b. Any duplicate keys will
+// use the value associated with b.
+func mergeSets(a, b attribute.Set) attribute.Set {
+ // NewMergeIterator uses the first value for any duplicates.
+ iter := attribute.NewMergeIterator(&b, &a)
+ merged := make([]attribute.KeyValue, 0, a.Len()+b.Len())
+ for iter.Next() {
+ merged = append(merged, iter.Attribute())
+ }
+ return attribute.NewSet(merged...)
+}
+
+func (o attrOpt) applyAdd(c AddConfig) AddConfig {
+ switch {
+ case o.set.Len() == 0:
+ case c.attrs.Len() == 0:
+ c.attrs = o.set
+ default:
+ c.attrs = mergeSets(c.attrs, o.set)
+ }
+ return c
+}
+
+func (o attrOpt) applyRecord(c RecordConfig) RecordConfig {
+ switch {
+ case o.set.Len() == 0:
+ case c.attrs.Len() == 0:
+ c.attrs = o.set
+ default:
+ c.attrs = mergeSets(c.attrs, o.set)
+ }
+ return c
+}
+
+func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig {
+ switch {
+ case o.set.Len() == 0:
+ case c.attrs.Len() == 0:
+ c.attrs = o.set
+ default:
+ c.attrs = mergeSets(c.attrs, o.set)
+ }
+ return c
+}
+
+// WithAttributeSet sets the attribute Set associated with a measurement is
+// made with.
+//
+// If multiple WithAttributeSet or WithAttributes options are passed the
+// attributes will be merged together in the order they are passed. Attributes
+// with duplicate keys will use the last value passed.
+func WithAttributeSet(attributes attribute.Set) MeasurementOption {
+ return attrOpt{set: attributes}
+}
+
+// WithAttributes converts attributes into an attribute Set and sets the Set to
+// be associated with a measurement. This is shorthand for:
+//
+// cp := make([]attribute.KeyValue, len(attributes))
+// copy(cp, attributes)
+// WithAttributes(attribute.NewSet(cp...))
+//
+// [attribute.NewSet] may modify the passed attributes so this will make a copy
+// of attributes before creating a set in order to ensure this function is
+// concurrent safe. This makes this option function less optimized in
+// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be
+// preferred for performance sensitive code.
+//
+// See [WithAttributeSet] for information about how multiple WithAttributes are
+// merged.
+func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption {
+ cp := make([]attribute.KeyValue, len(attributes))
+ copy(cp, attributes)
+ return attrOpt{set: attribute.NewSet(cp...)}
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go
deleted file mode 100644
index 2f624bfe0..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// 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.
-
-package instrument // import "go.opentelemetry.io/otel/metric/instrument"
-
-import (
- "context"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/unit"
-)
-
-// Float64Observable describes a set of instruments used asynchronously to
-// record float64 measurements once per collection cycle. Observations of
-// these instruments are only made within a callback.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64Observable interface {
- Asynchronous
-
- float64Observable()
-}
-
-// Float64ObservableCounter is an instrument used to asynchronously record
-// increasing float64 measurements once per collection cycle. Observations are
-// only made within a callback for this instrument. The value observed is
-// assumed the to be the cumulative sum of the count.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64ObservableCounter interface{ Float64Observable }
-
-// Float64ObservableUpDownCounter is an instrument used to asynchronously
-// record float64 measurements once per collection cycle. Observations are only
-// made within a callback for this instrument. The value observed is assumed
-// the to be the cumulative sum of the count.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64ObservableUpDownCounter interface{ Float64Observable }
-
-// Float64ObservableGauge is an instrument used to asynchronously record
-// instantaneous float64 measurements once per collection cycle. Observations
-// are only made within a callback for this instrument.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64ObservableGauge interface{ Float64Observable }
-
-// Float64Observer is a recorder of float64 measurements.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64Observer interface {
- Observe(value float64, attributes ...attribute.KeyValue)
-}
-
-// Float64Callback is a function registered with a Meter that makes
-// observations for a Float64Observerable instrument it is registered with.
-// Calls to the Float64Observer record measurement values for the
-// Float64Observable.
-//
-// The function needs to complete in a finite amount of time and the deadline
-// of the passed context is expected to be honored.
-//
-// The function needs to make unique observations across all registered
-// Float64Callbacks. Meaning, it should not report measurements with the same
-// attributes as another Float64Callbacks also registered for the same
-// instrument.
-//
-// The function needs to be concurrent safe.
-type Float64Callback func(context.Context, Float64Observer) error
-
-// Float64ObserverConfig contains options for Asynchronous instruments that
-// observe float64 values.
-type Float64ObserverConfig struct {
- description string
- unit unit.Unit
- callbacks []Float64Callback
-}
-
-// NewFloat64ObserverConfig returns a new Float64ObserverConfig with all opts
-// applied.
-func NewFloat64ObserverConfig(opts ...Float64ObserverOption) Float64ObserverConfig {
- var config Float64ObserverConfig
- for _, o := range opts {
- config = o.applyFloat64Observer(config)
- }
- return config
-}
-
-// Description returns the Config description.
-func (c Float64ObserverConfig) Description() string {
- return c.description
-}
-
-// Unit returns the Config unit.
-func (c Float64ObserverConfig) Unit() unit.Unit {
- return c.unit
-}
-
-// Callbacks returns the Config callbacks.
-func (c Float64ObserverConfig) Callbacks() []Float64Callback {
- return c.callbacks
-}
-
-// Float64ObserverOption applies options to float64 Observer instruments.
-type Float64ObserverOption interface {
- applyFloat64Observer(Float64ObserverConfig) Float64ObserverConfig
-}
-
-type float64ObserverOptionFunc func(Float64ObserverConfig) Float64ObserverConfig
-
-func (fn float64ObserverOptionFunc) applyFloat64Observer(cfg Float64ObserverConfig) Float64ObserverConfig {
- return fn(cfg)
-}
-
-// WithFloat64Callback adds callback to be called for an instrument.
-func WithFloat64Callback(callback Float64Callback) Float64ObserverOption {
- return float64ObserverOptionFunc(func(cfg Float64ObserverConfig) Float64ObserverConfig {
- cfg.callbacks = append(cfg.callbacks, callback)
- return cfg
- })
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go
deleted file mode 100644
index ac0d09d90..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// 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.
-
-package instrument // import "go.opentelemetry.io/otel/metric/instrument"
-
-import (
- "context"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/unit"
-)
-
-// Int64Observable describes a set of instruments used asynchronously to record
-// int64 measurements once per collection cycle. Observations of these
-// instruments are only made within a callback.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64Observable interface {
- Asynchronous
-
- int64Observable()
-}
-
-// Int64ObservableCounter is an instrument used to asynchronously record
-// increasing int64 measurements once per collection cycle. Observations are
-// only made within a callback for this instrument. The value observed is
-// assumed the to be the cumulative sum of the count.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64ObservableCounter interface{ Int64Observable }
-
-// Int64ObservableUpDownCounter is an instrument used to asynchronously record
-// int64 measurements once per collection cycle. Observations are only made
-// within a callback for this instrument. The value observed is assumed the to
-// be the cumulative sum of the count.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64ObservableUpDownCounter interface{ Int64Observable }
-
-// Int64ObservableGauge is an instrument used to asynchronously record
-// instantaneous int64 measurements once per collection cycle. Observations are
-// only made within a callback for this instrument.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64ObservableGauge interface{ Int64Observable }
-
-// Int64Observer is a recorder of int64 measurements.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64Observer interface {
- Observe(value int64, attributes ...attribute.KeyValue)
-}
-
-// Int64Callback is a function registered with a Meter that makes
-// observations for a Int64Observerable instrument it is registered with.
-// Calls to the Int64Observer record measurement values for the
-// Int64Observable.
-//
-// The function needs to complete in a finite amount of time and the deadline
-// of the passed context is expected to be honored.
-//
-// The function needs to make unique observations across all registered
-// Int64Callback. Meaning, it should not report measurements with the same
-// attributes as another Int64Callbacks also registered for the same
-// instrument.
-//
-// The function needs to be concurrent safe.
-type Int64Callback func(context.Context, Int64Observer) error
-
-// Int64ObserverConfig contains options for Asynchronous instruments that
-// observe int64 values.
-type Int64ObserverConfig struct {
- description string
- unit unit.Unit
- callbacks []Int64Callback
-}
-
-// NewInt64ObserverConfig returns a new Int64ObserverConfig with all opts
-// applied.
-func NewInt64ObserverConfig(opts ...Int64ObserverOption) Int64ObserverConfig {
- var config Int64ObserverConfig
- for _, o := range opts {
- config = o.applyInt64Observer(config)
- }
- return config
-}
-
-// Description returns the Config description.
-func (c Int64ObserverConfig) Description() string {
- return c.description
-}
-
-// Unit returns the Config unit.
-func (c Int64ObserverConfig) Unit() unit.Unit {
- return c.unit
-}
-
-// Callbacks returns the Config callbacks.
-func (c Int64ObserverConfig) Callbacks() []Int64Callback {
- return c.callbacks
-}
-
-// Int64ObserverOption applies options to int64 Observer instruments.
-type Int64ObserverOption interface {
- applyInt64Observer(Int64ObserverConfig) Int64ObserverConfig
-}
-
-type int64ObserverOptionFunc func(Int64ObserverConfig) Int64ObserverConfig
-
-func (fn int64ObserverOptionFunc) applyInt64Observer(cfg Int64ObserverConfig) Int64ObserverConfig {
- return fn(cfg)
-}
-
-// WithInt64Callback adds callback to be called for an instrument.
-func WithInt64Callback(callback Int64Callback) Int64ObserverOption {
- return int64ObserverOptionFunc(func(cfg Int64ObserverConfig) Int64ObserverConfig {
- cfg.callbacks = append(cfg.callbacks, callback)
- return cfg
- })
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/deprecation.go b/vendor/go.opentelemetry.io/otel/metric/instrument/deprecation.go
new file mode 100644
index 000000000..a2e4b31e1
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/instrument/deprecation.go
@@ -0,0 +1,452 @@
+// 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.
+
+// Package instrument provides the OpenTelemetry API instruments used to make
+// measurements.
+//
+// Deprecated: Use go.opentelemetry.io/otel/metric instead.
+package instrument // import "go.opentelemetry.io/otel/metric/instrument"
+
+import (
+ "go.opentelemetry.io/otel/metric"
+)
+
+// Float64Observable is an alias for [metric.Float64Observable].
+//
+// Deprecated: Use [metric.Float64Observable] instead.
+type Float64Observable metric.Float64Observable
+
+// Float64ObservableCounter is an alias for [metric.Float64ObservableCounter].
+//
+// Deprecated: Use [metric.Float64ObservableCounter] instead.
+type Float64ObservableCounter metric.Float64ObservableCounter
+
+// Float64ObservableCounterConfig is an alias for
+// [metric.Float64ObservableCounterConfig].
+//
+// Deprecated: Use [metric.Float64ObservableCounterConfig] instead.
+type Float64ObservableCounterConfig metric.Float64ObservableCounterConfig
+
+// NewFloat64ObservableCounterConfig wraps
+// [metric.NewFloat64ObservableCounterConfig].
+//
+// Deprecated: Use [metric.NewFloat64ObservableCounterConfig] instead.
+func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig {
+ o := make([]metric.Float64ObservableCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64ObservableCounterOption(opts[i])
+ }
+ c := metric.NewFloat64ObservableCounterConfig(o...)
+ return Float64ObservableCounterConfig(c)
+}
+
+// Float64ObservableCounterOption is an alias for
+// [metric.Float64ObservableCounterOption].
+//
+// Deprecated: Use [metric.Float64ObservableCounterOption] instead.
+type Float64ObservableCounterOption metric.Float64ObservableCounterOption
+
+// Float64ObservableUpDownCounter is an alias for
+// [metric.Float64ObservableUpDownCounter].
+//
+// Deprecated: Use [metric.Float64ObservableUpDownCounter] instead.
+type Float64ObservableUpDownCounter metric.Float64ObservableUpDownCounter
+
+// Float64ObservableUpDownCounterConfig is an alias for
+// [metric.Float64ObservableUpDownCounterConfig].
+//
+// Deprecated: Use [metric.Float64ObservableUpDownCounterConfig] instead.
+type Float64ObservableUpDownCounterConfig metric.Float64ObservableUpDownCounterConfig
+
+// NewFloat64ObservableUpDownCounterConfig wraps
+// [metric.NewFloat64ObservableUpDownCounterConfig].
+//
+// Deprecated: Use [metric.NewFloat64ObservableUpDownCounterConfig] instead.
+func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig {
+ o := make([]metric.Float64ObservableUpDownCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64ObservableUpDownCounterOption(opts[i])
+ }
+ c := metric.NewFloat64ObservableUpDownCounterConfig(o...)
+ return Float64ObservableUpDownCounterConfig(c)
+}
+
+// Float64ObservableUpDownCounterOption is an alias for
+// [metric.Float64ObservableUpDownCounterOption].
+//
+// Deprecated: Use [metric.Float64ObservableUpDownCounterOption] instead.
+type Float64ObservableUpDownCounterOption metric.Float64ObservableUpDownCounterOption
+
+// Float64ObservableGauge is an alias for [metric.Float64ObservableGauge].
+//
+// Deprecated: Use [metric.Float64ObservableGauge] instead.
+type Float64ObservableGauge metric.Float64ObservableGauge
+
+// Float64ObservableGaugeConfig is an alias for
+// [metric.Float64ObservableGaugeConfig].
+//
+// Deprecated: Use [metric.Float64ObservableGaugeConfig] instead.
+type Float64ObservableGaugeConfig metric.Float64ObservableGaugeConfig
+
+// NewFloat64ObservableGaugeConfig wraps
+// [metric.NewFloat64ObservableGaugeConfig].
+//
+// Deprecated: Use [metric.NewFloat64ObservableGaugeConfig] instead.
+func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig {
+ o := make([]metric.Float64ObservableGaugeOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64ObservableGaugeOption(opts[i])
+ }
+ c := metric.NewFloat64ObservableGaugeConfig(o...)
+ return Float64ObservableGaugeConfig(c)
+}
+
+// Float64ObservableGaugeOption is an alias for
+// [metric.Float64ObservableGaugeOption].
+//
+// Deprecated: Use [metric.Float64ObservableGaugeOption] instead.
+type Float64ObservableGaugeOption metric.Float64ObservableGaugeOption
+
+// Float64Observer is an alias for [metric.Float64Observer].
+//
+// Deprecated: Use [metric.Float64Observer] instead.
+type Float64Observer metric.Float64Observer
+
+// Float64Callback is an alias for [metric.Float64Callback].
+//
+// Deprecated: Use [metric.Float64Callback] instead.
+type Float64Callback metric.Float64Callback
+
+// Float64ObservableOption is an alias for [metric.Float64ObservableOption].
+//
+// Deprecated: Use [metric.Float64ObservableOption] instead.
+type Float64ObservableOption metric.Float64ObservableOption
+
+// WithFloat64Callback wraps [metric.WithFloat64Callback].
+//
+// Deprecated: Use [metric.WithFloat64Callback] instead.
+func WithFloat64Callback(callback Float64Callback) Float64ObservableOption {
+ cback := metric.Float64Callback(callback)
+ opt := metric.WithFloat64Callback(cback)
+ return Float64ObservableOption(opt)
+}
+
+// Int64Observable is an alias for [metric.Int64Observable].
+//
+// Deprecated: Use [metric.Int64Observable] instead.
+type Int64Observable metric.Int64Observable
+
+// Int64ObservableCounter is an alias for [metric.Int64ObservableCounter].
+//
+// Deprecated: Use [metric.Int64ObservableCounter] instead.
+type Int64ObservableCounter metric.Int64ObservableCounter
+
+// Int64ObservableCounterConfig is an alias for
+// [metric.Int64ObservableCounterConfig].
+//
+// Deprecated: Use [metric.Int64ObservableCounterConfig] instead.
+type Int64ObservableCounterConfig metric.Int64ObservableCounterConfig
+
+// NewInt64ObservableCounterConfig wraps
+// [metric.NewInt64ObservableCounterConfig].
+//
+// Deprecated: Use [metric.NewInt64ObservableCounterConfig] instead.
+func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig {
+ o := make([]metric.Int64ObservableCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64ObservableCounterOption(opts[i])
+ }
+ c := metric.NewInt64ObservableCounterConfig(o...)
+ return Int64ObservableCounterConfig(c)
+}
+
+// Int64ObservableCounterOption is an alias for
+// [metric.Int64ObservableCounterOption].
+//
+// Deprecated: Use [metric.Int64ObservableCounterOption] instead.
+type Int64ObservableCounterOption metric.Int64ObservableCounterOption
+
+// Int64ObservableUpDownCounter is an alias for
+// [metric.Int64ObservableUpDownCounter].
+//
+// Deprecated: Use [metric.Int64ObservableUpDownCounter] instead.
+type Int64ObservableUpDownCounter metric.Int64ObservableUpDownCounter
+
+// Int64ObservableUpDownCounterConfig is an alias for
+// [metric.Int64ObservableUpDownCounterConfig].
+//
+// Deprecated: Use [metric.Int64ObservableUpDownCounterConfig] instead.
+type Int64ObservableUpDownCounterConfig metric.Int64ObservableUpDownCounterConfig
+
+// NewInt64ObservableUpDownCounterConfig wraps
+// [metric.NewInt64ObservableUpDownCounterConfig].
+//
+// Deprecated: Use [metric.NewInt64ObservableUpDownCounterConfig] instead.
+func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig {
+ o := make([]metric.Int64ObservableUpDownCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64ObservableUpDownCounterOption(opts[i])
+ }
+ c := metric.NewInt64ObservableUpDownCounterConfig(o...)
+ return Int64ObservableUpDownCounterConfig(c)
+}
+
+// Int64ObservableUpDownCounterOption is an alias for
+// [metric.Int64ObservableUpDownCounterOption].
+//
+// Deprecated: Use [metric.Int64ObservableUpDownCounterOption] instead.
+type Int64ObservableUpDownCounterOption metric.Int64ObservableUpDownCounterOption
+
+// Int64ObservableGauge is an alias for [metric.Int64ObservableGauge].
+//
+// Deprecated: Use [metric.Int64ObservableGauge] instead.
+type Int64ObservableGauge metric.Int64ObservableGauge
+
+// Int64ObservableGaugeConfig is an alias for
+// [metric.Int64ObservableGaugeConfig].
+//
+// Deprecated: Use [metric.Int64ObservableGaugeConfig] instead.
+type Int64ObservableGaugeConfig metric.Int64ObservableGaugeConfig
+
+// NewInt64ObservableGaugeConfig wraps [metric.NewInt64ObservableGaugeConfig].
+//
+// Deprecated: Use [metric.NewInt64ObservableGaugeConfig] instead.
+func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig {
+ o := make([]metric.Int64ObservableGaugeOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64ObservableGaugeOption(opts[i])
+ }
+ c := metric.NewInt64ObservableGaugeConfig(o...)
+ return Int64ObservableGaugeConfig(c)
+}
+
+// Int64ObservableGaugeOption is an alias for
+// [metric.Int64ObservableGaugeOption].
+//
+// Deprecated: Use [metric.Int64ObservableGaugeOption] instead.
+type Int64ObservableGaugeOption metric.Int64ObservableGaugeOption
+
+// Int64Observer is an alias for [metric.Int64Observer].
+//
+// Deprecated: Use [metric.Int64Observer] instead.
+type Int64Observer metric.Int64Observer
+
+// Int64Callback is an alias for [metric.Int64Callback].
+//
+// Deprecated: Use [metric.Int64Callback] instead.
+type Int64Callback metric.Int64Callback
+
+// Int64ObservableOption is an alias for [metric.Int64ObservableOption].
+//
+// Deprecated: Use [metric.Int64ObservableOption] instead.
+type Int64ObservableOption metric.Int64ObservableOption
+
+// WithInt64Callback wraps [metric.WithInt64Callback].
+//
+// Deprecated: Use [metric.WithInt64Callback] instead.
+func WithInt64Callback(callback Int64Callback) Int64ObservableOption {
+ cback := metric.Int64Callback(callback)
+ opt := metric.WithInt64Callback(cback)
+ return Int64ObservableOption(opt)
+}
+
+// Float64Counter is an alias for [metric.Float64Counter].
+//
+// Deprecated: Use [metric.Float64Counter] instead.
+type Float64Counter metric.Float64Counter
+
+// Float64CounterConfig is an alias for [metric.Float64CounterConfig].
+//
+// Deprecated: Use [metric.Float64CounterConfig] instead.
+type Float64CounterConfig metric.Float64CounterConfig
+
+// NewFloat64CounterConfig wraps [metric.NewFloat64CounterConfig].
+//
+// Deprecated: Use [metric.NewFloat64CounterConfig] instead.
+func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig {
+ o := make([]metric.Float64CounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64CounterOption(opts[i])
+ }
+ c := metric.NewFloat64CounterConfig(o...)
+ return Float64CounterConfig(c)
+}
+
+// Float64CounterOption is an alias for [metric.Float64CounterOption].
+//
+// Deprecated: Use [metric.Float64CounterOption] instead.
+type Float64CounterOption metric.Float64CounterOption
+
+// Float64UpDownCounter is an alias for [metric.Float64UpDownCounter].
+//
+// Deprecated: Use [metric.Float64UpDownCounter] instead.
+type Float64UpDownCounter metric.Float64UpDownCounter
+
+// Float64UpDownCounterConfig is an alias for
+// [metric.Float64UpDownCounterConfig].
+//
+// Deprecated: Use [metric.Float64UpDownCounterConfig] instead.
+type Float64UpDownCounterConfig metric.Float64UpDownCounterConfig
+
+// NewFloat64UpDownCounterConfig wraps [metric.NewFloat64UpDownCounterConfig].
+//
+// Deprecated: Use [metric.NewFloat64UpDownCounterConfig] instead.
+func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig {
+ o := make([]metric.Float64UpDownCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64UpDownCounterOption(opts[i])
+ }
+ c := metric.NewFloat64UpDownCounterConfig(o...)
+ return Float64UpDownCounterConfig(c)
+}
+
+// Float64UpDownCounterOption is an alias for
+// [metric.Float64UpDownCounterOption].
+//
+// Deprecated: Use [metric.Float64UpDownCounterOption] instead.
+type Float64UpDownCounterOption metric.Float64UpDownCounterOption
+
+// Float64Histogram is an alias for [metric.Float64Histogram].
+//
+// Deprecated: Use [metric.Float64Histogram] instead.
+type Float64Histogram metric.Float64Histogram
+
+// Float64HistogramConfig is an alias for [metric.Float64HistogramConfig].
+//
+// Deprecated: Use [metric.Float64HistogramConfig] instead.
+type Float64HistogramConfig metric.Float64HistogramConfig
+
+// NewFloat64HistogramConfig wraps [metric.NewFloat64HistogramConfig].
+//
+// Deprecated: Use [metric.NewFloat64HistogramConfig] instead.
+func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig {
+ o := make([]metric.Float64HistogramOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Float64HistogramOption(opts[i])
+ }
+ c := metric.NewFloat64HistogramConfig(o...)
+ return Float64HistogramConfig(c)
+}
+
+// Float64HistogramOption is an alias for [metric.Float64HistogramOption].
+//
+// Deprecated: Use [metric.Float64HistogramOption] instead.
+type Float64HistogramOption metric.Float64HistogramOption
+
+// Int64Counter is an alias for [metric.Int64Counter].
+//
+// Deprecated: Use [metric.Int64Counter] instead.
+type Int64Counter metric.Int64Counter
+
+// Int64CounterConfig is an alias for [metric.Int64CounterConfig].
+//
+// Deprecated: Use [metric.Int64CounterConfig] instead.
+type Int64CounterConfig metric.Int64CounterConfig
+
+// NewInt64CounterConfig wraps [metric.NewInt64CounterConfig].
+//
+// Deprecated: Use [metric.NewInt64CounterConfig] instead.
+func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig {
+ o := make([]metric.Int64CounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64CounterOption(opts[i])
+ }
+ c := metric.NewInt64CounterConfig(o...)
+ return Int64CounterConfig(c)
+}
+
+// Int64CounterOption is an alias for [metric.Int64CounterOption].
+//
+// Deprecated: Use [metric.Int64CounterOption] instead.
+type Int64CounterOption metric.Int64CounterOption
+
+// Int64UpDownCounter is an alias for [metric.Int64UpDownCounter].
+//
+// Deprecated: Use [metric.Int64UpDownCounter] instead.
+type Int64UpDownCounter metric.Int64UpDownCounter
+
+// Int64UpDownCounterConfig is an alias for [metric.Int64UpDownCounterConfig].
+//
+// Deprecated: Use [metric.Int64UpDownCounterConfig] instead.
+type Int64UpDownCounterConfig metric.Int64UpDownCounterConfig
+
+// NewInt64UpDownCounterConfig wraps [metric.NewInt64UpDownCounterConfig].
+//
+// Deprecated: Use [metric.NewInt64UpDownCounterConfig] instead.
+func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig {
+ o := make([]metric.Int64UpDownCounterOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64UpDownCounterOption(opts[i])
+ }
+ c := metric.NewInt64UpDownCounterConfig(o...)
+ return Int64UpDownCounterConfig(c)
+}
+
+// Int64UpDownCounterOption is an alias for [metric.Int64UpDownCounterOption].
+//
+// Deprecated: Use [metric.Int64UpDownCounterOption] instead.
+type Int64UpDownCounterOption metric.Int64UpDownCounterOption
+
+// Int64Histogram is an alias for [metric.Int64Histogram].
+//
+// Deprecated: Use [metric.Int64Histogram] instead.
+type Int64Histogram metric.Int64Histogram
+
+// Int64HistogramConfig is an alias for [metric.Int64HistogramConfig].
+//
+// Deprecated: Use [metric.Int64HistogramConfig] instead.
+type Int64HistogramConfig metric.Int64HistogramConfig
+
+// NewInt64HistogramConfig wraps [metric.NewInt64HistogramConfig].
+//
+// Deprecated: Use [metric.NewInt64HistogramConfig] instead.
+func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig {
+ o := make([]metric.Int64HistogramOption, len(opts))
+ for i := range opts {
+ o[i] = metric.Int64HistogramOption(opts[i])
+ }
+ c := metric.NewInt64HistogramConfig(o...)
+ return Int64HistogramConfig(c)
+}
+
+// Int64HistogramOption is an alias for [metric.Int64HistogramOption].
+//
+// Deprecated: Use [metric.Int64HistogramOption] instead.
+type Int64HistogramOption metric.Int64HistogramOption
+
+// Observable is an alias for [metric.Observable].
+//
+// Deprecated: Use [metric.Observable] instead.
+type Observable metric.Observable
+
+// Option is an alias for [metric.InstrumentOption].
+//
+// Deprecated: Use [metric.InstrumentOption] instead.
+type Option metric.InstrumentOption
+
+// WithDescription is an alias for [metric.WithDescription].
+//
+// Deprecated: Use [metric.WithDescription] instead.
+func WithDescription(desc string) Option {
+ o := metric.WithDescription(desc)
+ return Option(o)
+}
+
+// WithUnit is an alias for [metric.WithUnit].
+//
+// Deprecated: Use [metric.WithUnit] instead.
+func WithUnit(u string) Option {
+ o := metric.WithUnit(u)
+ return Option(o)
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
deleted file mode 100644
index c583be6fb..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.
-
-package instrument // import "go.opentelemetry.io/otel/metric/instrument"
-
-import "go.opentelemetry.io/otel/metric/unit"
-
-// Asynchronous instruments are instruments that are updated within a Callback.
-// If an instrument is observed outside of it's callback it should be an error.
-//
-// This interface is used as a grouping mechanism.
-type Asynchronous interface {
- asynchronous()
-}
-
-// Synchronous instruments are updated in line with application code.
-//
-// This interface is used as a grouping mechanism.
-type Synchronous interface {
- synchronous()
-}
-
-// Option applies options to all instruments.
-type Option interface {
- Float64ObserverOption
- Int64ObserverOption
- Float64Option
- Int64Option
-}
-
-type descOpt string
-
-func (o descOpt) applyFloat64(c Float64Config) Float64Config {
- c.description = string(o)
- return c
-}
-
-func (o descOpt) applyInt64(c Int64Config) Int64Config {
- c.description = string(o)
- return c
-}
-
-func (o descOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig {
- c.description = string(o)
- return c
-}
-
-func (o descOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig {
- c.description = string(o)
- return c
-}
-
-// WithDescription sets the instrument description.
-func WithDescription(desc string) Option { return descOpt(desc) }
-
-type unitOpt unit.Unit
-
-func (o unitOpt) applyFloat64(c Float64Config) Float64Config {
- c.unit = unit.Unit(o)
- return c
-}
-
-func (o unitOpt) applyInt64(c Int64Config) Int64Config {
- c.unit = unit.Unit(o)
- return c
-}
-
-func (o unitOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig {
- c.unit = unit.Unit(o)
- return c
-}
-
-func (o unitOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig {
- c.unit = unit.Unit(o)
- return c
-}
-
-// WithUnit sets the instrument unit.
-func WithUnit(u unit.Unit) Option { return unitOpt(u) }
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go
deleted file mode 100644
index d8f6ba9f4..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-package instrument // import "go.opentelemetry.io/otel/metric/instrument"
-
-import (
- "context"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/unit"
-)
-
-// Float64Counter is an instrument that records increasing float64 values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64Counter interface {
- // Add records a change to the counter.
- Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Float64UpDownCounter is an instrument that records increasing or decreasing
-// float64 values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64UpDownCounter interface {
- // Add records a change to the counter.
- Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Float64Histogram is an instrument that records a distribution of float64
-// values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Float64Histogram interface {
- // Record adds an additional value to the distribution.
- Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Float64Config contains options for Asynchronous instruments that
-// observe float64 values.
-type Float64Config struct {
- description string
- unit unit.Unit
-}
-
-// Float64Config contains options for Synchronous instruments that record
-// float64 values.
-func NewFloat64Config(opts ...Float64Option) Float64Config {
- var config Float64Config
- for _, o := range opts {
- config = o.applyFloat64(config)
- }
- return config
-}
-
-// Description returns the Config description.
-func (c Float64Config) Description() string {
- return c.description
-}
-
-// Unit returns the Config unit.
-func (c Float64Config) Unit() unit.Unit {
- return c.unit
-}
-
-// Float64Option applies options to synchronous float64 instruments.
-type Float64Option interface {
- applyFloat64(Float64Config) Float64Config
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go
deleted file mode 100644
index 96bf730e4..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-package instrument // import "go.opentelemetry.io/otel/metric/instrument"
-
-import (
- "context"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/unit"
-)
-
-// Int64Counter is an instrument that records increasing int64 values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64Counter interface {
- // Add records a change to the counter.
- Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Int64UpDownCounter is an instrument that records increasing or decreasing
-// int64 values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64UpDownCounter interface {
- // Add records a change to the counter.
- Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Int64Histogram is an instrument that records a distribution of int64
-// values.
-//
-// Warning: methods may be added to this interface in minor releases.
-type Int64Histogram interface {
- // Record adds an additional value to the distribution.
- Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
-
- Synchronous
-}
-
-// Int64Config contains options for Synchronous instruments that record int64
-// values.
-type Int64Config struct {
- description string
- unit unit.Unit
-}
-
-// NewInt64Config returns a new Int64Config with all opts
-// applied.
-func NewInt64Config(opts ...Int64Option) Int64Config {
- var config Int64Config
- for _, o := range opts {
- config = o.applyInt64(config)
- }
- return config
-}
-
-// Description returns the Config description.
-func (c Int64Config) Description() string {
- return c.description
-}
-
-// Unit returns the Config unit.
-func (c Int64Config) Unit() unit.Unit {
- return c.unit
-}
-
-// Int64Option applies options to synchronous int64 instruments.
-type Int64Option interface {
- applyInt64(Int64Config) Int64Config
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
index d1480fa5f..a3b898bfd 100644
--- a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
+++ b/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
@@ -19,27 +19,27 @@ import (
"sync/atomic"
"go.opentelemetry.io/otel"
- "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
- "go.opentelemetry.io/otel/metric/instrument"
+ "go.opentelemetry.io/otel/metric/embedded"
)
// unwrapper unwraps to return the underlying instrument implementation.
type unwrapper interface {
- Unwrap() instrument.Asynchronous
+ Unwrap() metric.Observable
}
type afCounter struct {
- instrument.Float64Observable
+ embedded.Float64ObservableCounter
+ metric.Float64Observable
name string
- opts []instrument.Float64ObserverOption
+ opts []metric.Float64ObservableCounterOption
- delegate atomic.Value //instrument.Float64ObservableCounter
+ delegate atomic.Value //metric.Float64ObservableCounter
}
var _ unwrapper = (*afCounter)(nil)
-var _ instrument.Float64ObservableCounter = (*afCounter)(nil)
+var _ metric.Float64ObservableCounter = (*afCounter)(nil)
func (i *afCounter) setDelegate(m metric.Meter) {
ctr, err := m.Float64ObservableCounter(i.name, i.opts...)
@@ -50,24 +50,25 @@ func (i *afCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *afCounter) Unwrap() instrument.Asynchronous {
+func (i *afCounter) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Float64ObservableCounter)
+ return ctr.(metric.Float64ObservableCounter)
}
return nil
}
type afUpDownCounter struct {
- instrument.Float64Observable
+ embedded.Float64ObservableUpDownCounter
+ metric.Float64Observable
name string
- opts []instrument.Float64ObserverOption
+ opts []metric.Float64ObservableUpDownCounterOption
- delegate atomic.Value //instrument.Float64ObservableUpDownCounter
+ delegate atomic.Value //metric.Float64ObservableUpDownCounter
}
var _ unwrapper = (*afUpDownCounter)(nil)
-var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil)
+var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil)
func (i *afUpDownCounter) setDelegate(m metric.Meter) {
ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...)
@@ -78,24 +79,25 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *afUpDownCounter) Unwrap() instrument.Asynchronous {
+func (i *afUpDownCounter) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Float64ObservableUpDownCounter)
+ return ctr.(metric.Float64ObservableUpDownCounter)
}
return nil
}
type afGauge struct {
- instrument.Float64Observable
+ embedded.Float64ObservableGauge
+ metric.Float64Observable
name string
- opts []instrument.Float64ObserverOption
+ opts []metric.Float64ObservableGaugeOption
- delegate atomic.Value //instrument.Float64ObservableGauge
+ delegate atomic.Value //metric.Float64ObservableGauge
}
var _ unwrapper = (*afGauge)(nil)
-var _ instrument.Float64ObservableGauge = (*afGauge)(nil)
+var _ metric.Float64ObservableGauge = (*afGauge)(nil)
func (i *afGauge) setDelegate(m metric.Meter) {
ctr, err := m.Float64ObservableGauge(i.name, i.opts...)
@@ -106,24 +108,25 @@ func (i *afGauge) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *afGauge) Unwrap() instrument.Asynchronous {
+func (i *afGauge) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Float64ObservableGauge)
+ return ctr.(metric.Float64ObservableGauge)
}
return nil
}
type aiCounter struct {
- instrument.Int64Observable
+ embedded.Int64ObservableCounter
+ metric.Int64Observable
name string
- opts []instrument.Int64ObserverOption
+ opts []metric.Int64ObservableCounterOption
- delegate atomic.Value //instrument.Int64ObservableCounter
+ delegate atomic.Value //metric.Int64ObservableCounter
}
var _ unwrapper = (*aiCounter)(nil)
-var _ instrument.Int64ObservableCounter = (*aiCounter)(nil)
+var _ metric.Int64ObservableCounter = (*aiCounter)(nil)
func (i *aiCounter) setDelegate(m metric.Meter) {
ctr, err := m.Int64ObservableCounter(i.name, i.opts...)
@@ -134,24 +137,25 @@ func (i *aiCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *aiCounter) Unwrap() instrument.Asynchronous {
+func (i *aiCounter) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Int64ObservableCounter)
+ return ctr.(metric.Int64ObservableCounter)
}
return nil
}
type aiUpDownCounter struct {
- instrument.Int64Observable
+ embedded.Int64ObservableUpDownCounter
+ metric.Int64Observable
name string
- opts []instrument.Int64ObserverOption
+ opts []metric.Int64ObservableUpDownCounterOption
- delegate atomic.Value //instrument.Int64ObservableUpDownCounter
+ delegate atomic.Value //metric.Int64ObservableUpDownCounter
}
var _ unwrapper = (*aiUpDownCounter)(nil)
-var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil)
+var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil)
func (i *aiUpDownCounter) setDelegate(m metric.Meter) {
ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...)
@@ -162,24 +166,25 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous {
+func (i *aiUpDownCounter) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Int64ObservableUpDownCounter)
+ return ctr.(metric.Int64ObservableUpDownCounter)
}
return nil
}
type aiGauge struct {
- instrument.Int64Observable
+ embedded.Int64ObservableGauge
+ metric.Int64Observable
name string
- opts []instrument.Int64ObserverOption
+ opts []metric.Int64ObservableGaugeOption
- delegate atomic.Value //instrument.Int64ObservableGauge
+ delegate atomic.Value //metric.Int64ObservableGauge
}
var _ unwrapper = (*aiGauge)(nil)
-var _ instrument.Int64ObservableGauge = (*aiGauge)(nil)
+var _ metric.Int64ObservableGauge = (*aiGauge)(nil)
func (i *aiGauge) setDelegate(m metric.Meter) {
ctr, err := m.Int64ObservableGauge(i.name, i.opts...)
@@ -190,24 +195,24 @@ func (i *aiGauge) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *aiGauge) Unwrap() instrument.Asynchronous {
+func (i *aiGauge) Unwrap() metric.Observable {
if ctr := i.delegate.Load(); ctr != nil {
- return ctr.(instrument.Int64ObservableGauge)
+ return ctr.(metric.Int64ObservableGauge)
}
return nil
}
// Sync Instruments.
type sfCounter struct {
- name string
- opts []instrument.Float64Option
+ embedded.Float64Counter
- delegate atomic.Value //instrument.Float64Counter
+ name string
+ opts []metric.Float64CounterOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Float64Counter
}
-var _ instrument.Float64Counter = (*sfCounter)(nil)
+var _ metric.Float64Counter = (*sfCounter)(nil)
func (i *sfCounter) setDelegate(m metric.Meter) {
ctr, err := m.Float64Counter(i.name, i.opts...)
@@ -218,22 +223,22 @@ func (i *sfCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
+func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Float64Counter).Add(ctx, incr, attrs...)
+ ctr.(metric.Float64Counter).Add(ctx, incr, opts...)
}
}
type sfUpDownCounter struct {
- name string
- opts []instrument.Float64Option
+ embedded.Float64UpDownCounter
- delegate atomic.Value //instrument.Float64UpDownCounter
+ name string
+ opts []metric.Float64UpDownCounterOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Float64UpDownCounter
}
-var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil)
+var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil)
func (i *sfUpDownCounter) setDelegate(m metric.Meter) {
ctr, err := m.Float64UpDownCounter(i.name, i.opts...)
@@ -244,22 +249,22 @@ func (i *sfUpDownCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
+func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, attrs...)
+ ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...)
}
}
type sfHistogram struct {
- name string
- opts []instrument.Float64Option
+ embedded.Float64Histogram
- delegate atomic.Value //instrument.Float64Histogram
+ name string
+ opts []metric.Float64HistogramOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Float64Histogram
}
-var _ instrument.Float64Histogram = (*sfHistogram)(nil)
+var _ metric.Float64Histogram = (*sfHistogram)(nil)
func (i *sfHistogram) setDelegate(m metric.Meter) {
ctr, err := m.Float64Histogram(i.name, i.opts...)
@@ -270,22 +275,22 @@ func (i *sfHistogram) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) {
+func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Float64Histogram).Record(ctx, x, attrs...)
+ ctr.(metric.Float64Histogram).Record(ctx, x, opts...)
}
}
type siCounter struct {
- name string
- opts []instrument.Int64Option
+ embedded.Int64Counter
- delegate atomic.Value //instrument.Int64Counter
+ name string
+ opts []metric.Int64CounterOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Int64Counter
}
-var _ instrument.Int64Counter = (*siCounter)(nil)
+var _ metric.Int64Counter = (*siCounter)(nil)
func (i *siCounter) setDelegate(m metric.Meter) {
ctr, err := m.Int64Counter(i.name, i.opts...)
@@ -296,22 +301,22 @@ func (i *siCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
+func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Int64Counter).Add(ctx, x, attrs...)
+ ctr.(metric.Int64Counter).Add(ctx, x, opts...)
}
}
type siUpDownCounter struct {
- name string
- opts []instrument.Int64Option
+ embedded.Int64UpDownCounter
- delegate atomic.Value //instrument.Int64UpDownCounter
+ name string
+ opts []metric.Int64UpDownCounterOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Int64UpDownCounter
}
-var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil)
+var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil)
func (i *siUpDownCounter) setDelegate(m metric.Meter) {
ctr, err := m.Int64UpDownCounter(i.name, i.opts...)
@@ -322,22 +327,22 @@ func (i *siUpDownCounter) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
+func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Int64UpDownCounter).Add(ctx, x, attrs...)
+ ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...)
}
}
type siHistogram struct {
- name string
- opts []instrument.Int64Option
+ embedded.Int64Histogram
- delegate atomic.Value //instrument.Int64Histogram
+ name string
+ opts []metric.Int64HistogramOption
- instrument.Synchronous
+ delegate atomic.Value //metric.Int64Histogram
}
-var _ instrument.Int64Histogram = (*siHistogram)(nil)
+var _ metric.Int64Histogram = (*siHistogram)(nil)
func (i *siHistogram) setDelegate(m metric.Meter) {
ctr, err := m.Int64Histogram(i.name, i.opts...)
@@ -348,8 +353,8 @@ func (i *siHistogram) setDelegate(m metric.Meter) {
i.delegate.Store(ctr)
}
-func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
+func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) {
if ctr := i.delegate.Load(); ctr != nil {
- ctr.(instrument.Int64Histogram).Record(ctx, x, attrs...)
+ ctr.(metric.Int64Histogram).Record(ctx, x, opts...)
}
}
diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go
index 8acf63286..a00b99085 100644
--- a/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go
+++ b/vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go
@@ -21,7 +21,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
- "go.opentelemetry.io/otel/metric/instrument"
+ "go.opentelemetry.io/otel/metric/embedded"
)
// meterProvider is a placeholder for a configured SDK MeterProvider.
@@ -29,6 +29,8 @@ import (
// All MeterProvider functionality is forwarded to a delegate once
// configured.
type meterProvider struct {
+ embedded.MeterProvider
+
mtx sync.Mutex
meters map[il]*meter
@@ -100,6 +102,8 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
// All Meter functionality is forwarded to a delegate once configured.
// Otherwise, all functionality is forwarded to a NoopMeter.
type meter struct {
+ embedded.Meter
+
name string
opts []metric.MeterOption
@@ -142,7 +146,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) {
m.registry.Init()
}
-func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) {
+func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64Counter(name, options...)
}
@@ -153,7 +157,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (in
return i, nil
}
-func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
+func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64UpDownCounter(name, options...)
}
@@ -164,7 +168,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio
return i, nil
}
-func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) {
+func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64Histogram(name, options...)
}
@@ -175,7 +179,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (
return i, nil
}
-func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
+func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableCounter(name, options...)
}
@@ -186,7 +190,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O
return i, nil
}
-func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
+func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableUpDownCounter(name, options...)
}
@@ -197,7 +201,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.
return i, nil
}
-func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
+func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableGauge(name, options...)
}
@@ -208,7 +212,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs
return i, nil
}
-func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) {
+func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64Counter(name, options...)
}
@@ -219,7 +223,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option)
return i, nil
}
-func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
+func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64UpDownCounter(name, options...)
}
@@ -230,7 +234,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O
return i, nil
}
-func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) {
+func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64Histogram(name, options...)
}
@@ -241,7 +245,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio
return i, nil
}
-func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
+func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableCounter(name, options...)
}
@@ -252,7 +256,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa
return i, nil
}
-func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
+func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableUpDownCounter(name, options...)
}
@@ -263,7 +267,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen
return i, nil
}
-func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
+func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableGauge(name, options...)
}
@@ -275,7 +279,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6
}
// RegisterCallback captures the function that will be called during Collect.
-func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) {
+func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
insts = unwrapInstruments(insts)
return del.RegisterCallback(f, insts...)
@@ -296,11 +300,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro
}
type wrapped interface {
- unwrap() instrument.Asynchronous
+ unwrap() metric.Observable
}
-func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous {
- out := make([]instrument.Asynchronous, 0, len(instruments))
+func unwrapInstruments(instruments []metric.Observable) []metric.Observable {
+ out := make([]metric.Observable, 0, len(instruments))
for _, inst := range instruments {
if in, ok := inst.(wrapped); ok {
@@ -314,7 +318,9 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async
}
type registration struct {
- instruments []instrument.Asynchronous
+ embedded.Registration
+
+ instruments []metric.Observable
function metric.Callback
unreg func() error
diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go
index f1e917e93..1d60cf57a 100644
--- a/vendor/go.opentelemetry.io/otel/metric/meter.go
+++ b/vendor/go.opentelemetry.io/otel/metric/meter.go
@@ -17,80 +17,91 @@ package metric // import "go.opentelemetry.io/otel/metric"
import (
"context"
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/instrument"
+ "go.opentelemetry.io/otel/metric/embedded"
)
// MeterProvider provides access to named Meter instances, for instrumenting
-// an application or library.
+// an application or package.
//
-// Warning: methods may be added to this interface in minor releases.
+// Warning: Methods may be added to this interface in minor releases. See
+// package documentation on API implementation for information on how to set
+// default behavior for unimplemented methods.
type MeterProvider interface {
- // Meter creates an instance of a `Meter` interface. The instrumentationName
- // must be the name of the library providing instrumentation. This name may
- // be the same as the instrumented code only if that code provides built-in
- // instrumentation. If the instrumentationName is empty, then a
- // implementation defined default name will be used instead.
- Meter(instrumentationName string, opts ...MeterOption) Meter
+ embedded.MeterProvider
+
+ // Meter returns a new Meter with the provided name and configuration.
+ //
+ // A Meter should be scoped at most to a single package. The name needs to
+ // be unique so it does not collide with other names used by
+ // an application, nor other applications. To achieve this, the import path
+ // of the instrumentation package is recommended to be used as name.
+ //
+ // If the name is empty, then an implementation defined default name will
+ // be used instead.
+ Meter(name string, opts ...MeterOption) Meter
}
// Meter provides access to instrument instances for recording metrics.
//
-// Warning: methods may be added to this interface in minor releases.
+// Warning: Methods may be added to this interface in minor releases. See
+// package documentation on API implementation for information on how to set
+// default behavior for unimplemented methods.
type Meter interface {
+ embedded.Meter
+
// Int64Counter returns a new instrument identified by name and configured
// with options. The instrument is used to synchronously record increasing
// int64 measurements during a computational operation.
- Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error)
+ Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
// Int64UpDownCounter returns a new instrument identified by name and
// configured with options. The instrument is used to synchronously record
// int64 measurements during a computational operation.
- Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error)
+ Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
// Int64Histogram returns a new instrument identified by name and
// configured with options. The instrument is used to synchronously record
// the distribution of int64 measurements during a computational operation.
- Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error)
+ Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
// Int64ObservableCounter returns a new instrument identified by name and
// configured with options. The instrument is used to asynchronously record
// increasing int64 measurements once per a measurement collection cycle.
- Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error)
+ Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
// Int64ObservableUpDownCounter returns a new instrument identified by name
// and configured with options. The instrument is used to asynchronously
// record int64 measurements once per a measurement collection cycle.
- Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error)
+ Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
// Int64ObservableGauge returns a new instrument identified by name and
// configured with options. The instrument is used to asynchronously record
// instantaneous int64 measurements once per a measurement collection
// cycle.
- Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error)
+ Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
// Float64Counter returns a new instrument identified by name and
// configured with options. The instrument is used to synchronously record
// increasing float64 measurements during a computational operation.
- Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error)
+ Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
// Float64UpDownCounter returns a new instrument identified by name and
// configured with options. The instrument is used to synchronously record
// float64 measurements during a computational operation.
- Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error)
+ Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
// Float64Histogram returns a new instrument identified by name and
// configured with options. The instrument is used to synchronously record
// the distribution of float64 measurements during a computational
// operation.
- Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error)
+ Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
// Float64ObservableCounter returns a new instrument identified by name and
// configured with options. The instrument is used to asynchronously record
// increasing float64 measurements once per a measurement collection cycle.
- Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error)
+ Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
// Float64ObservableUpDownCounter returns a new instrument identified by
// name and configured with options. The instrument is used to
// asynchronously record float64 measurements once per a measurement
// collection cycle.
- Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error)
+ Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
// Float64ObservableGauge returns a new instrument identified by name and
// configured with options. The instrument is used to asynchronously record
// instantaneous float64 measurements once per a measurement collection
// cycle.
- Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error)
+ Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
// RegisterCallback registers f to be called during the collection of a
// measurement cycle.
@@ -103,12 +114,12 @@ type Meter interface {
//
// If no instruments are passed, f should not be registered nor called
// during collection.
- RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error)
+ RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
}
// Callback is a function registered with a Meter that makes observations for
// the set of instruments it is registered with. The Observer parameter is used
-// to record measurment observations for these instruments.
+// to record measurement observations for these instruments.
//
// The function needs to complete in a finite amount of time and the deadline
// of the passed context is expected to be honored.
@@ -121,16 +132,28 @@ type Meter interface {
type Callback func(context.Context, Observer) error
// Observer records measurements for multiple instruments in a Callback.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// package documentation on API implementation for information on how to set
+// default behavior for unimplemented methods.
type Observer interface {
- // ObserveFloat64 records the float64 value with attributes for obsrv.
- ObserveFloat64(obsrv instrument.Float64Observable, value float64, attributes ...attribute.KeyValue)
- // ObserveInt64 records the int64 value with attributes for obsrv.
- ObserveInt64(obsrv instrument.Int64Observable, value int64, attributes ...attribute.KeyValue)
+ embedded.Observer
+
+ // ObserveFloat64 records the float64 value for obsrv.
+ ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
+ // ObserveInt64 records the int64 value for obsrv.
+ ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
}
// Registration is an token representing the unique registration of a callback
// for a set of instruments with a Meter.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// package documentation on API implementation for information on how to set
+// default behavior for unimplemented methods.
type Registration interface {
+ embedded.Registration
+
// Unregister removes the callback registration from a Meter.
//
// This method needs to be idempotent and concurrent safe.
diff --git a/vendor/go.opentelemetry.io/otel/metric/noop.go b/vendor/go.opentelemetry.io/otel/metric/noop.go
deleted file mode 100644
index c586627ae..000000000
--- a/vendor/go.opentelemetry.io/otel/metric/noop.go
+++ /dev/null
@@ -1,198 +0,0 @@
-// 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.
-
-package metric // import "go.opentelemetry.io/otel/metric"
-
-import (
- "context"
-
- "go.opentelemetry.io/otel/attribute"
- "go.opentelemetry.io/otel/metric/instrument"
-)
-
-// NewNoopMeterProvider creates a MeterProvider that does not record any metrics.
-func NewNoopMeterProvider() MeterProvider {
- return noopMeterProvider{}
-}
-
-type noopMeterProvider struct{}
-
-func (noopMeterProvider) Meter(string, ...MeterOption) Meter {
- return noopMeter{}
-}
-
-// NewNoopMeter creates a Meter that does not record any metrics.
-func NewNoopMeter() Meter {
- return noopMeter{}
-}
-
-type noopMeter struct{}
-
-func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) {
- return nonrecordingSyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
- return nonrecordingSyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) {
- return nonrecordingSyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
- return nonrecordingAsyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
- return nonrecordingAsyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
- return nonrecordingAsyncInt64Instrument{}, nil
-}
-
-func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) {
- return nonrecordingSyncFloat64Instrument{}, nil
-}
-
-func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
- return nonrecordingSyncFloat64Instrument{}, nil
-}
-
-func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) {
- return nonrecordingSyncFloat64Instrument{}, nil
-}
-
-func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
- return nonrecordingAsyncFloat64Instrument{}, nil
-}
-
-func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
- return nonrecordingAsyncFloat64Instrument{}, nil
-}
-
-func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
- return nonrecordingAsyncFloat64Instrument{}, nil
-}
-
-// RegisterCallback creates a register callback that does not record any metrics.
-func (noopMeter) RegisterCallback(Callback, ...instrument.Asynchronous) (Registration, error) {
- return noopReg{}, nil
-}
-
-type noopReg struct{}
-
-func (noopReg) Unregister() error { return nil }
-
-type nonrecordingAsyncFloat64Instrument struct {
- instrument.Float64Observable
-}
-
-var (
- _ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{}
- _ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{}
- _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{}
-)
-
-func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
- return n, nil
-}
-
-type nonrecordingAsyncInt64Instrument struct {
- instrument.Int64Observable
-}
-
-var (
- _ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{}
- _ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{}
- _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{}
-)
-
-func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
- return n, nil
-}
-
-type nonrecordingSyncFloat64Instrument struct {
- instrument.Synchronous
-}
-
-var (
- _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{}
- _ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{}
- _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{}
-)
-
-func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) {
- return n, nil
-}
-
-func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) {
- return n, nil
-}
-
-func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {
-
-}
-
-func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {
-
-}
-
-type nonrecordingSyncInt64Instrument struct {
- instrument.Synchronous
-}
-
-var (
- _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{}
- _ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{}
- _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{}
-)
-
-func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) {
- return n, nil
-}
-
-func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
- return n, nil
-}
-
-func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) {
- return n, nil
-}
-
-func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {
-}
-func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {
-}
diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
new file mode 100644
index 000000000..0b2023c35
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
@@ -0,0 +1,162 @@
+// 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.
+
+package metric // import "go.opentelemetry.io/otel/metric"
+
+import (
+ "context"
+
+ "go.opentelemetry.io/otel/metric/embedded"
+)
+
+// Float64Counter is an instrument that records increasing float64 values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64Counter interface {
+ embedded.Float64Counter
+
+ // Add records a change to the counter.
+ Add(ctx context.Context, incr float64, opts ...AddOption)
+}
+
+// Float64CounterConfig contains options for synchronous counter instruments that
+// record int64 values.
+type Float64CounterConfig struct {
+ description string
+ unit string
+}
+
+// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts
+// applied.
+func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig {
+ var config Float64CounterConfig
+ for _, o := range opts {
+ config = o.applyFloat64Counter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64CounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64CounterConfig) Unit() string {
+ return c.unit
+}
+
+// Float64CounterOption applies options to a [Float64CounterConfig]. See
+// [Option] for other options that can be used as a Float64CounterOption.
+type Float64CounterOption interface {
+ applyFloat64Counter(Float64CounterConfig) Float64CounterConfig
+}
+
+// Float64UpDownCounter is an instrument that records increasing or decreasing
+// float64 values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64UpDownCounter interface {
+ embedded.Float64UpDownCounter
+
+ // Add records a change to the counter.
+ Add(ctx context.Context, incr float64, opts ...AddOption)
+}
+
+// Float64UpDownCounterConfig contains options for synchronous counter
+// instruments that record int64 values.
+type Float64UpDownCounterConfig struct {
+ description string
+ unit string
+}
+
+// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig]
+// with all opts applied.
+func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig {
+ var config Float64UpDownCounterConfig
+ for _, o := range opts {
+ config = o.applyFloat64UpDownCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64UpDownCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64UpDownCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Float64UpDownCounterOption applies options to a
+// [Float64UpDownCounterConfig]. See [Option] for other options that can be
+// used as a Float64UpDownCounterOption.
+type Float64UpDownCounterOption interface {
+ applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig
+}
+
+// Float64Histogram is an instrument that records a distribution of float64
+// values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Float64Histogram interface {
+ embedded.Float64Histogram
+
+ // Record adds an additional value to the distribution.
+ Record(ctx context.Context, incr float64, opts ...RecordOption)
+}
+
+// Float64HistogramConfig contains options for synchronous counter instruments
+// that record int64 values.
+type Float64HistogramConfig struct {
+ description string
+ unit string
+}
+
+// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all
+// opts applied.
+func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig {
+ var config Float64HistogramConfig
+ for _, o := range opts {
+ config = o.applyFloat64Histogram(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Float64HistogramConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Float64HistogramConfig) Unit() string {
+ return c.unit
+}
+
+// Float64HistogramOption applies options to a [Float64HistogramConfig]. See
+// [Option] for other options that can be used as a Float64HistogramOption.
+type Float64HistogramOption interface {
+ applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go
new file mode 100644
index 000000000..9a1a9dba8
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go
@@ -0,0 +1,162 @@
+// 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.
+
+package metric // import "go.opentelemetry.io/otel/metric"
+
+import (
+ "context"
+
+ "go.opentelemetry.io/otel/metric/embedded"
+)
+
+// Int64Counter is an instrument that records increasing int64 values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64Counter interface {
+ embedded.Int64Counter
+
+ // Add records a change to the counter.
+ Add(ctx context.Context, incr int64, opts ...AddOption)
+}
+
+// Int64CounterConfig contains options for synchronous counter instruments that
+// record int64 values.
+type Int64CounterConfig struct {
+ description string
+ unit string
+}
+
+// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts
+// applied.
+func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig {
+ var config Int64CounterConfig
+ for _, o := range opts {
+ config = o.applyInt64Counter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64CounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64CounterConfig) Unit() string {
+ return c.unit
+}
+
+// Int64CounterOption applies options to a [Int64CounterConfig]. See [Option]
+// for other options that can be used as an Int64CounterOption.
+type Int64CounterOption interface {
+ applyInt64Counter(Int64CounterConfig) Int64CounterConfig
+}
+
+// Int64UpDownCounter is an instrument that records increasing or decreasing
+// int64 values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64UpDownCounter interface {
+ embedded.Int64UpDownCounter
+
+ // Add records a change to the counter.
+ Add(ctx context.Context, incr int64, opts ...AddOption)
+}
+
+// Int64UpDownCounterConfig contains options for synchronous counter
+// instruments that record int64 values.
+type Int64UpDownCounterConfig struct {
+ description string
+ unit string
+}
+
+// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with
+// all opts applied.
+func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig {
+ var config Int64UpDownCounterConfig
+ for _, o := range opts {
+ config = o.applyInt64UpDownCounter(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64UpDownCounterConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64UpDownCounterConfig) Unit() string {
+ return c.unit
+}
+
+// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig].
+// See [Option] for other options that can be used as an
+// Int64UpDownCounterOption.
+type Int64UpDownCounterOption interface {
+ applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig
+}
+
+// Int64Histogram is an instrument that records a distribution of int64
+// values.
+//
+// Warning: Methods may be added to this interface in minor releases. See
+// [go.opentelemetry.io/otel/metric] package documentation on API
+// implementation for information on how to set default behavior for
+// unimplemented methods.
+type Int64Histogram interface {
+ embedded.Int64Histogram
+
+ // Record adds an additional value to the distribution.
+ Record(ctx context.Context, incr int64, opts ...RecordOption)
+}
+
+// Int64HistogramConfig contains options for synchronous counter instruments
+// that record int64 values.
+type Int64HistogramConfig struct {
+ description string
+ unit string
+}
+
+// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts
+// applied.
+func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig {
+ var config Int64HistogramConfig
+ for _, o := range opts {
+ config = o.applyInt64Histogram(config)
+ }
+ return config
+}
+
+// Description returns the configured description.
+func (c Int64HistogramConfig) Description() string {
+ return c.description
+}
+
+// Unit returns the configured unit.
+func (c Int64HistogramConfig) Unit() string {
+ return c.unit
+}
+
+// Int64HistogramOption applies options to a [Int64HistogramConfig]. See
+// [Option] for other options that can be used as an Int64HistogramOption.
+type Int64HistogramOption interface {
+ applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig
+}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
index 5e94b8ae5..59dcfab25 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
@@ -70,8 +70,8 @@ const (
// returned.
func firstInt(defaultValue int, keys ...string) int {
for _, key := range keys {
- value, ok := os.LookupEnv(key)
- if !ok {
+ value := os.Getenv(key)
+ if value == "" {
continue
}
@@ -88,10 +88,10 @@ func firstInt(defaultValue int, keys ...string) int {
}
// IntEnvOr returns the int value of the environment variable with name key if
-// it exists and the value is an int. Otherwise, defaultValue is returned.
+// it exists, it is not empty, and the value is an int. Otherwise, defaultValue is returned.
func IntEnvOr(key string, defaultValue int) int {
- value, ok := os.LookupEnv(key)
- if !ok {
+ value := os.Getenv(key)
+ if value == "" {
return defaultValue
}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go b/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
index 84a02306e..dfeaaa8ca 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
@@ -14,16 +14,7 @@
package internal // import "go.opentelemetry.io/otel/sdk/internal"
-import (
- "fmt"
- "time"
-
- "go.opentelemetry.io/otel"
-)
-
-// UserAgent is the user agent to be added to the outgoing
-// requests from the exporters.
-var UserAgent = fmt.Sprintf("opentelemetry-go/%s", otel.Version())
+import "time"
// MonotonicEndTime returns the end time at present
// but offset from start, monotonically.
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
index c1d220408..324dd4baf 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
@@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
+ "strings"
)
var (
@@ -45,28 +46,65 @@ type Detector interface {
// Detect calls all input detectors sequentially and merges each result with the previous one.
// It returns the merged error too.
func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
- var autoDetectedRes *Resource
- var errInfo []string
+ r := new(Resource)
+ return r, detect(ctx, r, detectors)
+}
+
+// detect runs all detectors using ctx and merges the result into res. This
+// assumes res is allocated and not nil, it will panic otherwise.
+func detect(ctx context.Context, res *Resource, detectors []Detector) error {
+ var (
+ r *Resource
+ errs detectErrs
+ err error
+ )
+
for _, detector := range detectors {
if detector == nil {
continue
}
- res, err := detector.Detect(ctx)
+ r, err = detector.Detect(ctx)
if err != nil {
- errInfo = append(errInfo, err.Error())
+ errs = append(errs, err)
if !errors.Is(err, ErrPartialResource) {
continue
}
}
- autoDetectedRes, err = Merge(autoDetectedRes, res)
+ r, err = Merge(res, r)
if err != nil {
- errInfo = append(errInfo, err.Error())
+ errs = append(errs, err)
}
+ *res = *r
}
- var aggregatedError error
- if len(errInfo) > 0 {
- aggregatedError = fmt.Errorf("detecting resources: %s", errInfo)
+ if len(errs) == 0 {
+ return nil
+ }
+ return errs
+}
+
+type detectErrs []error
+
+func (e detectErrs) Error() string {
+ errStr := make([]string, len(e))
+ for i, err := range e {
+ errStr[i] = fmt.Sprintf("* %s", err)
}
- return autoDetectedRes, aggregatedError
+
+ format := "%d errors occurred detecting resource:\n\t%s"
+ return fmt.Sprintf(format, len(e), strings.Join(errStr, "\n\t"))
+}
+
+func (e detectErrs) Unwrap() error {
+ switch len(e) {
+ case 0:
+ return nil
+ case 1:
+ return e[0]
+ }
+ return e[1:]
+}
+
+func (e detectErrs) Is(target error) bool {
+ return len(e) != 0 && errors.Is(e[0], target)
}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
index aa0f942f4..72320ca51 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
@@ -20,8 +20,8 @@ import (
"os"
"path/filepath"
- "go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
+ "go.opentelemetry.io/otel/sdk"
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
)
@@ -62,7 +62,7 @@ func (telemetrySDK) Detect(context.Context) (*Resource, error) {
semconv.SchemaURL,
semconv.TelemetrySDKName("opentelemetry"),
semconv.TelemetrySDKLanguageGo,
- semconv.TelemetrySDKVersion(otel.Version()),
+ semconv.TelemetrySDKVersion(sdk.Version()),
), nil
}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go
index f9a2a2999..f263919f6 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go
@@ -71,6 +71,11 @@ func WithHost() Option {
return WithDetectors(host{})
}
+// WithHostID adds host ID information to the configured resource.
+func WithHostID() Option {
+ return WithDetectors(hostIDDetector{})
+}
+
// WithTelemetrySDK adds TelemetrySDK version info to the configured resource.
func WithTelemetrySDK() Option {
return WithDetectors(telemetrySDK{})
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
new file mode 100644
index 000000000..b8e934d4f
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
@@ -0,0 +1,120 @@
+// 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.
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+import (
+ "context"
+ "errors"
+ "strings"
+
+ semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
+)
+
+type hostIDProvider func() (string, error)
+
+var defaultHostIDProvider hostIDProvider = platformHostIDReader.read
+
+var hostID = defaultHostIDProvider
+
+type hostIDReader interface {
+ read() (string, error)
+}
+
+type fileReader func(string) (string, error)
+
+type commandExecutor func(string, ...string) (string, error)
+
+// hostIDReaderBSD implements hostIDReader.
+type hostIDReaderBSD struct {
+ execCommand commandExecutor
+ readFile fileReader
+}
+
+// read attempts to read the machine-id from /etc/hostid. If not found it will
+// execute `kenv -q smbios.system.uuid`. If neither location yields an id an
+// error will be returned.
+func (r *hostIDReaderBSD) read() (string, error) {
+ if result, err := r.readFile("/etc/hostid"); err == nil {
+ return strings.TrimSpace(result), nil
+ }
+
+ if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil {
+ return strings.TrimSpace(result), nil
+ }
+
+ return "", errors.New("host id not found in: /etc/hostid or kenv")
+}
+
+// hostIDReaderDarwin implements hostIDReader.
+type hostIDReaderDarwin struct {
+ execCommand commandExecutor
+}
+
+// read executes `ioreg -rd1 -c "IOPlatformExpertDevice"` and parses host id
+// from the IOPlatformUUID line. If the command fails or the uuid cannot be
+// parsed an error will be returned.
+func (r *hostIDReaderDarwin) read() (string, error) {
+ result, err := r.execCommand("ioreg", "-rd1", "-c", "IOPlatformExpertDevice")
+ if err != nil {
+ return "", err
+ }
+
+ lines := strings.Split(result, "\n")
+ for _, line := range lines {
+ if strings.Contains(line, "IOPlatformUUID") {
+ parts := strings.Split(line, " = ")
+ if len(parts) == 2 {
+ return strings.Trim(parts[1], "\""), nil
+ }
+ break
+ }
+ }
+
+ return "", errors.New("could not parse IOPlatformUUID")
+}
+
+type hostIDReaderLinux struct {
+ readFile fileReader
+}
+
+// read attempts to read the machine-id from /etc/machine-id followed by
+// /var/lib/dbus/machine-id. If neither location yields an ID an error will
+// be returned.
+func (r *hostIDReaderLinux) read() (string, error) {
+ if result, err := r.readFile("/etc/machine-id"); err == nil {
+ return strings.TrimSpace(result), nil
+ }
+
+ if result, err := r.readFile("/var/lib/dbus/machine-id"); err == nil {
+ return strings.TrimSpace(result), nil
+ }
+
+ return "", errors.New("host id not found in: /etc/machine-id or /var/lib/dbus/machine-id")
+}
+
+type hostIDDetector struct{}
+
+// Detect returns a *Resource containing the platform specific host id.
+func (hostIDDetector) Detect(ctx context.Context) (*Resource, error) {
+ hostID, err := hostID()
+ if err != nil {
+ return nil, err
+ }
+
+ return NewWithAttributes(
+ semconv.SchemaURL,
+ semconv.HostID(hostID),
+ ), nil
+}
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/doc.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
index 3b1a541bc..1778bbacf 100644
--- a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/doc.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
@@ -12,10 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package otelgin instruments the github.com/gin-gonic/gin package.
-//
-// Currently there are two ways the code can be instrumented. One is
-// instrumenting the routing of a received message (the Middleware function)
-// and instrumenting the response generation through template evaluation (the
-// HTML function).
-package otelgin // import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
+//go:build dragonfly || freebsd || netbsd || openbsd || solaris
+// +build dragonfly freebsd netbsd openbsd solaris
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+var platformHostIDReader hostIDReader = &hostIDReaderBSD{
+ execCommand: execCommand,
+ readFile: readFile,
+}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
new file mode 100644
index 000000000..ba41409b2
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
@@ -0,0 +1,19 @@
+// 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.
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+var platformHostIDReader hostIDReader = &hostIDReaderDarwin{
+ execCommand: execCommand,
+}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
new file mode 100644
index 000000000..0080fc6b6
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
@@ -0,0 +1,29 @@
+// 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.
+
+//go:build bsd || darwin
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+import "os/exec"
+
+func execCommand(name string, arg ...string) (string, error) {
+ cmd := exec.Command(name, arg...)
+ b, err := cmd.Output()
+ if err != nil {
+ return "", err
+ }
+
+ return string(b), nil
+}
diff --git a/vendor/go.opentelemetry.io/otel/metric/unit/unit.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
index 647d77302..410579b8f 100644
--- a/vendor/go.opentelemetry.io/otel/metric/unit/unit.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
@@ -12,14 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package unit // import "go.opentelemetry.io/otel/metric/unit"
+//go:build linux
+// +build linux
-// Unit is a determinate standard quantity of measurement.
-type Unit string
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
-// Units defined by OpenTelemetry.
-const (
- Dimensionless Unit = "1"
- Bytes Unit = "By"
- Milliseconds Unit = "ms"
-)
+var platformHostIDReader hostIDReader = &hostIDReaderLinux{
+ readFile: readFile,
+}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
new file mode 100644
index 000000000..df4dc92c1
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
@@ -0,0 +1,28 @@
+// 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.
+
+//go:build bsd || linux
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+import "os"
+
+func readFile(filename string) (string, error) {
+ b, err := os.ReadFile(filename)
+ if err != nil {
+ return "", nil
+ }
+
+ return string(b), nil
+}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
new file mode 100644
index 000000000..89df9d688
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
@@ -0,0 +1,36 @@
+// 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.
+
+// +build !darwin
+// +build !dragonfly
+// +build !freebsd
+// +build !linux
+// +build !netbsd
+// +build !openbsd
+// +build !solaris
+// +build !windows
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+// hostIDReaderUnsupported is a placeholder implementation for operating systems
+// for which this project currently doesn't support host.id
+// attribute detection. See build tags declaration early on this file
+// for a list of unsupported OSes.
+type hostIDReaderUnsupported struct{}
+
+func (*hostIDReaderUnsupported) read() (string, error) {
+ return "<unknown>", nil
+}
+
+var platformHostIDReader hostIDReader = &hostIDReaderUnsupported{}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
new file mode 100644
index 000000000..5b431c6ee
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
@@ -0,0 +1,48 @@
+// 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.
+
+//go:build windows
+// +build windows
+
+package resource // import "go.opentelemetry.io/otel/sdk/resource"
+
+import (
+ "golang.org/x/sys/windows/registry"
+)
+
+// implements hostIDReader
+type hostIDReaderWindows struct{}
+
+// read reads MachineGuid from the windows registry key:
+// SOFTWARE\Microsoft\Cryptography
+func (*hostIDReaderWindows) read() (string, error) {
+ k, err := registry.OpenKey(
+ registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`,
+ registry.QUERY_VALUE|registry.WOW64_64KEY,
+ )
+
+ if err != nil {
+ return "", err
+ }
+ defer k.Close()
+
+ guid, _, err := k.GetStringValue("MachineGuid")
+ if err != nil {
+ return "", err
+ }
+
+ return guid, nil
+}
+
+var platformHostIDReader hostIDReader = &hostIDReaderWindows{}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
index c425ff05d..49958a9a6 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
@@ -17,7 +17,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource"
import (
"context"
"errors"
- "fmt"
"sync"
"go.opentelemetry.io/otel"
@@ -51,17 +50,8 @@ func New(ctx context.Context, opts ...Option) (*Resource, error) {
cfg = opt.apply(cfg)
}
- resource, err := Detect(ctx, cfg.detectors...)
-
- var err2 error
- resource, err2 = Merge(resource, &Resource{schemaURL: cfg.schemaURL})
- if err == nil {
- err = err2
- } else if err2 != nil {
- err = fmt.Errorf("detecting resources: %s", []string{err.Error(), err2.Error()})
- }
-
- return resource, err
+ r := &Resource{schemaURL: cfg.schemaURL}
+ return r, detect(ctx, r, cfg.detectors)
}
// NewWithAttributes creates a resource from attrs and associates the resource with a
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
index a2d7db490..43d5b0423 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go
@@ -91,7 +91,7 @@ var _ SpanProcessor = (*batchSpanProcessor)(nil)
// NewBatchSpanProcessor creates a new SpanProcessor that will send completed
// span batches to the exporter with the supplied options.
//
-// If the exporter is nil, the span processor will preform no action.
+// If the exporter is nil, the span processor will perform no action.
func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor {
maxQueueSize := env.BatchSpanProcessorMaxQueueSize(DefaultMaxQueueSize)
maxExportBatchSize := env.BatchSpanProcessorMaxExportBatchSize(DefaultMaxExportBatchSize)
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
index 201c17817..0a018c14d 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
@@ -75,8 +75,9 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} {
type TracerProvider struct {
mu sync.Mutex
namedTracer map[instrumentation.Scope]*tracer
- spanProcessors atomic.Value
- isShutdown bool
+ spanProcessors atomic.Pointer[spanProcessorStates]
+
+ isShutdown atomic.Bool
// These fields are not protected by the lock mu. They are assumed to be
// immutable after creation of the TracerProvider.
@@ -119,11 +120,11 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider {
}
global.Info("TracerProvider created", "config", o)
- spss := spanProcessorStates{}
+ spss := make(spanProcessorStates, 0, len(o.processors))
for _, sp := range o.processors {
spss = append(spss, newSpanProcessorState(sp))
}
- tp.spanProcessors.Store(spss)
+ tp.spanProcessors.Store(&spss)
return tp
}
@@ -136,10 +137,11 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider {
//
// This method is safe to be called concurrently.
func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer {
+ // This check happens before the mutex is acquired to avoid deadlocking if Tracer() is called from within Shutdown().
+ if p.isShutdown.Load() {
+ return trace.NewNoopTracerProvider().Tracer(name, opts...)
+ }
c := trace.NewTracerConfig(opts...)
-
- p.mu.Lock()
- defer p.mu.Unlock()
if name == "" {
name = defaultTracerName
}
@@ -148,44 +150,74 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
Version: c.InstrumentationVersion(),
SchemaURL: c.SchemaURL(),
}
- t, ok := p.namedTracer[is]
- if !ok {
- t = &tracer{
- provider: p,
- instrumentationScope: is,
+
+ t, ok := func() (trace.Tracer, bool) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+ // Must check the flag after acquiring the mutex to avoid returning a valid tracer if Shutdown() ran
+ // after the first check above but before we acquired the mutex.
+ if p.isShutdown.Load() {
+ return trace.NewNoopTracerProvider().Tracer(name, opts...), true
+ }
+ t, ok := p.namedTracer[is]
+ if !ok {
+ t = &tracer{
+ provider: p,
+ instrumentationScope: is,
+ }
+ p.namedTracer[is] = t
}
- p.namedTracer[is] = t
- global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL())
+ return t, ok
+ }()
+ if !ok {
+ // This code is outside the mutex to not hold the lock while calling third party logging code:
+ // - That code may do slow things like I/O, which would prolong the duration the lock is held,
+ // slowing down all tracing consumers.
+ // - Logging code may be instrumented with tracing and deadlock because it could try
+ // acquiring the same non-reentrant mutex.
+ global.Info("Tracer created", "name", name, "version", is.Version, "schemaURL", is.SchemaURL)
}
return t
}
// RegisterSpanProcessor adds the given SpanProcessor to the list of SpanProcessors.
func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) {
+ // This check prevents calls during a shutdown.
+ if p.isShutdown.Load() {
+ return
+ }
p.mu.Lock()
defer p.mu.Unlock()
- if p.isShutdown {
+ // This check prevents calls after a shutdown.
+ if p.isShutdown.Load() {
return
}
- newSPS := spanProcessorStates{}
- newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...)
+
+ current := p.getSpanProcessors()
+ newSPS := make(spanProcessorStates, 0, len(current)+1)
+ newSPS = append(newSPS, current...)
newSPS = append(newSPS, newSpanProcessorState(sp))
- p.spanProcessors.Store(newSPS)
+ p.spanProcessors.Store(&newSPS)
}
// UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors.
func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) {
+ // This check prevents calls during a shutdown.
+ if p.isShutdown.Load() {
+ return
+ }
p.mu.Lock()
defer p.mu.Unlock()
- if p.isShutdown {
+ // This check prevents calls after a shutdown.
+ if p.isShutdown.Load() {
return
}
- old := p.spanProcessors.Load().(spanProcessorStates)
+ old := p.getSpanProcessors()
if len(old) == 0 {
return
}
- spss := spanProcessorStates{}
- spss = append(spss, old...)
+ spss := make(spanProcessorStates, len(old))
+ copy(spss, old)
// stop the span processor if it is started and remove it from the list
var stopOnce *spanProcessorState
@@ -209,13 +241,13 @@ func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) {
spss[len(spss)-1] = nil
spss = spss[:len(spss)-1]
- p.spanProcessors.Store(spss)
+ p.spanProcessors.Store(&spss)
}
// ForceFlush immediately exports all spans that have not yet been exported for
// all the registered span processors.
func (p *TracerProvider) ForceFlush(ctx context.Context) error {
- spss := p.spanProcessors.Load().(spanProcessorStates)
+ spss := p.getSpanProcessors()
if len(spss) == 0 {
return nil
}
@@ -236,18 +268,21 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error {
// Shutdown shuts down TracerProvider. All registered span processors are shut down
// in the order they were registered and any held computational resources are released.
+// After Shutdown is called, all methods are no-ops.
func (p *TracerProvider) Shutdown(ctx context.Context) error {
- spss := p.spanProcessors.Load().(spanProcessorStates)
- if len(spss) == 0 {
+ // This check prevents deadlocks in case of recursive shutdown.
+ if p.isShutdown.Load() {
return nil
}
-
p.mu.Lock()
defer p.mu.Unlock()
- p.isShutdown = true
+ // This check prevents calls after a shutdown has already been done concurrently.
+ if !p.isShutdown.CompareAndSwap(false, true) { // did toggle?
+ return nil
+ }
var retErr error
- for _, sps := range spss {
+ for _, sps := range p.getSpanProcessors() {
select {
case <-ctx.Done():
return ctx.Err()
@@ -267,10 +302,14 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error {
}
}
}
- p.spanProcessors.Store(spanProcessorStates{})
+ p.spanProcessors.Store(&spanProcessorStates{})
return retErr
}
+func (p *TracerProvider) getSpanProcessors() spanProcessorStates {
+ return *(p.spanProcessors.Load())
+}
+
// TracerProviderOption configures a TracerProvider.
type TracerProviderOption interface {
apply(tracerProviderConfig) tracerProviderConfig
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
index e8530a959..f8770fff7 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go
@@ -19,12 +19,13 @@ import (
"sync"
"go.opentelemetry.io/otel"
+ "go.opentelemetry.io/otel/internal/global"
)
// simpleSpanProcessor is a SpanProcessor that synchronously sends all
// completed Spans to a trace.Exporter immediately.
type simpleSpanProcessor struct {
- exporterMu sync.RWMutex
+ exporterMu sync.Mutex
exporter SpanExporter
stopOnce sync.Once
}
@@ -43,6 +44,8 @@ func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor {
ssp := &simpleSpanProcessor{
exporter: exporter,
}
+ global.Warn("SimpleSpanProcessor is not recommended for production use, consider using BatchSpanProcessor instead.")
+
return ssp
}
@@ -51,8 +54,8 @@ func (ssp *simpleSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
// OnEnd immediately exports a ReadOnlySpan.
func (ssp *simpleSpanProcessor) OnEnd(s ReadOnlySpan) {
- ssp.exporterMu.RLock()
- defer ssp.exporterMu.RUnlock()
+ ssp.exporterMu.Lock()
+ defer ssp.exporterMu.Unlock()
if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() {
if err := ssp.exporter.ExportSpans(context.Background(), []ReadOnlySpan{s}); err != nil {
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go
index 9fb483a99..4fcca26e0 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go
@@ -302,7 +302,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) {
// most a length of limit. Each string slice value is truncated in this fashion
// (the slice length itself is unaffected).
//
-// No truncation is perfromed for a negative limit.
+// No truncation is performed for a negative limit.
func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue {
if limit < 0 {
return attr
@@ -410,7 +410,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) {
}
s.mu.Unlock()
- sps := s.tracer.provider.spanProcessors.Load().(spanProcessorStates)
+ sps := s.tracer.provider.getSpanProcessors()
if len(sps) == 0 {
return
}
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
index 9fb3d6eac..c9bd52f7a 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go
@@ -38,7 +38,7 @@ type SpanExporter interface {
// must never be done outside of a new major release.
// Shutdown notifies the exporter of a pending halt to operations. The
- // exporter is expected to preform any cleanup or synchronization it
+ // exporter is expected to perform any cleanup or synchronization it
// requires while honoring all timeouts and cancellations contained in
// the passed context.
Shutdown(ctx context.Context) error
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
index e6ae19352..9c53657a7 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go
@@ -62,11 +62,11 @@ type SpanProcessor interface {
type spanProcessorState struct {
sp SpanProcessor
- state *sync.Once
+ state sync.Once
}
func newSpanProcessorState(sp SpanProcessor) *spanProcessorState {
- return &spanProcessorState{sp: sp, state: &sync.Once{}}
+ return &spanProcessorState{sp: sp}
}
type spanProcessorStates []*spanProcessorState
diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
index f17d924b8..85a71227f 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go
@@ -51,7 +51,7 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanS
s := tr.newSpan(ctx, name, &config)
if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() {
- sps := tr.provider.spanProcessors.Load().(spanProcessorStates)
+ sps := tr.provider.getSpanProcessors()
for _, sp := range sps {
sp.sp.OnStart(ctx, rw)
}
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go
index b31bb092f..2adddad86 100644
--- a/vendor/go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin/version.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/version.go
@@ -12,15 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package otelgin // import "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
+package sdk // import "go.opentelemetry.io/otel/sdk"
-// Version is the current release version of the gin instrumentation.
+// Version is the current release version of the OpenTelemetry SDK in use.
func Version() string {
- return "0.40.0"
- // This string is updated by the pre_release.sh script during release
-}
-
-// SemVersion is the semantic version to be supplied to tracer/meter creation.
-func SemVersion() string {
- return "semver:" + Version()
+ return "1.15.1"
}
diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go
index c60b2a6bb..fc43808fe 100644
--- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go
+++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package httpconv provides OpenTelemetry semantic convetions for the net/http
-// package from the standard library.
+// Package httpconv provides OpenTelemetry HTTP semantic conventions for
+// tracing telemetry.
package httpconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv"
import (
@@ -58,9 +58,10 @@ var (
}
)
-// ClientResponse returns attributes for an HTTP response received by a client
-// from a server. It will return the following attributes if the related values
-// are defined in resp: "http.status.code", "http.response_content_length".
+// ClientResponse returns trace attributes for an HTTP response received by a
+// client from a server. It will return the following attributes if the related
+// values are defined in resp: "http.status.code",
+// "http.response_content_length".
//
// This does not add all OpenTelemetry required attributes for an HTTP event,
// it assumes ClientRequest was used to create the span with a complete set of
@@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue {
return hc.ClientResponse(resp)
}
-// ClientRequest returns attributes for an HTTP request made by a client. The
-// following attributes are always returned: "http.url", "http.flavor",
+// ClientRequest returns trace attributes for an HTTP request made by a client.
+// The following attributes are always returned: "http.url", "http.flavor",
// "http.method", "net.peer.name". The following attributes are returned if the
// related values are defined in req: "net.peer.port", "http.user_agent",
// "http.request_content_length", "enduser.id".
@@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) {
return hc.ClientStatus(code)
}
-// ServerRequest returns attributes for an HTTP request received by a server.
+// ServerRequest returns trace attributes for an HTTP request received by a
+// server.
//
// The server must be the primary server name if it is known. For example this
// would be the ServerName directive
diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go
index 73950f207..7cf6c7f3e 100644
--- a/vendor/go.opentelemetry.io/otel/trace/noop.go
+++ b/vendor/go.opentelemetry.io/otel/trace/noop.go
@@ -37,7 +37,7 @@ func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer {
return noopTracer{}
}
-// noopTracer is an implementation of Tracer that preforms no operations.
+// noopTracer is an implementation of Tracer that performs no operations.
type noopTracer struct{}
var _ Tracer = noopTracer{}
@@ -53,7 +53,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption
return ContextWithSpan(ctx, span), span
}
-// noopSpan is an implementation of Span that preforms no operations.
+// noopSpan is an implementation of Span that performs no operations.
type noopSpan struct{}
var _ Span = noopSpan{}
diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go
index 0e8e5e023..6c7fe114b 100644
--- a/vendor/go.opentelemetry.io/otel/version.go
+++ b/vendor/go.opentelemetry.io/otel/version.go
@@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel"
// Version is the current release version of OpenTelemetry in use.
func Version() string {
- return "1.14.0"
+ return "1.15.1"
}
diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml
index 40df1fae4..b49ec1029 100644
--- a/vendor/go.opentelemetry.io/otel/versions.yaml
+++ b/vendor/go.opentelemetry.io/otel/versions.yaml
@@ -14,7 +14,7 @@
module-sets:
stable-v1:
- version: v1.14.0
+ version: v1.15.1
modules:
- go.opentelemetry.io/otel
- go.opentelemetry.io/otel/bridge/opentracing
@@ -26,16 +26,16 @@ module-sets:
- go.opentelemetry.io/otel/example/passthrough
- go.opentelemetry.io/otel/example/zipkin
- go.opentelemetry.io/otel/exporters/jaeger
- - go.opentelemetry.io/otel/exporters/zipkin
+ - go.opentelemetry.io/otel/exporters/otlp/internal/retry
- go.opentelemetry.io/otel/exporters/otlp/otlptrace
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
- - go.opentelemetry.io/otel/exporters/otlp/internal/retry
- go.opentelemetry.io/otel/exporters/stdout/stdouttrace
- - go.opentelemetry.io/otel/trace
+ - go.opentelemetry.io/otel/exporters/zipkin
- go.opentelemetry.io/otel/sdk
+ - go.opentelemetry.io/otel/trace
experimental-metrics:
- version: v0.37.0
+ version: v0.38.1
modules:
- go.opentelemetry.io/otel/example/opencensus
- go.opentelemetry.io/otel/example/prometheus