From abdc792c4634846e63399410dd85b6e8ff7f5e1b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 01:24:21 +0000 Subject: [PATCH] Update module go.opentelemetry.io/collector/extension/zpagesextension to v0.94.1 --- go.mod | 53 +- go.sum | 54 + .../exporter/prometheus/.gitignore | 1 - .../exporter/prometheus/.golangci.yml | 123 -- .../exporter/prometheus/.travis.yml | 17 - .../exporter/prometheus/LICENSE | 201 --- .../exporter/prometheus/Makefile | 50 - .../exporter/prometheus/README.md | 14 - .../exporter/prometheus/prometheus.go | 303 ---- .../exporter/prometheus/sanitize.go | 38 - .../xds/go/udpa/annotations/migrate.pb.go | 7 +- .../xds/go/udpa/annotations/security.pb.go | 7 +- .../xds/go/udpa/annotations/sensitive.pb.go | 7 +- .../cncf/xds/go/udpa/annotations/status.pb.go | 7 +- .../xds/go/udpa/annotations/versioning.pb.go | 7 +- .../xds/go/xds/annotations/v3/migrate.pb.go | 7 +- .../xds/go/xds/annotations/v3/security.pb.go | 7 +- .../xds/go/xds/annotations/v3/sensitive.pb.go | 7 +- .../xds/go/xds/annotations/v3/status.pb.go | 7 +- .../go/xds/annotations/v3/versioning.pb.go | 7 +- .../cncf/xds/go/xds/core/v3/authority.pb.go | 7 +- .../cncf/xds/go/xds/core/v3/cidr.pb.go | 7 +- .../xds/go/xds/core/v3/collection_entry.pb.go | 20 +- .../xds/go/xds/core/v3/context_params.pb.go | 7 +- .../cncf/xds/go/xds/core/v3/extension.pb.go | 17 +- .../cncf/xds/go/xds/core/v3/resource.pb.go | 15 +- .../xds/go/xds/core/v3/resource_locator.pb.go | 9 +- .../xds/go/xds/core/v3/resource_name.pb.go | 7 +- .../go-viper/mapstructure/v2/.editorconfig | 18 + .../go-viper/mapstructure/v2/.envrc | 4 + .../go-viper/mapstructure/v2/.gitignore | 6 + .../go-viper/mapstructure/v2/.golangci.yaml | 23 + .../go-viper/mapstructure/v2/CHANGELOG.md | 101 ++ .../go-viper/mapstructure/v2/LICENSE | 21 + .../go-viper/mapstructure/v2/README.md | 59 + .../go-viper/mapstructure/v2/decode_hooks.go | 334 ++++ .../go-viper/mapstructure/v2/error.go | 50 + .../go-viper/mapstructure/v2/flake.lock | 273 +++ .../go-viper/mapstructure/v2/flake.nix | 39 + .../go-viper/mapstructure/v2/mapstructure.go | 1562 +++++++++++++++++ .../mapstructure/v2/reflect_go1_19.go | 44 + .../mapstructure/v2/reflect_go1_20.go | 10 + vendor/github.com/knadh/koanf/v2/README.md | 18 +- vendor/github.com/knadh/koanf/v2/getters.go | 12 +- .../github.com/knadh/koanf/v2/interfaces.go | 2 +- vendor/github.com/knadh/koanf/v2/koanf.go | 25 +- .../prometheus/statsd_exporter/LICENSE | 201 --- .../prometheus/statsd_exporter/NOTICE | 5 - .../statsd_exporter/pkg/level/level.go | 97 - .../statsd_exporter/pkg/mapper/action.go | 42 - .../statsd_exporter/pkg/mapper/escape.go | 86 - .../statsd_exporter/pkg/mapper/fsm/README.md | 132 -- .../statsd_exporter/pkg/mapper/fsm/dump.go | 48 - .../pkg/mapper/fsm/formatter.go | 76 - .../statsd_exporter/pkg/mapper/fsm/fsm.go | 326 ---- .../statsd_exporter/pkg/mapper/fsm/fsm.png | Bin 33685 -> 0 bytes .../statsd_exporter/pkg/mapper/fsm/minmax.go | 30 - .../statsd_exporter/pkg/mapper/mapper.go | 386 ---- .../pkg/mapper/mapper_cache.go | 74 - .../pkg/mapper/mapper_defaults.go | 72 - .../statsd_exporter/pkg/mapper/mapping.go | 76 - .../statsd_exporter/pkg/mapper/match.go | 41 - .../statsd_exporter/pkg/mapper/metric_type.go | 46 - .../statsd_exporter/pkg/mapper/observer.go | 41 - .../gopsutil/v3/internal/common/common.go | 2 +- .../v3/internal/common/common_linux.go | 28 +- .../shirou/gopsutil/v3/process/process.go | 7 + .../gopsutil/v3/process/process_linux.go | 2 +- .../gopsutil/v3/process/process_windows.go | 2 +- .../metric/metricexport/export.go | 26 - .../metric/metricexport/reader.go | 200 --- .../component/componenttest/obsreporttest.go | 18 - .../componenttest/otelprometheuschecker.go | 5 - .../collector/component/config.go | 41 + .../collector/component/identifiable.go | 33 +- .../collector/component/status.go | 3 - .../collector/component/telemetry.go | 7 - .../collector/config/confignet/confignet.go | 24 - .../config/configtelemetry/configtelemetry.go | 4 - .../collector/confmap/converter.go | 4 + .../converter/expandconverter/expand.go | 2 +- .../collector/confmap/provider.go | 4 + .../confmap/provider/envprovider/provider.go | 11 +- .../confmap/provider/fileprovider/provider.go | 22 +- .../confmap/provider/httpprovider/provider.go | 12 +- .../provider/httpsprovider/provider.go | 13 +- .../configurablehttpprovider/provider.go | 2 +- .../confmap/provider/yamlprovider/provider.go | 16 +- .../collector/confmap/resolver.go | 8 - .../internal/metadata/generated_status.go | 5 +- .../collector/featuregate/registry.go | 8 +- .../collector/pdata/pcommon/map.go | 7 +- .../collector/pdata/pcommon/trace_state.go | 3 + .../contrib/config/config.go | 12 - .../contrib/config/resource.go | 19 + vendor/go.opentelemetry.io/otel/CHANGELOG.md | 54 +- vendor/go.opentelemetry.io/otel/CODEOWNERS | 2 +- .../go.opentelemetry.io/otel/CONTRIBUTING.md | 2 +- .../go.opentelemetry.io/otel/attribute/set.go | 2 +- .../otel/exporters/otlp/otlptrace/exporter.go | 2 +- .../otlp/otlptrace/otlptracegrpc/doc.go | 2 +- .../internal/otlpconfig/options.go | 20 + .../otlp/otlptrace/otlptracegrpc/options.go | 34 +- .../otlp/otlptrace/otlptracehttp/doc.go | 4 +- .../internal/otlpconfig/options.go | 20 + .../otlp/otlptrace/otlptracehttp/options.go | 39 +- .../otel/exporters/otlp/otlptrace/version.go | 2 +- .../exporters/stdout/stdouttrace/trace.go | 2 +- .../otel/sdk/metric/EXPERIMENTAL.md | 61 + .../otel/sdk/metric/cache.go | 40 + .../otel/sdk/metric/exemplar.go | 96 + .../metric/internal/aggregate/aggregate.go | 37 +- .../aggregate/exponential_histogram.go | 20 +- .../metric/internal/aggregate/histogram.go | 25 +- .../metric/internal/aggregate/lastvalue.go | 26 +- .../otel/sdk/metric/internal/aggregate/sum.go | 63 +- .../otel/sdk/metric/internal/exemplar}/doc.go | 10 +- .../otel/sdk/metric/internal/exemplar/drop.go | 36 + .../sdk/metric/internal/exemplar/filter.go | 40 + .../otel/sdk/metric/internal/exemplar/hist.go | 47 + .../otel/sdk/metric/internal/exemplar/rand.go | 195 ++ .../sdk/metric/internal/exemplar/reservoir.go | 44 + .../sdk/metric/internal/exemplar/storage.go | 107 ++ .../otel/sdk/metric/meter.go | 184 +- .../otel/sdk/metric/metricdata/data.go | 14 + .../otel/sdk/metric/pipeline.go | 3 +- .../otel/sdk/metric/version.go | 2 +- .../otel/sdk/resource/auto.go | 25 +- .../otel/sdk/resource/container.go | 2 +- .../otel/sdk/resource/resource.go | 79 +- .../otel/sdk/trace/batch_span_processor.go | 2 +- .../otel/sdk/trace/provider.go | 2 +- .../go.opentelemetry.io/otel/sdk/version.go | 2 +- vendor/go.opentelemetry.io/otel/version.go | 2 +- vendor/go.opentelemetry.io/otel/versions.yaml | 16 +- .../proto/otlp/metrics/v1/metrics.pb.go | 8 +- .../proto/otlp/trace/v1/trace.pb.go | 367 ++-- .../grpc_binarylog_v1/binarylog.pb.go | 2 +- vendor/google.golang.org/grpc/clientconn.go | 24 +- .../grpc/internal/internal.go | 20 +- .../grpc/internal/resolver/unix/unix.go | 4 + ...ive_nonunix.go => tcp_keepalive_others.go} | 2 +- .../grpc/internal/tcp_keepalive_windows.go | 54 + .../grpc/internal/transport/http2_client.go | 10 +- .../grpc/internal/transport/http2_server.go | 7 +- .../grpc/metadata/metadata.go | 13 +- .../grpc/reflection/README.md | 2 +- .../grpc/reflection/serverreflection.go | 9 + .../grpc/resolver/resolver.go | 10 + vendor/google.golang.org/grpc/rpc_util.go | 8 +- vendor/google.golang.org/grpc/server.go | 43 +- vendor/google.golang.org/grpc/stream.go | 4 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 8 +- vendor/modules.txt | 61 +- 155 files changed, 4556 insertions(+), 3410 deletions(-) delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/README.md delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go delete mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go create mode 100644 vendor/github.com/go-viper/mapstructure/v2/.editorconfig create mode 100644 vendor/github.com/go-viper/mapstructure/v2/.envrc create mode 100644 vendor/github.com/go-viper/mapstructure/v2/.gitignore create mode 100644 vendor/github.com/go-viper/mapstructure/v2/.golangci.yaml create mode 100644 vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md create mode 100644 vendor/github.com/go-viper/mapstructure/v2/LICENSE create mode 100644 vendor/github.com/go-viper/mapstructure/v2/README.md create mode 100644 vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go create mode 100644 vendor/github.com/go-viper/mapstructure/v2/error.go create mode 100644 vendor/github.com/go-viper/mapstructure/v2/flake.lock create mode 100644 vendor/github.com/go-viper/mapstructure/v2/flake.nix create mode 100644 vendor/github.com/go-viper/mapstructure/v2/mapstructure.go create mode 100644 vendor/github.com/go-viper/mapstructure/v2/reflect_go1_19.go create mode 100644 vendor/github.com/go-viper/mapstructure/v2/reflect_go1_20.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/LICENSE delete mode 100644 vendor/github.com/prometheus/statsd_exporter/NOTICE delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/level/level.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/action.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/escape.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/README.md delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/dump.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/formatter.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.png delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/minmax.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_cache.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_defaults.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapping.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/match.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/metric_type.go delete mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/observer.go delete mode 100644 vendor/go.opencensus.io/metric/metricexport/export.go delete mode 100644 vendor/go.opencensus.io/metric/metricexport/reader.go create mode 100644 vendor/go.opentelemetry.io/contrib/config/resource.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go rename vendor/{go.opencensus.io/metric/metricexport => go.opentelemetry.io/otel/sdk/metric/internal/exemplar}/doc.go (67%) create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/drop.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/filter.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/hist.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/rand.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/reservoir.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/storage.go rename vendor/google.golang.org/grpc/internal/{tcp_keepalive_nonunix.go => tcp_keepalive_others.go} (96%) create mode 100644 vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go diff --git a/go.mod b/go.mod index 275aa520..0876e45f 100644 --- a/go.mod +++ b/go.mod @@ -28,16 +28,16 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.93.0 github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.93.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/collector/component v0.93.0 + go.opentelemetry.io/collector/component v0.94.1 go.opentelemetry.io/collector/connector v0.93.0 go.opentelemetry.io/collector/exporter v0.93.0 go.opentelemetry.io/collector/exporter/debugexporter v0.93.0 go.opentelemetry.io/collector/exporter/loggingexporter v0.93.0 go.opentelemetry.io/collector/exporter/otlpexporter v0.93.0 go.opentelemetry.io/collector/exporter/otlphttpexporter v0.93.0 - go.opentelemetry.io/collector/extension v0.93.0 + go.opentelemetry.io/collector/extension v0.94.1 go.opentelemetry.io/collector/extension/ballastextension v0.93.0 - go.opentelemetry.io/collector/extension/zpagesextension v0.93.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.94.1 go.opentelemetry.io/collector/otelcol v0.93.0 go.opentelemetry.io/collector/processor v0.93.0 go.opentelemetry.io/collector/processor/batchprocessor v0.93.0 @@ -71,7 +71,7 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect + github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dennwc/varint v1.0.0 // indirect github.com/digitalocean/godo v1.104.1 // indirect @@ -98,6 +98,7 @@ require ( github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.4 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect github.com/go-zookeeper/zk v1.0.3 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -154,7 +155,7 @@ require ( github.com/klauspost/compress v1.17.4 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/knadh/koanf/providers/confmap v0.1.0 // indirect - github.com/knadh/koanf/v2 v2.0.1 // indirect + github.com/knadh/koanf/v2 v2.0.2 // indirect github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 // indirect @@ -219,7 +220,7 @@ require ( github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21 // indirect - github.com/shirou/gopsutil/v3 v3.23.12 // indirect + github.com/shirou/gopsutil/v3 v3.24.1 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -240,44 +241,44 @@ require ( github.com/xdg-go/stringprep v1.0.4 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/collector v0.93.0 // indirect + go.opentelemetry.io/collector v0.94.1 // indirect go.opentelemetry.io/collector/config/configauth v0.93.0 // indirect go.opentelemetry.io/collector/config/configcompression v0.93.0 // indirect go.opentelemetry.io/collector/config/configgrpc v0.93.0 // indirect go.opentelemetry.io/collector/config/confighttp v0.93.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.93.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.94.1 // indirect go.opentelemetry.io/collector/config/configopaque v0.93.0 // indirect go.opentelemetry.io/collector/config/configretry v0.93.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.93.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.94.1 // indirect go.opentelemetry.io/collector/config/configtls v0.93.0 // indirect go.opentelemetry.io/collector/config/internal v0.93.0 // indirect - go.opentelemetry.io/collector/confmap v0.93.0 // indirect - go.opentelemetry.io/collector/consumer v0.93.0 // indirect + go.opentelemetry.io/collector/confmap v0.94.1 // indirect + go.opentelemetry.io/collector/consumer v0.94.1 // indirect go.opentelemetry.io/collector/extension/auth v0.93.0 // indirect - go.opentelemetry.io/collector/featuregate v1.0.1 // indirect - go.opentelemetry.io/collector/pdata v1.0.1 // indirect + go.opentelemetry.io/collector/featuregate v1.1.0 // indirect + go.opentelemetry.io/collector/pdata v1.1.0 // indirect go.opentelemetry.io/collector/semconv v0.93.0 // indirect go.opentelemetry.io/collector/service v0.93.0 // indirect - go.opentelemetry.io/contrib/config v0.2.0 // indirect + go.opentelemetry.io/contrib/config v0.3.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.22.0 // indirect go.opentelemetry.io/contrib/zpages v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel v1.23.0 // indirect go.opentelemetry.io/otel/bridge/opencensus v0.45.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.45.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect - go.opentelemetry.io/otel/exporters/prometheus v0.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.45.1 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/sdk v1.22.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/sdk v1.23.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect @@ -296,7 +297,7 @@ require ( google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/grpc v1.60.1 // indirect + google.golang.org/grpc v1.61.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 3f7a50e9..5f486195 100644 --- a/go.sum +++ b/go.sum @@ -124,6 +124,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -227,6 +229,8 @@ github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPr github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c= +github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-zookeeper/zk v1.0.3 h1:7M2kwOsc//9VeeFiPtf+uSJlVpU66x9Ba5+8XK7/TDg= github.com/go-zookeeper/zk v1.0.3/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -451,6 +455,8 @@ github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPgh github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= github.com/knadh/koanf/v2 v2.0.1 h1:1dYGITt1I23x8cfx8ZnldtezdyaZtfAuRtIFOiRzK7g= github.com/knadh/koanf/v2 v2.0.1/go.mod h1:ZeiIlIDXTE7w1lMT6UVcNiRAS2/rCeLn/GdLNvY1Dus= +github.com/knadh/koanf/v2 v2.0.2 h1:sEZzPW2rVWSahcYILNq/syJdEyRafZIG0l9aWwL86HA= +github.com/knadh/koanf/v2 v2.0.2/go.mod h1:HN9uZ+qFAejH1e4G41gnoffIanINWQuONLXiV7kir6k= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -736,6 +742,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUt github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shirou/gopsutil/v3 v3.24.1 h1:R3t6ondCEvmARp3wxODhXMTLC/klMa87h2PHUw5m7QI= +github.com/shirou/gopsutil/v3 v3.24.1/go.mod h1:UU7a2MSBQa+kW1uuDq8DeEBS8kmrnQwsv2b5O513rwU= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= @@ -818,8 +826,12 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/collector v0.93.0 h1:wnyNd3OjwD7wmTIEVvyZG9cS+dhmfLAhNutWDgE5Vqo= go.opentelemetry.io/collector v0.93.0/go.mod h1:lorK6TQaQvg0RDRN42HwY0Gqc/d7mvBgCMeJCYGishA= +go.opentelemetry.io/collector v0.94.1 h1:bGHW5NKmh34oMflMEyNCHpes6vtiQNXpgea4GiscAOs= +go.opentelemetry.io/collector v0.94.1/go.mod h1:5ACZXRo6O23gBkRrHSxYs1sLaP4pZ8w+flZNE7pvoNg= go.opentelemetry.io/collector/component v0.93.0 h1:FHd86+7hbbBlDxdOFLWRA19HrjxKcXO+6H3UQ0zQz0c= go.opentelemetry.io/collector/component v0.93.0/go.mod h1:8tglddCwOhrcktA7+EwYqcOL3+7xvbfn8ZwKcxsWch0= +go.opentelemetry.io/collector/component v0.94.1 h1:j4peKsWb+QVBKPs2RJeIj5EoQW7yp2ZVGrd8Bu9HU9M= +go.opentelemetry.io/collector/component v0.94.1/go.mod h1:vg+kAH81C3YS0SPzUXkSFWLPC1WH7zx70dAtUWWIHcE= go.opentelemetry.io/collector/config/configauth v0.93.0 h1:el5NR0VZ4naIf7hwcHw5LsxpYoComoMzUDB1HEgZ894= go.opentelemetry.io/collector/config/configauth v0.93.0/go.mod h1:X0t0TR/DZMzzou1DkG/UdNzFubmOf4WSOidPLeqX54U= go.opentelemetry.io/collector/config/configcompression v0.93.0 h1:mF9faTs/nU0Uceb+T1kqnUnfrOMqC1hABoFb7nai7Ig= @@ -830,22 +842,30 @@ go.opentelemetry.io/collector/config/confighttp v0.93.0 h1:H8tiKryH5koh5aHfIdM2k go.opentelemetry.io/collector/config/confighttp v0.93.0/go.mod h1:5doQNLIZoUhJJJzpAaMSzGgztAPcvdzTYnynIfJvtkY= go.opentelemetry.io/collector/config/confignet v0.93.0 h1:UZ3ZGxbf0HBCNAIfxhfmVRal5gjDjocVed4NOs89hNo= go.opentelemetry.io/collector/config/confignet v0.93.0/go.mod h1:rraribsOoZsYZm51+3TXHavmXKJOC5a5/X20vfmNbdw= +go.opentelemetry.io/collector/config/confignet v0.94.1 h1:kaV1iwZKjv7ZJZ+PtLTQYfVNLVD3EAyxfYBNZf5GXmo= +go.opentelemetry.io/collector/config/confignet v0.94.1/go.mod h1:rraribsOoZsYZm51+3TXHavmXKJOC5a5/X20vfmNbdw= go.opentelemetry.io/collector/config/configopaque v0.93.0 h1:mvJFVhToyL6k0BZMhZTbSAxwYXGHoqibp6JVYY5SZu8= go.opentelemetry.io/collector/config/configopaque v0.93.0/go.mod h1:dQK8eUXjIGKaw1RB7UIg2nqx56AueNxeKFCdB0P1ypg= go.opentelemetry.io/collector/config/configretry v0.93.0 h1:32JKlZWkGgCLpc1X7rfug6l2zmt8Nz9D2FrwJOVGNx4= go.opentelemetry.io/collector/config/configretry v0.93.0/go.mod h1:gt1HRYyMxcMca9lbDLPbivQzsUCjVjkPAn/3S6fiD14= go.opentelemetry.io/collector/config/configtelemetry v0.93.0 h1:s+J/zYXc0zRi346Dz4r5ynTPyI5wRtp+JrSyrSBSiSY= go.opentelemetry.io/collector/config/configtelemetry v0.93.0/go.mod h1:2XLhyR/GVpWeZ2K044vCmrvH/d4Ewt0aD/y46avZyMU= +go.opentelemetry.io/collector/config/configtelemetry v0.94.1 h1:ztYpBEBlvhcoxMiDKNmQ2SS+A41JZ4M19GfcxjCo8Zs= +go.opentelemetry.io/collector/config/configtelemetry v0.94.1/go.mod h1:2XLhyR/GVpWeZ2K044vCmrvH/d4Ewt0aD/y46avZyMU= go.opentelemetry.io/collector/config/configtls v0.93.0 h1:m6M4m5EM1e1BmhGwB4kEwm6TBslvjCYDdZViRBvtgW0= go.opentelemetry.io/collector/config/configtls v0.93.0/go.mod h1:ehXx933OgUTSH7bIWphIf1Kfohy6qmrVHizFCgHtF7U= go.opentelemetry.io/collector/config/internal v0.93.0 h1:tFGp6z3ieOQMs02Lpkezvr9ZJLRooVdOf3jyJGoTeiM= go.opentelemetry.io/collector/config/internal v0.93.0/go.mod h1:rPjglfSd4K/kNLfH7TJO8AsstHGMmWTdntOqH7WiFLg= go.opentelemetry.io/collector/confmap v0.93.0 h1:uYiak0iPuSW4BQIEuN+yihQqvWRwURhoW/qoVs4vLFA= go.opentelemetry.io/collector/confmap v0.93.0/go.mod h1:+QxYr8qSah4ffcVBUC2KJgwlMsrD2nK1CmcHkLB+D7A= +go.opentelemetry.io/collector/confmap v0.94.1 h1:O69bkeyR1YPAFz+jMd45aDZc1DtYnwb3Skgr2yALPqQ= +go.opentelemetry.io/collector/confmap v0.94.1/go.mod h1:pCT5UtcHaHVJ5BIILv1Z2VQyjZzmT9uTdBmC9+Z0AgA= go.opentelemetry.io/collector/connector v0.93.0 h1:h75WUN8opiO+ymOzmsaKo5k/6iDkqcBFvTO3kxiTozM= go.opentelemetry.io/collector/connector v0.93.0/go.mod h1:RK1yq+Jpl71BugaPVt6oJwXQ150E4bwYHReQwhTqoK0= go.opentelemetry.io/collector/consumer v0.93.0 h1:tt9T8knyamBr/85VqIbESsIHVkFXCkwOD+noFqK3+Vg= go.opentelemetry.io/collector/consumer v0.93.0/go.mod h1:6BI1qsWw89DmTjoEu/acTcvTLISt3Y0lHioUfafpsAE= +go.opentelemetry.io/collector/consumer v0.94.1 h1:l/9h5L71xr/d93snQ9fdxgz64C4UuB8mEDxpp456X8o= +go.opentelemetry.io/collector/consumer v0.94.1/go.mod h1:BIPWmw8wES6jlPTPC+acJxLvUzIdOm6uh/p/X85ALsY= go.opentelemetry.io/collector/exporter v0.93.0 h1:54EhAgvPM/eokfu0dK/k0qNb/vivPD2FdrLhYzvWWms= go.opentelemetry.io/collector/exporter v0.93.0/go.mod h1:iT3oq6Hz6VwCZld0+SssBmQeSDqWCIjvf5dksRzhJ1s= go.opentelemetry.io/collector/exporter/debugexporter v0.93.0 h1:uT1AQBC54KlHrlrrDIvdEZPooCQDDsP23tqUAJxaXlQ= @@ -858,18 +878,26 @@ go.opentelemetry.io/collector/exporter/otlphttpexporter v0.93.0 h1:2SJHGQuN+6wc5 go.opentelemetry.io/collector/exporter/otlphttpexporter v0.93.0/go.mod h1:+WoH+HVYyLaKqovHBVNRLLBojjvxhQ1eC/2cHQ8UZjY= go.opentelemetry.io/collector/extension v0.93.0 h1:HqSiVElfK78/rzSN4e7iyQXuMjsye0YZwZfJfalKKaQ= go.opentelemetry.io/collector/extension v0.93.0/go.mod h1:KCZuD2WjQSoquIfjjOb18L8TfLrvbGgZW1H445umoMU= +go.opentelemetry.io/collector/extension v0.94.1 h1:f0yyW2lmLg+PI1FjNWJaGcKVQV6TRgLqqbMA/4S5dA4= +go.opentelemetry.io/collector/extension v0.94.1/go.mod h1:fxQXkLkFcea3uJ3hlImBs5kQ/pWjeDIC2OylnDYIA4g= go.opentelemetry.io/collector/extension/auth v0.93.0 h1:NgBT/P3kPJtnrdufIGGX7wbv8WcW3suYC6CcnCbw/Rk= go.opentelemetry.io/collector/extension/auth v0.93.0/go.mod h1:cc15RY21t3D+cJMubhs2dMIedHS782L/7wfhCdL+pgk= go.opentelemetry.io/collector/extension/ballastextension v0.93.0 h1:0S4fUM9y6+3RfkyNbIbXya56RCOtSLSr7ZH6xtoYbP8= go.opentelemetry.io/collector/extension/ballastextension v0.93.0/go.mod h1:4S4ieWzVpNFhzbVQ4tTVVeUpQCwhOfTs/KgQevSShMs= go.opentelemetry.io/collector/extension/zpagesextension v0.93.0 h1:cOTVR+8HlV5P8/ZNHxNtxcAUqw88InNjGuM8YL4KmnI= go.opentelemetry.io/collector/extension/zpagesextension v0.93.0/go.mod h1:bSw32vI/g29g9Xx7GOHuGO7ap6NodoUO8qHankPKM9M= +go.opentelemetry.io/collector/extension/zpagesextension v0.94.1 h1:s+cb8nh2vS9F2/UkWO+jhsvJE2SV5CF3BZ1KJ6q8rSk= +go.opentelemetry.io/collector/extension/zpagesextension v0.94.1/go.mod h1:NVoJq0mxe7AIw+EjDPyrwMZ21DGxoUqXZ1W5dTXrV38= go.opentelemetry.io/collector/featuregate v1.0.1 h1:ok//hLSXttBbyu4sSV1pTx1nKdr5udSmrWy5sFMIIbM= go.opentelemetry.io/collector/featuregate v1.0.1/go.mod h1:QQXjP4etmJQhkQ20j4P/rapWuItYxoFozg/iIwuKnYg= +go.opentelemetry.io/collector/featuregate v1.1.0 h1:W+/FKvRxHMFC6MuTTEgrHINCf1vFBvLH7stSOEar6zU= +go.opentelemetry.io/collector/featuregate v1.1.0/go.mod h1:QQXjP4etmJQhkQ20j4P/rapWuItYxoFozg/iIwuKnYg= go.opentelemetry.io/collector/otelcol v0.93.0 h1:a6RT0DNK85zIH4E9sFQ4BVGu6ppR09lEJokEEDLpF+s= go.opentelemetry.io/collector/otelcol v0.93.0/go.mod h1:6PbnYxuob3AMrqeKhkPYw1wOHdLW0QZIvhCVshDuIac= go.opentelemetry.io/collector/pdata v1.0.1 h1:dGX2h7maA6zHbl5D3AsMnF1c3Nn+3EUftbVCLzeyNvA= go.opentelemetry.io/collector/pdata v1.0.1/go.mod h1:jutXeu0QOXYY8wcZ/hege+YAnSBP3+jpTqYU1+JTI5Y= +go.opentelemetry.io/collector/pdata v1.1.0 h1:cE6Al1rQieUjMHro6p6cKwcu3sjHXGG59BZ3kRVUvsM= +go.opentelemetry.io/collector/pdata v1.1.0/go.mod h1:IDkDj+B4Fp4wWOclBELN97zcb98HugJ8Q2gA4ZFsN8Q= go.opentelemetry.io/collector/processor v0.93.0 h1:P4/AXaeMNzmImsD1dONlLOk5Ky4txS+Yf52eIulIg0k= go.opentelemetry.io/collector/processor v0.93.0/go.mod h1:VQqYLgdC04Bp8ArfkERaOFaRCDvyCMdwULvTn66l6AA= go.opentelemetry.io/collector/processor/batchprocessor v0.93.0 h1:Rtgz8QP2QcaNDZLiZePPKYZRMEAWgUeHQ5jK01BoZb8= @@ -886,6 +914,8 @@ go.opentelemetry.io/collector/service v0.93.0 h1:U2pUgqwo7X+gi9LqPOQe/QQoYdv0DtJ go.opentelemetry.io/collector/service v0.93.0/go.mod h1:qMQ8tWwwBnhUe0Vp6jkml/r66+Pg1t1j2U5DOpLeRlE= go.opentelemetry.io/contrib/config v0.2.0 h1:VRYXnoE2ug3QOtaKka4eV9OgHXMJ0q6ggFtx6s+Jvy0= go.opentelemetry.io/contrib/config v0.2.0/go.mod h1:iBfwdwpZBKsVXMOAWHyGS8//dcVNJORYnFm6VNqsOG8= +go.opentelemetry.io/contrib/config v0.3.0 h1:nJxYSB7/8fckSya4EAFyFGxIytMvNlQInXSmhz/OKKg= +go.opentelemetry.io/contrib/config v0.3.0/go.mod h1:tQW0mY8be9/LGikwZNYno97PleUhF/lMal9xJ1TC2vo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= @@ -896,6 +926,8 @@ go.opentelemetry.io/contrib/zpages v0.47.0 h1:ekpdNa2wqOvAfwZIGDIIV02zmR+z08aWPt go.opentelemetry.io/contrib/zpages v0.47.0/go.mod h1:rBeFA/UxnMjRlEGpmClIqzf1mCIKtl7ahjww3wsSdGs= go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel v1.23.0 h1:Df0pqjqExIywbMCMTxkAwzjLZtRf+bBKLbUcpxO2C9E= +go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFufObyB0= go.opentelemetry.io/otel/bridge/opencensus v0.45.0 h1:kEOlv9Exuv3J8GCf1nLMHfrTPGnZOuIkN8YlRM14TtQ= go.opentelemetry.io/otel/bridge/opencensus v0.45.0/go.mod h1:tkVMJeFOr43+zzwbxtIWsNcCCDT7rI5/c9rhMfMIENg= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.45.0 h1:tfil6di0PoNV7FZdsCS7A5izZoVVQ7AuXtyekbOpG/I= @@ -904,26 +936,46 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0 h1:+Rb go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0/go.mod h1:zcI8u2EJxbLPyoZ3SkVAAcQPgYb1TDRzW93xLFnsggU= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 h1:D/cXD+03/UOphyyT87NX6h+DlU+BnplN6/P6KJwsgGc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0/go.mod h1:L669qRGbPBwLcftXLFnTVFO6ES/GyMAvITLdvRjEAIM= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 h1:H2JFgRcGiyHg7H7bwcwaQJYrNFqCqrbTQ8K4p1OvDu8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0/go.mod h1:WfCWp1bGoYK8MeULtI15MmQVczfR+bFkk0DF3h06QmQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0 h1:VZrBiTXzP3FErizsdF1JQj0qf0yA8Ktt6LAcjUhZqbc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0/go.mod h1:xkkwo777b9MEfsyD1yUZa4g+7MCqqWAP3r2tTSZePRc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.0 h1:cZXHUQvCx7YMdjGu0AlmoArUz7NZ7K6WWsT4cjSkzc0= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.0/go.mod h1:OHlshrAeSV9uiVQs1n+c0FVCyo8L0NrYzVf5GuLllRo= go.opentelemetry.io/otel/exporters/prometheus v0.45.0 h1:BeIK2KGho0oCWa7LxEGSqfDZbs7Fpv/Viz+FS4P8CXE= go.opentelemetry.io/otel/exporters/prometheus v0.45.0/go.mod h1:UVJZPLnfDSvHj+eJuZE+E1GjIBD267mEMfAAHJdghWg= +go.opentelemetry.io/otel/exporters/prometheus v0.45.1 h1:R/bW3afad6q6VGU+MFYpnEdo0stEARMCdhWu6+JI6aI= +go.opentelemetry.io/otel/exporters/prometheus v0.45.1/go.mod h1:wnHAfKRav5Dfp4iZhyWZ7SzQfT+rDZpEpYG7To+qJ1k= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 h1:NjN6zc7Mwy9torqa3mo+pMJ3mHoPI0uzVSYcqB2t72A= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0/go.mod h1:U+T5v2bk4fCC8XdSEWZja3Pm/ZhvV/zE7JwX/ELJKts= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 h1:zr8ymM5OWWjjiWRzwTfZ67c905+2TMHYp2lMJ52QTyM= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0/go.mod h1:sQs7FT2iLVJ+67vYngGJkPe1qr39IzaBzaj9IDNNY8k= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 h1:f4N/tfYchDXfM78Ng5KKO7OjrShVzww1g4oYxZ7tyMA= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0/go.mod h1:v1gipIZLj3qtxR1L1F7jF/WaPFA5ptuHk52+eq9SSRg= go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/metric v1.23.0 h1:pazkx7ss4LFVVYSxYew7L5I6qvLXHA0Ap2pwV+9Cnpo= +go.opentelemetry.io/otel/metric v1.23.0/go.mod h1:MqUW2X2a6Q8RN96E2/nqNoT+z9BSms20Jb7Bbp+HiTo= go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/sdk v1.23.0 h1:0KM9Zl2esnl+WSukEmlaAEjVY5HDZANOHferLq36BPc= +go.opentelemetry.io/otel/sdk v1.23.0/go.mod h1:wUscup7byToqyKJSilEtMf34FgdCAsFpFOjXnAwFfO0= go.opentelemetry.io/otel/sdk/metric v1.22.0 h1:ARrRetm1HCVxq0cbnaZQlfwODYJHo3gFL8Z3tSmHBcI= go.opentelemetry.io/otel/sdk/metric v1.22.0/go.mod h1:KjQGeMIDlBNEOo6HvjhxIec1p/69/kULDcp4gr0oLQQ= +go.opentelemetry.io/otel/sdk/metric v1.23.0 h1:u81lMvmK6GMgN4Fty7K7S6cSKOZhMKJMK2TB+KaTs0I= +go.opentelemetry.io/otel/sdk/metric v1.23.0/go.mod h1:2LUOToN/FdX6wtfpHybOnCZjoZ6ViYajJYMiJ1LKDtQ= go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/trace v1.23.0 h1:37Ik5Ib7xfYVb4V1UtnT97T1jI+AoIYkJyPkuL4iJgI= +go.opentelemetry.io/otel/trace v1.23.0/go.mod h1:GSGTbIClEsuZrGIzoEHqsVfxgn5UkggkflQwDScNUsk= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -1277,6 +1329,8 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore b/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore deleted file mode 100644 index 85e7c1df..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.idea/ diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml b/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml deleted file mode 100644 index 0aa9844f..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml +++ /dev/null @@ -1,123 +0,0 @@ -# options for analysis running -run: - # default concurrency is a available CPU number - concurrency: 4 - - # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 10m - - # exit code when at least one issue was found, default is 1 - issues-exit-code: 1 - - # include test files or not, default is true - tests: true - - # which dirs to skip: issues from them won't be reported; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but default dirs are skipped independently - # from this option's value (see skip-dirs-use-default). - skip-dirs: - - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: false - - # which files to skip: they will be analyzed, but issues from them - # won't be reported. Default value is empty list, but there is - # no need to include all autogenerated files, we confidently recognize - # autogenerated files. If it's not please let us know. - skip-files: - - # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": - # If invoked with -mod=readonly, the go command is disallowed from the implicit - # automatic updating of go.mod described above. Instead, it fails when any changes - # to go.mod are needed. This setting is most useful to check that go.mod does - # not need updates, such as in a continuous integration and testing system. - # If invoked with -mod=vendor, the go command assumes that the vendor - # directory holds the correct copies of dependencies and ignores - # the dependency descriptions in go.mod. - modules-download-mode: readonly - -# output configuration options -output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - -# all available settings of specific linters -linters-settings: - govet: - # report about shadowed variables - check-shadowing: true - - # settings per analyzer - settings: - printf: # analyzer name, run `go tool vet help` to see all analyzers - funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - - enable-all: true - # TODO: Enable this and fix the alignment issues. - disable: - - fieldalignment - - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 - - gofmt: - # simplify code: gofmt with `-s` option, true by default - simplify: true - - goimports: - # put imports beginning with prefix after 3rd-party packages; - # it's a comma-separated list of prefixes - local-prefixes: contrib.go.opencensus.io/exporter/prometheus - - misspell: - # Correct spellings using locale preferences for US or UK. - # Default is to use a neutral variety of English. - # Setting locale to US will correct the British spelling of 'colour' to 'color'. - locale: US - ignore-words: - - cancelled - - metre - - meter - - metres - - kilometre - - kilometres - -linters: - disable: - - errcheck - enable: - - gofmt - - goimports - - golint - - gosec - - govet - - staticcheck - - misspell - - scopelint - - unconvert - - gocritic - - unparam - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - # Exclude some linters from running on tests files. - - path: _test\.go - linters: - - scopelint - - text: "G404:" - linters: - - gosec diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml b/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml deleted file mode 100644 index 17afafec..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -go_import_path: contrib.go.opencensus.io - -go: - - 1.15.x - -env: - global: - GO111MODULE=on - -before_script: - - make install-tools - -script: - - make travis-ci - diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE b/vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/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/contrib.go.opencensus.io/exporter/prometheus/Makefile b/vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile deleted file mode 100644 index cf4d6132..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# TODO: Fix this on windows. -ALL_SRC := $(shell find . -name '*.go' \ - -not -path './vendor/*' \ - -not -path '*/gen-go/*' \ - -type f | sort) -ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC)))) - -GOTEST_OPT?=-v -race -timeout 30s -GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic -GOTEST=go test -LINT=golangci-lint -# TODO decide if we need to change these names. -README_FILES := $(shell find . -name '*README.md' | sort | tr '\n' ' ') - -.DEFAULT_GOAL := lint-test - -.PHONY: lint-test -lint-test: lint test - -# TODO enable test-with-coverage in travis -.PHONY: travis-ci -travis-ci: lint test test-386 - -all-pkgs: - @echo $(ALL_PKGS) | tr ' ' '\n' | sort - -all-srcs: - @echo $(ALL_SRC) | tr ' ' '\n' | sort - -.PHONY: test -test: - $(GOTEST) $(GOTEST_OPT) $(ALL_PKGS) - -.PHONY: test-386 -test-386: - GOARCH=386 $(GOTEST) -v -timeout 30s $(ALL_PKGS) - -.PHONY: test-with-coverage -test-with-coverage: - $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS) - -.PHONY: lint -lint: - $(LINT) run --allow-parallel-runners - -.PHONY: install-tools -install-tools: - cd internal/tools && go install golang.org/x/tools/cmd/cover - cd internal/tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint - diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md b/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md deleted file mode 100644 index 3a9c5d3c..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# OpenCensus Go Prometheus Exporter - -[![Build Status](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-prometheus.svg?branch=master)](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-prometheus) [![GoDoc][godoc-image]][godoc-url] - -Provides OpenCensus metrics export support for Prometheus. - -## Installation - -``` -$ go get -u contrib.go.opencensus.io/exporter/prometheus -``` - -[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus?status.svg -[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go b/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go deleted file mode 100644 index b94c6d39..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright 2017, OpenCensus 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 prometheus contains a Prometheus exporter that supports exporting -// OpenCensus views as Prometheus metrics. -package prometheus // import "contrib.go.opencensus.io/exporter/prometheus" - -import ( - "context" - "fmt" - "log" - "net/http" - "sync" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricexport" - "go.opencensus.io/stats/view" -) - -// Exporter exports stats to Prometheus, users need -// to register the exporter as an http.Handler to be -// able to export. -type Exporter struct { - opts Options - g prometheus.Gatherer - c *collector - handler http.Handler -} - -// Options contains options for configuring the exporter. -type Options struct { - Namespace string - Registry *prometheus.Registry - Registerer prometheus.Registerer - Gatherer prometheus.Gatherer - OnError func(err error) - ConstLabels prometheus.Labels // ConstLabels will be set as labels on all views. -} - -// NewExporter returns an exporter that exports stats to Prometheus. -func NewExporter(o Options) (*Exporter, error) { - if o.Registry == nil { - o.Registry = prometheus.NewRegistry() - } - if o.Registerer == nil { - o.Registerer = o.Registry - } - if o.Gatherer == nil { - o.Gatherer = o.Registry - } - - collector := newCollector(o, o.Registerer) - e := &Exporter{ - opts: o, - g: o.Gatherer, - c: collector, - handler: promhttp.HandlerFor(o.Gatherer, promhttp.HandlerOpts{}), - } - collector.ensureRegisteredOnce() - - return e, nil -} - -var _ http.Handler = (*Exporter)(nil) - -// ensureRegisteredOnce invokes reg.Register on the collector itself -// exactly once to ensure that we don't get errors such as -// cannot register the collector: descriptor Desc{fqName: *} -// already exists with the same fully-qualified name and const label values -// which is documented by Prometheus at -// https://github.com/prometheus/client_golang/blob/fcc130e101e76c5d303513d0e28f4b6d732845c7/prometheus/registry.go#L89-L101 -func (c *collector) ensureRegisteredOnce() { - c.registerOnce.Do(func() { - if err := c.reg.Register(c); err != nil { - c.opts.onError(fmt.Errorf("cannot register the collector: %v", err)) - } - }) - -} - -func (o *Options) onError(err error) { - if o.OnError != nil { - o.OnError(err) - } else { - log.Printf("Failed to export to Prometheus: %v", err) - } -} - -// ExportView exports to the Prometheus if view data has one or more rows. -// Each OpenCensus AggregationData will be converted to -// corresponding Prometheus Metric: SumData will be converted -// to Untyped Metric, CountData will be a Counter Metric, -// DistributionData will be a Histogram Metric. -// -// Deprecated: in lieu of metricexport.Reader interface. -func (e *Exporter) ExportView(vd *view.Data) { -} - -// ServeHTTP serves the Prometheus endpoint. -func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request) { - e.handler.ServeHTTP(w, r) -} - -// collector implements prometheus.Collector -type collector struct { - opts Options - - registerOnce sync.Once - - // reg helps collector register views dynamically. - reg prometheus.Registerer - - // reader reads metrics from all registered producers. - reader *metricexport.Reader -} - -func (c *collector) Describe(ch chan<- *prometheus.Desc) { - de := &descExporter{c: c, descCh: ch} - c.reader.ReadAndExport(de) -} - -// Collect fetches the statistics from OpenCensus -// and delivers them as Prometheus Metrics. -// Collect is invoked every time a prometheus.Gatherer is run -// for example when the HTTP endpoint is invoked by Prometheus. -func (c *collector) Collect(ch chan<- prometheus.Metric) { - me := &metricExporter{c: c, metricCh: ch} - c.reader.ReadAndExport(me) -} - -func newCollector(opts Options, registrar prometheus.Registerer) *collector { - return &collector{ - reg: registrar, - opts: opts, - reader: metricexport.NewReader()} -} - -func (c *collector) toDesc(metric *metricdata.Metric) *prometheus.Desc { - var labels prometheus.Labels - switch { - case metric.Resource == nil: - labels = c.opts.ConstLabels - case c.opts.ConstLabels == nil: - labels = metric.Resource.Labels - default: - labels = prometheus.Labels{} - for k, v := range c.opts.ConstLabels { - labels[k] = v - } - // Resource labels overwrite const labels. - for k, v := range metric.Resource.Labels { - labels[k] = v - } - } - - return prometheus.NewDesc( - metricName(c.opts.Namespace, metric), - metric.Descriptor.Description, - toPromLabels(metric.Descriptor.LabelKeys), - labels) -} - -type metricExporter struct { - c *collector - metricCh chan<- prometheus.Metric -} - -// ExportMetrics exports to the Prometheus. -// Each OpenCensus Metric will be converted to -// corresponding Prometheus Metric: -// TypeCumulativeInt64 and TypeCumulativeFloat64 will be a Counter Metric, -// TypeCumulativeDistribution will be a Histogram Metric. -// TypeGaugeFloat64 and TypeGaugeInt64 will be a Gauge Metric -func (me *metricExporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { - for _, metric := range metrics { - desc := me.c.toDesc(metric) - for _, ts := range metric.TimeSeries { - tvs := toLabelValues(ts.LabelValues) - for _, point := range ts.Points { - metric, err := toPromMetric(desc, metric, point, tvs) - if err != nil { - me.c.opts.onError(err) - } else if metric != nil { - me.metricCh <- metric - } - } - } - } - return nil -} - -type descExporter struct { - c *collector - descCh chan<- *prometheus.Desc -} - -// ExportMetrics exports descriptor to the Prometheus. -// It is invoked when request to scrape descriptors is received. -func (me *descExporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { - for _, metric := range metrics { - desc := me.c.toDesc(metric) - me.descCh <- desc - } - return nil -} - -func toPromLabels(mls []metricdata.LabelKey) (labels []string) { - for _, ml := range mls { - labels = append(labels, sanitize(ml.Key)) - } - return labels -} - -func metricName(namespace string, m *metricdata.Metric) string { - var name string - if namespace != "" { - name = namespace + "_" - } - return name + sanitize(m.Descriptor.Name) -} - -func toPromMetric( - desc *prometheus.Desc, - metric *metricdata.Metric, - point metricdata.Point, - labelValues []string) (prometheus.Metric, error) { - switch metric.Descriptor.Type { - case metricdata.TypeCumulativeFloat64, metricdata.TypeCumulativeInt64: - pv, err := toPromValue(point) - if err != nil { - return nil, err - } - return prometheus.NewConstMetric(desc, prometheus.CounterValue, pv, labelValues...) - - case metricdata.TypeGaugeFloat64, metricdata.TypeGaugeInt64: - pv, err := toPromValue(point) - if err != nil { - return nil, err - } - return prometheus.NewConstMetric(desc, prometheus.GaugeValue, pv, labelValues...) - - case metricdata.TypeCumulativeDistribution: - switch v := point.Value.(type) { - case *metricdata.Distribution: - points := make(map[float64]uint64) - // Histograms are cumulative in Prometheus. - // Get cumulative bucket counts. - cumCount := uint64(0) - for i, b := range v.BucketOptions.Bounds { - cumCount += uint64(v.Buckets[i].Count) - points[b] = cumCount - } - return prometheus.NewConstHistogram(desc, uint64(v.Count), v.Sum, points, labelValues...) - default: - return nil, typeMismatchError(point) - } - case metricdata.TypeSummary: - // TODO: [rghetia] add support for TypeSummary. - return nil, nil - default: - return nil, fmt.Errorf("aggregation %T is not yet supported", metric.Descriptor.Type) - } -} - -func toLabelValues(labelValues []metricdata.LabelValue) (values []string) { - for _, lv := range labelValues { - if lv.Present { - values = append(values, lv.Value) - } else { - values = append(values, "") - } - } - return values -} - -func typeMismatchError(point metricdata.Point) error { - return fmt.Errorf("point type %T does not match metric type", point) - -} - -func toPromValue(point metricdata.Point) (float64, error) { - switch v := point.Value.(type) { - case float64: - return v, nil - case int64: - return float64(v), nil - default: - return 0.0, typeMismatchError(point) - } -} diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go b/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go deleted file mode 100644 index 9c9a9c4d..00000000 --- a/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017, OpenCensus 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 prometheus - -import ( - "github.com/prometheus/statsd_exporter/pkg/mapper" -) - -const labelKeySizeLimit = 100 - -// sanitize returns a string that is trunacated to 100 characters if it's too -// long, and replaces non-alphanumeric characters to underscores. -func sanitize(s string) string { - if len(s) == 0 { - return s - } - if len(s) > labelKeySizeLimit { - s = s[:labelKeySizeLimit] - } - - s = mapper.EscapeMetricName(s) - if s[0] == '_' { - s = "key" + s - } - return s -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go index 46fb820c..be9f4678 100644 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go +++ b/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: udpa/annotations/migrate.proto package annotations import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type MigrateAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go index e061f584..aaac45ea 100644 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go +++ b/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: udpa/annotations/security.proto package annotations import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type FieldSecurityAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go index 0334e8f4..0a46801d 100644 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go +++ b/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: udpa/annotations/sensitive.proto package annotations import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - var file_udpa_annotations_sensitive_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FieldOptions)(nil), diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go index 3f239dd0..25b93a7f 100644 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go +++ b/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: udpa/annotations/status.proto package annotations import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type PackageVersionStatus int32 const ( diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go index 49ced5fb..7af3ed3f 100644 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go +++ b/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: udpa/annotations/versioning.proto package annotations import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type VersioningAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go index e29c098b..cf1ee18e 100644 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/annotations/v3/migrate.proto package v3 import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type MigrateAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go index c716366b..084664ff 100644 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/annotations/v3/security.proto package v3 import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type FieldSecurityAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go index 2aa60b96..b603aa4c 100644 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/annotations/v3/sensitive.proto package v3 import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - var file_xds_annotations_v3_sensitive_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FieldOptions)(nil), diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go index 3a2015e6..cc624ac9 100644 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/annotations/v3/status.proto package v3 import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type PackageVersionStatus int32 const ( diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go index c789b4c0..22526893 100644 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/annotations/v3/versioning.proto package v3 import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" descriptorpb "google.golang.org/protobuf/types/descriptorpb" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type VersioningAnnotation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go index b4c8ce1c..d6655c7c 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/authority.proto @@ -9,7 +9,6 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Authority struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go index 482db87f..0e9a4deb 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/cidr.proto @@ -9,7 +9,6 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" wrappers "github.com/golang/protobuf/ptypes/wrappers" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -24,10 +23,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type CidrRange struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go index f325e11f..8f598cb6 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/collection_entry.proto @@ -9,8 +9,7 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" + any1 "github.com/golang/protobuf/ptypes/any" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -24,16 +23,13 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type CollectionEntry struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to ResourceSpecifier: + // // *CollectionEntry_Locator // *CollectionEntry_InlineEntry_ ResourceSpecifier isCollectionEntry_ResourceSpecifier `protobuf_oneof:"resource_specifier"` @@ -113,9 +109,9 @@ type CollectionEntry_InlineEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Resource *any.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Resource *any1.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` } func (x *CollectionEntry_InlineEntry) Reset() { @@ -164,7 +160,7 @@ func (x *CollectionEntry_InlineEntry) GetVersion() string { return "" } -func (x *CollectionEntry_InlineEntry) GetResource() *any.Any { +func (x *CollectionEntry_InlineEntry) GetResource() *any1.Any { if x != nil { return x.Resource } @@ -231,7 +227,7 @@ var file_xds_core_v3_collection_entry_proto_goTypes = []interface{}{ (*CollectionEntry)(nil), // 0: xds.core.v3.CollectionEntry (*CollectionEntry_InlineEntry)(nil), // 1: xds.core.v3.CollectionEntry.InlineEntry (*ResourceLocator)(nil), // 2: xds.core.v3.ResourceLocator - (*any.Any)(nil), // 3: google.protobuf.Any + (*any1.Any)(nil), // 3: google.protobuf.Any } var file_xds_core_v3_collection_entry_proto_depIdxs = []int32{ 2, // 0: xds.core.v3.CollectionEntry.locator:type_name -> xds.core.v3.ResourceLocator diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go index 7473f909..2d0e2b6e 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/context_params.proto @@ -8,7 +8,6 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type ContextParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go index 4b801ee0..ba0c2464 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/extension.proto @@ -8,8 +8,7 @@ package v3 import ( _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" + any1 "github.com/golang/protobuf/ptypes/any" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -23,17 +22,13 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type TypedExtensionConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - TypedConfig *any.Any `protobuf:"bytes,2,opt,name=typed_config,json=typedConfig,proto3" json:"typed_config,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TypedConfig *any1.Any `protobuf:"bytes,2,opt,name=typed_config,json=typedConfig,proto3" json:"typed_config,omitempty"` } func (x *TypedExtensionConfig) Reset() { @@ -75,7 +70,7 @@ func (x *TypedExtensionConfig) GetName() string { return "" } -func (x *TypedExtensionConfig) GetTypedConfig() *any.Any { +func (x *TypedExtensionConfig) GetTypedConfig() *any1.Any { if x != nil { return x.TypedConfig } @@ -121,7 +116,7 @@ func file_xds_core_v3_extension_proto_rawDescGZIP() []byte { var file_xds_core_v3_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_xds_core_v3_extension_proto_goTypes = []interface{}{ (*TypedExtensionConfig)(nil), // 0: xds.core.v3.TypedExtensionConfig - (*any.Any)(nil), // 1: google.protobuf.Any + (*any1.Any)(nil), // 1: google.protobuf.Any } var file_xds_core_v3_extension_proto_depIdxs = []int32{ 1, // 0: xds.core.v3.TypedExtensionConfig.typed_config:type_name -> google.protobuf.Any diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go index 42882efa..915e3c73 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/resource.proto @@ -8,8 +8,7 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" + any1 "github.com/golang/protobuf/ptypes/any" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Resource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -34,7 +29,7 @@ type Resource struct { Name *ResourceName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Resource *any.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + Resource *any1.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` } func (x *Resource) Reset() { @@ -83,7 +78,7 @@ func (x *Resource) GetVersion() string { return "" } -func (x *Resource) GetResource() *any.Any { +func (x *Resource) GetResource() *any1.Any { if x != nil { return x.Resource } @@ -134,7 +129,7 @@ var file_xds_core_v3_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_xds_core_v3_resource_proto_goTypes = []interface{}{ (*Resource)(nil), // 0: xds.core.v3.Resource (*ResourceName)(nil), // 1: xds.core.v3.ResourceName - (*any.Any)(nil), // 2: google.protobuf.Any + (*any1.Any)(nil), // 2: google.protobuf.Any } var file_xds_core_v3_resource_proto_depIdxs = []int32{ 1, // 0: xds.core.v3.Resource.name:type_name -> xds.core.v3.ResourceName diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go index d0cdd8a3..bc28d50b 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/resource_locator.proto @@ -9,7 +9,6 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type ResourceLocator_Scheme int32 const ( @@ -86,6 +81,7 @@ type ResourceLocator struct { Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` ResourceType string `protobuf:"bytes,4,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` // Types that are assignable to ContextParamSpecifier: + // // *ResourceLocator_ExactContext ContextParamSpecifier isResourceLocator_ContextParamSpecifier `protobuf_oneof:"context_param_specifier"` Directives []*ResourceLocator_Directive `protobuf:"bytes,6,rep,name=directives,proto3" json:"directives,omitempty"` @@ -188,6 +184,7 @@ type ResourceLocator_Directive struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Directive: + // // *ResourceLocator_Directive_Alt // *ResourceLocator_Directive_Entry Directive isResourceLocator_Directive_Directive `protobuf_oneof:"directive"` diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go index 0ef98bb7..92a54df4 100644 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go +++ b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.18.0 // source: xds/core/v3/resource_name.proto @@ -9,7 +9,6 @@ package v3 import ( _ "github.com/cncf/xds/go/xds/annotations/v3" _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -23,10 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type ResourceName struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/vendor/github.com/go-viper/mapstructure/v2/.editorconfig b/vendor/github.com/go-viper/mapstructure/v2/.editorconfig new file mode 100644 index 00000000..1f664d13 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab + +[{Makefile,*.mk}] +indent_style = tab + +[*.nix] +indent_size = 2 diff --git a/vendor/github.com/go-viper/mapstructure/v2/.envrc b/vendor/github.com/go-viper/mapstructure/v2/.envrc new file mode 100644 index 00000000..c66fc0d3 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/.envrc @@ -0,0 +1,4 @@ +if ! has nix_direnv_version || ! nix_direnv_version 3.0.1; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.1/direnvrc" "sha256-17G+Mvt/JsyJrwsf7bqMr7ho7liHP+0Lo4RMIHgp0F8=" +fi +use flake . --impure diff --git a/vendor/github.com/go-viper/mapstructure/v2/.gitignore b/vendor/github.com/go-viper/mapstructure/v2/.gitignore new file mode 100644 index 00000000..470e7ca2 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/.gitignore @@ -0,0 +1,6 @@ +/.devenv/ +/.direnv/ +/.pre-commit-config.yaml +/bin/ +/build/ +/var/ diff --git a/vendor/github.com/go-viper/mapstructure/v2/.golangci.yaml b/vendor/github.com/go-viper/mapstructure/v2/.golangci.yaml new file mode 100644 index 00000000..763143aa --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/.golangci.yaml @@ -0,0 +1,23 @@ +run: + timeout: 5m + +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/go-viper/mapstructure) + golint: + min-confidence: 0 + goimports: + local-prefixes: github.com/go-viper/maptstructure + +linters: + disable-all: true + enable: + - gci + - gofmt + - gofumpt + - goimports + - staticcheck + # - stylecheck diff --git a/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md b/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md new file mode 100644 index 00000000..ae634d1c --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md @@ -0,0 +1,101 @@ +## 1.5.1 + +* Wrap errors so they're compatible with `errors.Is` and `errors.As` [GH-282] +* Fix map of slices not decoding properly in certain cases. [GH-266] + +## 1.5.0 + +* New option `IgnoreUntaggedFields` to ignore decoding to any fields + without `mapstructure` (or the configured tag name) set [GH-277] +* New option `ErrorUnset` which makes it an error if any fields + in a target struct are not set by the decoding process. [GH-225] +* New function `OrComposeDecodeHookFunc` to help compose decode hooks. [GH-240] +* Decoding to slice from array no longer crashes [GH-265] +* Decode nested struct pointers to map [GH-271] +* Fix issue where `,squash` was ignored if `Squash` option was set. [GH-280] +* Fix issue where fields with `,omitempty` would sometimes decode + into a map with an empty string key [GH-281] + +## 1.4.3 + +* Fix cases where `json.Number` didn't decode properly [GH-261] + +## 1.4.2 + +* Custom name matchers to support any sort of casing, formatting, etc. for + field names. [GH-250] +* Fix possible panic in ComposeDecodeHookFunc [GH-251] + +## 1.4.1 + +* Fix regression where `*time.Time` value would be set to empty and not be sent + to decode hooks properly [GH-232] + +## 1.4.0 + +* A new decode hook type `DecodeHookFuncValue` has been added that has + access to the full values. [GH-183] +* Squash is now supported with embedded fields that are struct pointers [GH-205] +* Empty strings will convert to 0 for all numeric types when weakly decoding [GH-206] + +## 1.3.3 + +* Decoding maps from maps creates a settable value for decode hooks [GH-203] + +## 1.3.2 + +* Decode into interface type with a struct value is supported [GH-187] + +## 1.3.1 + +* Squash should only squash embedded structs. [GH-194] + +## 1.3.0 + +* Added `",omitempty"` support. This will ignore zero values in the source + structure when encoding. [GH-145] + +## 1.2.3 + +* Fix duplicate entries in Keys list with pointer values. [GH-185] + +## 1.2.2 + +* Do not add unsettable (unexported) values to the unused metadata key + or "remain" value. [GH-150] + +## 1.2.1 + +* Go modules checksum mismatch fix + +## 1.2.0 + +* Added support to capture unused values in a field using the `",remain"` value + in the mapstructure tag. There is an example to showcase usage. +* Added `DecoderConfig` option to always squash embedded structs +* `json.Number` can decode into `uint` types +* Empty slices are preserved and not replaced with nil slices +* Fix panic that can occur in when decoding a map into a nil slice of structs +* Improved package documentation for godoc + +## 1.1.2 + +* Fix error when decode hook decodes interface implementation into interface + type. [GH-140] + +## 1.1.1 + +* Fix panic that can happen in `decodePtr` + +## 1.1.0 + +* Added `StringToIPHookFunc` to convert `string` to `net.IP` and `net.IPNet` [GH-133] +* Support struct to struct decoding [GH-137] +* If source map value is nil, then destination map value is nil (instead of empty) +* If source slice value is nil, then destination slice value is nil (instead of empty) +* If source pointer is nil, then destination pointer is set to nil (instead of + allocated zero value of type) + +## 1.0.0 + +* Initial tagged stable release. diff --git a/vendor/github.com/go-viper/mapstructure/v2/LICENSE b/vendor/github.com/go-viper/mapstructure/v2/LICENSE new file mode 100644 index 00000000..f9c841a5 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Mitchell Hashimoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/go-viper/mapstructure/v2/README.md b/vendor/github.com/go-viper/mapstructure/v2/README.md new file mode 100644 index 00000000..2b28db89 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/README.md @@ -0,0 +1,59 @@ +# mapstructure + +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/go-viper/mapstructure/ci.yaml?branch=main&style=flat-square)](https://github.com/go-viper/mapstructure/actions?query=workflow%3ACI) +[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/mod/github.com/go-viper/mapstructure/v2) +![Go Version](https://img.shields.io/badge/go%20version-%3E=1.18-61CFDD.svg?style=flat-square) + +mapstructure is a Go library for decoding generic map values to structures +and vice versa, while providing helpful error handling. + +This library is most useful when decoding values from some data stream (JSON, +Gob, etc.) where you don't _quite_ know the structure of the underlying data +until you read a part of it. You can therefore read a `map[string]interface{}` +and use this library to decode it into the proper underlying native Go +structure. + +## Installation + +```shell +go get github.com/go-viper/mapstructure/v2 +``` + +## Usage & Example + +For usage and examples see the [documentation](https://pkg.go.dev/mod/github.com/go-viper/mapstructure/v2). + +The `Decode` function has examples associated with it there. + +## But Why?! + +Go offers fantastic standard libraries for decoding formats such as JSON. +The standard method is to have a struct pre-created, and populate that struct +from the bytes of the encoded format. This is great, but the problem is if +you have configuration or an encoding that changes slightly depending on +specific fields. For example, consider this JSON: + +```json +{ + "type": "person", + "name": "Mitchell" +} +``` + +Perhaps we can't populate a specific structure without first reading +the "type" field from the JSON. We could always do two passes over the +decoding of the JSON (reading the "type" first, and the rest later). +However, it is much simpler to just decode this into a `map[string]interface{}` +structure, read the "type" key, then use something like this library +to decode it into the proper structure. + +## Credits + +Mapstructure was originally created by [@mitchellh](https://github.com/mitchellh). +This is a maintained fork of the original library. + +Read more about the reasons for the fork [here](https://github.com/mitchellh/mapstructure/issues/349). + +## License + +The project is licensed under the [MIT License](LICENSE). diff --git a/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go b/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go new file mode 100644 index 00000000..840d6adc --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go @@ -0,0 +1,334 @@ +package mapstructure + +import ( + "encoding" + "errors" + "fmt" + "net" + "net/netip" + "reflect" + "strconv" + "strings" + "time" +) + +// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns +// it into the proper DecodeHookFunc type, such as DecodeHookFuncType. +func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc { + // Create variables here so we can reference them with the reflect pkg + var f1 DecodeHookFuncType + var f2 DecodeHookFuncKind + var f3 DecodeHookFuncValue + + // Fill in the variables into this interface and the rest is done + // automatically using the reflect package. + potential := []interface{}{f1, f2, f3} + + v := reflect.ValueOf(h) + vt := v.Type() + for _, raw := range potential { + pt := reflect.ValueOf(raw).Type() + if vt.ConvertibleTo(pt) { + return v.Convert(pt).Interface() + } + } + + return nil +} + +// DecodeHookExec executes the given decode hook. This should be used +// since it'll naturally degrade to the older backwards compatible DecodeHookFunc +// that took reflect.Kind instead of reflect.Type. +func DecodeHookExec( + raw DecodeHookFunc, + from reflect.Value, to reflect.Value, +) (interface{}, error) { + switch f := typedDecodeHook(raw).(type) { + case DecodeHookFuncType: + return f(from.Type(), to.Type(), from.Interface()) + case DecodeHookFuncKind: + return f(from.Kind(), to.Kind(), from.Interface()) + case DecodeHookFuncValue: + return f(from, to) + default: + return nil, errors.New("invalid decode hook signature") + } +} + +// ComposeDecodeHookFunc creates a single DecodeHookFunc that +// automatically composes multiple DecodeHookFuncs. +// +// The composed funcs are called in order, with the result of the +// previous transformation. +func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc { + return func(f reflect.Value, t reflect.Value) (interface{}, error) { + var err error + data := f.Interface() + + newFrom := f + for _, f1 := range fs { + data, err = DecodeHookExec(f1, newFrom, t) + if err != nil { + return nil, err + } + newFrom = reflect.ValueOf(data) + } + + return data, nil + } +} + +// OrComposeDecodeHookFunc executes all input hook functions until one of them returns no error. In that case its value is returned. +// If all hooks return an error, OrComposeDecodeHookFunc returns an error concatenating all error messages. +func OrComposeDecodeHookFunc(ff ...DecodeHookFunc) DecodeHookFunc { + return func(a, b reflect.Value) (interface{}, error) { + var allErrs string + var out interface{} + var err error + + for _, f := range ff { + out, err = DecodeHookExec(f, a, b) + if err != nil { + allErrs += err.Error() + "\n" + continue + } + + return out, nil + } + + return nil, errors.New(allErrs) + } +} + +// StringToSliceHookFunc returns a DecodeHookFunc that converts +// string to []string by splitting on the given sep. +func StringToSliceHookFunc(sep string) DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.SliceOf(f) { + return data, nil + } + + raw := data.(string) + if raw == "" { + return []string{}, nil + } + + return strings.Split(raw, sep), nil + } +} + +// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts +// strings to time.Duration. +func StringToTimeDurationHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(time.Duration(5)) { + return data, nil + } + + // Convert it by parsing + return time.ParseDuration(data.(string)) + } +} + +// StringToIPHookFunc returns a DecodeHookFunc that converts +// strings to net.IP +func StringToIPHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(net.IP{}) { + return data, nil + } + + // Convert it by parsing + ip := net.ParseIP(data.(string)) + if ip == nil { + return net.IP{}, fmt.Errorf("failed parsing ip %v", data) + } + + return ip, nil + } +} + +// StringToIPNetHookFunc returns a DecodeHookFunc that converts +// strings to net.IPNet +func StringToIPNetHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(net.IPNet{}) { + return data, nil + } + + // Convert it by parsing + _, net, err := net.ParseCIDR(data.(string)) + return net, err + } +} + +// StringToTimeHookFunc returns a DecodeHookFunc that converts +// strings to time.Time. +func StringToTimeHookFunc(layout string) DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(time.Time{}) { + return data, nil + } + + // Convert it by parsing + return time.Parse(layout, data.(string)) + } +} + +// WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to +// the decoder. +// +// Note that this is significantly different from the WeaklyTypedInput option +// of the DecoderConfig. +func WeaklyTypedHook( + f reflect.Kind, + t reflect.Kind, + data interface{}, +) (interface{}, error) { + dataVal := reflect.ValueOf(data) + switch t { + case reflect.String: + switch f { + case reflect.Bool: + if dataVal.Bool() { + return "1", nil + } + return "0", nil + case reflect.Float32: + return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil + case reflect.Int: + return strconv.FormatInt(dataVal.Int(), 10), nil + case reflect.Slice: + dataType := dataVal.Type() + elemKind := dataType.Elem().Kind() + if elemKind == reflect.Uint8 { + return string(dataVal.Interface().([]uint8)), nil + } + case reflect.Uint: + return strconv.FormatUint(dataVal.Uint(), 10), nil + } + } + + return data, nil +} + +func RecursiveStructToMapHookFunc() DecodeHookFunc { + return func(f reflect.Value, t reflect.Value) (interface{}, error) { + if f.Kind() != reflect.Struct { + return f.Interface(), nil + } + + var i interface{} = struct{}{} + if t.Type() != reflect.TypeOf(&i).Elem() { + return f.Interface(), nil + } + + m := make(map[string]interface{}) + t.Set(reflect.ValueOf(m)) + + return f.Interface(), nil + } +} + +// TextUnmarshallerHookFunc returns a DecodeHookFunc that applies +// strings to the UnmarshalText function, when the target type +// implements the encoding.TextUnmarshaler interface +func TextUnmarshallerHookFunc() DecodeHookFuncType { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + result := reflect.New(t).Interface() + unmarshaller, ok := result.(encoding.TextUnmarshaler) + if !ok { + return data, nil + } + str, ok := data.(string) + if !ok { + str = reflect.Indirect(reflect.ValueOf(&data)).Elem().String() + } + if err := unmarshaller.UnmarshalText([]byte(str)); err != nil { + return nil, err + } + return result, nil + } +} + +// StringToNetIPAddrHookFunc returns a DecodeHookFunc that converts +// strings to netip.Addr. +func StringToNetIPAddrHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(netip.Addr{}) { + return data, nil + } + + // Convert it by parsing + return netip.ParseAddr(data.(string)) + } +} + +// StringToNetIPAddrPortHookFunc returns a DecodeHookFunc that converts +// strings to netip.AddrPort. +func StringToNetIPAddrPortHookFunc() DecodeHookFunc { + return func( + f reflect.Type, + t reflect.Type, + data interface{}, + ) (interface{}, error) { + if f.Kind() != reflect.String { + return data, nil + } + if t != reflect.TypeOf(netip.AddrPort{}) { + return data, nil + } + + // Convert it by parsing + return netip.ParseAddrPort(data.(string)) + } +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/error.go b/vendor/github.com/go-viper/mapstructure/v2/error.go new file mode 100644 index 00000000..47a99e5a --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/error.go @@ -0,0 +1,50 @@ +package mapstructure + +import ( + "errors" + "fmt" + "sort" + "strings" +) + +// Error implements the error interface and can represents multiple +// errors that occur in the course of a single decode. +type Error struct { + Errors []string +} + +func (e *Error) Error() string { + points := make([]string, len(e.Errors)) + for i, err := range e.Errors { + points[i] = fmt.Sprintf("* %s", err) + } + + sort.Strings(points) + return fmt.Sprintf( + "%d error(s) decoding:\n\n%s", + len(e.Errors), strings.Join(points, "\n")) +} + +// WrappedErrors implements the errwrap.Wrapper interface to make this +// return value more useful with the errwrap and go-multierror libraries. +func (e *Error) WrappedErrors() []error { + if e == nil { + return nil + } + + result := make([]error, len(e.Errors)) + for i, e := range e.Errors { + result[i] = errors.New(e) + } + + return result +} + +func appendErrors(errors []string, err error) []string { + switch e := err.(type) { + case *Error: + return append(errors, e.Errors...) + default: + return append(errors, e.Error()) + } +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/flake.lock b/vendor/github.com/go-viper/mapstructure/v2/flake.lock new file mode 100644 index 00000000..5a387d32 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/flake.lock @@ -0,0 +1,273 @@ +{ + "nodes": { + "devenv": { + "inputs": { + "flake-compat": "flake-compat", + "nix": "nix", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1702549996, + "narHash": "sha256-mEN+8gjWUXRxBCcixeth+jlDNuzxbpFwZNOEc4K22vw=", + "owner": "cachix", + "repo": "devenv", + "rev": "e681a99ffe2d2882f413a5d771129223c838ddce", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1678875422, + "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1702539185, + "narHash": "sha256-KnIRG5NMdLIpEkZTnN5zovNYc0hhXjAgv6pfd5Z4c7U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "aa9d4729cbc99dabacb50e3994dcefb3ea0f7447", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1688056373, + "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/flake.nix b/vendor/github.com/go-viper/mapstructure/v2/flake.nix new file mode 100644 index 00000000..4ed0f533 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/flake.nix @@ -0,0 +1,39 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + devenv.url = "github:cachix/devenv"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.devenv.flakeModule + ]; + + systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + perSystem = { config, self', inputs', pkgs, system, ... }: rec { + devenv.shells = { + default = { + languages = { + go.enable = true; + }; + + pre-commit.hooks = { + nixpkgs-fmt.enable = true; + }; + + packages = with pkgs; [ + golangci-lint + ]; + + # https://github.com/cachix/devenv/issues/528#issuecomment-1556108767 + containers = pkgs.lib.mkForce { }; + }; + + ci = devenv.shells.default; + }; + }; + }; +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go b/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go new file mode 100644 index 00000000..27f21bc7 --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go @@ -0,0 +1,1562 @@ +// Package mapstructure exposes functionality to convert one arbitrary +// Go type into another, typically to convert a map[string]interface{} +// into a native Go structure. +// +// The Go structure can be arbitrarily complex, containing slices, +// other structs, etc. and the decoder will properly decode nested +// maps and so on into the proper structures in the native Go struct. +// See the examples to see what the decoder is capable of. +// +// The simplest function to start with is Decode. +// +// # Field Tags +// +// When decoding to a struct, mapstructure will use the field name by +// default to perform the mapping. For example, if a struct has a field +// "Username" then mapstructure will look for a key in the source value +// of "username" (case insensitive). +// +// type User struct { +// Username string +// } +// +// You can change the behavior of mapstructure by using struct tags. +// The default struct tag that mapstructure looks for is "mapstructure" +// but you can customize it using DecoderConfig. +// +// # Renaming Fields +// +// To rename the key that mapstructure looks for, use the "mapstructure" +// tag and set a value directly. For example, to change the "username" example +// above to "user": +// +// type User struct { +// Username string `mapstructure:"user"` +// } +// +// # Embedded Structs and Squashing +// +// Embedded structs are treated as if they're another field with that name. +// By default, the two structs below are equivalent when decoding with +// mapstructure: +// +// type Person struct { +// Name string +// } +// +// type Friend struct { +// Person +// } +// +// type Friend struct { +// Person Person +// } +// +// This would require an input that looks like below: +// +// map[string]interface{}{ +// "person": map[string]interface{}{"name": "alice"}, +// } +// +// If your "person" value is NOT nested, then you can append ",squash" to +// your tag value and mapstructure will treat it as if the embedded struct +// were part of the struct directly. Example: +// +// type Friend struct { +// Person `mapstructure:",squash"` +// } +// +// Now the following input would be accepted: +// +// map[string]interface{}{ +// "name": "alice", +// } +// +// When decoding from a struct to a map, the squash tag squashes the struct +// fields into a single map. Using the example structs from above: +// +// Friend{Person: Person{Name: "alice"}} +// +// Will be decoded into a map: +// +// map[string]interface{}{ +// "name": "alice", +// } +// +// DecoderConfig has a field that changes the behavior of mapstructure +// to always squash embedded structs. +// +// # Remainder Values +// +// If there are any unmapped keys in the source value, mapstructure by +// default will silently ignore them. You can error by setting ErrorUnused +// in DecoderConfig. If you're using Metadata you can also maintain a slice +// of the unused keys. +// +// You can also use the ",remain" suffix on your tag to collect all unused +// values in a map. The field with this tag MUST be a map type and should +// probably be a "map[string]interface{}" or "map[interface{}]interface{}". +// See example below: +// +// type Friend struct { +// Name string +// Other map[string]interface{} `mapstructure:",remain"` +// } +// +// Given the input below, Other would be populated with the other +// values that weren't used (everything but "name"): +// +// map[string]interface{}{ +// "name": "bob", +// "address": "123 Maple St.", +// } +// +// # Omit Empty Values +// +// When decoding from a struct to any other value, you may use the +// ",omitempty" suffix on your tag to omit that value if it equates to +// the zero value. The zero value of all types is specified in the Go +// specification. +// +// For example, the zero type of a numeric type is zero ("0"). If the struct +// field value is zero and a numeric type, the field is empty, and it won't +// be encoded into the destination type. +// +// type Source struct { +// Age int `mapstructure:",omitempty"` +// } +// +// # Unexported fields +// +// Since unexported (private) struct fields cannot be set outside the package +// where they are defined, the decoder will simply skip them. +// +// For this output type definition: +// +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } +// +// Using this map as input: +// +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } +// +// The following struct will be decoded: +// +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// } +// +// # Other Configuration +// +// mapstructure is highly configurable. See the DecoderConfig struct +// for other features and options that are supported. +package mapstructure + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" + "strconv" + "strings" +) + +// DecodeHookFunc is the callback function that can be used for +// data transformations. See "DecodeHook" in the DecoderConfig +// struct. +// +// The type must be one of DecodeHookFuncType, DecodeHookFuncKind, or +// DecodeHookFuncValue. +// Values are a superset of Types (Values can return types), and Types are a +// superset of Kinds (Types can return Kinds) and are generally a richer thing +// to use, but Kinds are simpler if you only need those. +// +// The reason DecodeHookFunc is multi-typed is for backwards compatibility: +// we started with Kinds and then realized Types were the better solution, +// but have a promise to not break backwards compat so we now support +// both. +type DecodeHookFunc interface{} + +// DecodeHookFuncType is a DecodeHookFunc which has complete information about +// the source and target types. +type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error) + +// DecodeHookFuncKind is a DecodeHookFunc which knows only the Kinds of the +// source and target types. +type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) + +// DecodeHookFuncValue is a DecodeHookFunc which has complete access to both the source and target +// values. +type DecodeHookFuncValue func(from reflect.Value, to reflect.Value) (interface{}, error) + +// DecoderConfig is the configuration that is used to create a new decoder +// and allows customization of various aspects of decoding. +type DecoderConfig struct { + // DecodeHook, if set, will be called before any decoding and any + // type conversion (if WeaklyTypedInput is on). This lets you modify + // the values before they're set down onto the resulting struct. The + // DecodeHook is called for every map and value in the input. This means + // that if a struct has embedded fields with squash tags the decode hook + // is called only once with all of the input data, not once for each + // embedded struct. + // + // If an error is returned, the entire decode will fail with that error. + DecodeHook DecodeHookFunc + + // If ErrorUnused is true, then it is an error for there to exist + // keys in the original map that were unused in the decoding process + // (extra keys). + ErrorUnused bool + + // If ErrorUnset is true, then it is an error for there to exist + // fields in the result that were not set in the decoding process + // (extra fields). This only applies to decoding to a struct. This + // will affect all nested structs as well. + ErrorUnset bool + + // ZeroFields, if set to true, will zero fields before writing them. + // For example, a map will be emptied before decoded values are put in + // it. If this is false, a map will be merged. + ZeroFields bool + + // If WeaklyTypedInput is true, the decoder will make the following + // "weak" conversions: + // + // - bools to string (true = "1", false = "0") + // - numbers to string (base 10) + // - bools to int/uint (true = 1, false = 0) + // - strings to int/uint (base implied by prefix) + // - int to bool (true if value != 0) + // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F, + // FALSE, false, False. Anything else is an error) + // - empty array = empty map and vice versa + // - negative numbers to overflowed uint values (base 10) + // - slice of maps to a merged map + // - single values are converted to slices if required. Each + // element is weakly decoded. For example: "4" can become []int{4} + // if the target type is an int slice. + // + WeaklyTypedInput bool + + // Squash will squash embedded structs. A squash tag may also be + // added to an individual struct field using a tag. For example: + // + // type Parent struct { + // Child `mapstructure:",squash"` + // } + Squash bool + + // Metadata is the struct that will contain extra metadata about + // the decoding. If this is nil, then no metadata will be tracked. + Metadata *Metadata + + // Result is a pointer to the struct that will contain the decoded + // value. + Result interface{} + + // The tag name that mapstructure reads for field names. This + // defaults to "mapstructure" + TagName string + + // IgnoreUntaggedFields ignores all struct fields without explicit + // TagName, comparable to `mapstructure:"-"` as default behaviour. + IgnoreUntaggedFields bool + + // MatchName is the function used to match the map key to the struct + // field name or tag. Defaults to `strings.EqualFold`. This can be used + // to implement case-sensitive tag values, support snake casing, etc. + MatchName func(mapKey, fieldName string) bool +} + +// A Decoder takes a raw interface value and turns it into structured +// data, keeping track of rich error information along the way in case +// anything goes wrong. Unlike the basic top-level Decode method, you can +// more finely control how the Decoder behaves using the DecoderConfig +// structure. The top-level Decode method is just a convenience that sets +// up the most basic Decoder. +type Decoder struct { + config *DecoderConfig +} + +// Metadata contains information about decoding a structure that +// is tedious or difficult to get otherwise. +type Metadata struct { + // Keys are the keys of the structure which were successfully decoded + Keys []string + + // Unused is a slice of keys that were found in the raw value but + // weren't decoded since there was no matching field in the result interface + Unused []string + + // Unset is a slice of field names that were found in the result interface + // but weren't set in the decoding process since there was no matching value + // in the input + Unset []string +} + +// Decode takes an input structure and uses reflection to translate it to +// the output structure. output must be a pointer to a map or struct. +func Decode(input interface{}, output interface{}) error { + config := &DecoderConfig{ + Metadata: nil, + Result: output, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +// WeakDecode is the same as Decode but is shorthand to enable +// WeaklyTypedInput. See DecoderConfig for more info. +func WeakDecode(input, output interface{}) error { + config := &DecoderConfig{ + Metadata: nil, + Result: output, + WeaklyTypedInput: true, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +// DecodeMetadata is the same as Decode, but is shorthand to +// enable metadata collection. See DecoderConfig for more info. +func DecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error { + config := &DecoderConfig{ + Metadata: metadata, + Result: output, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +// WeakDecodeMetadata is the same as Decode, but is shorthand to +// enable both WeaklyTypedInput and metadata collection. See +// DecoderConfig for more info. +func WeakDecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error { + config := &DecoderConfig{ + Metadata: metadata, + Result: output, + WeaklyTypedInput: true, + } + + decoder, err := NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +// NewDecoder returns a new decoder for the given configuration. Once +// a decoder has been returned, the same configuration must not be used +// again. +func NewDecoder(config *DecoderConfig) (*Decoder, error) { + val := reflect.ValueOf(config.Result) + if val.Kind() != reflect.Ptr { + return nil, errors.New("result must be a pointer") + } + + val = val.Elem() + if !val.CanAddr() { + return nil, errors.New("result must be addressable (a pointer)") + } + + if config.Metadata != nil { + if config.Metadata.Keys == nil { + config.Metadata.Keys = make([]string, 0) + } + + if config.Metadata.Unused == nil { + config.Metadata.Unused = make([]string, 0) + } + + if config.Metadata.Unset == nil { + config.Metadata.Unset = make([]string, 0) + } + } + + if config.TagName == "" { + config.TagName = "mapstructure" + } + + if config.MatchName == nil { + config.MatchName = strings.EqualFold + } + + result := &Decoder{ + config: config, + } + + return result, nil +} + +// Decode decodes the given raw interface to the target pointer specified +// by the configuration. +func (d *Decoder) Decode(input interface{}) error { + return d.decode("", input, reflect.ValueOf(d.config.Result).Elem()) +} + +// Decodes an unknown data type into a specific reflection value. +func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error { + var inputVal reflect.Value + if input != nil { + inputVal = reflect.ValueOf(input) + + // We need to check here if input is a typed nil. Typed nils won't + // match the "input == nil" below so we check that here. + if inputVal.Kind() == reflect.Ptr && inputVal.IsNil() { + input = nil + } + } + + if input == nil { + // If the data is nil, then we don't set anything, unless ZeroFields is set + // to true. + if d.config.ZeroFields { + outVal.Set(reflect.Zero(outVal.Type())) + + if d.config.Metadata != nil && name != "" { + d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) + } + } + return nil + } + + if !inputVal.IsValid() { + // If the input value is invalid, then we just set the value + // to be the zero value. + outVal.Set(reflect.Zero(outVal.Type())) + if d.config.Metadata != nil && name != "" { + d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) + } + return nil + } + + if d.config.DecodeHook != nil { + // We have a DecodeHook, so let's pre-process the input. + var err error + input, err = DecodeHookExec(d.config.DecodeHook, inputVal, outVal) + if err != nil { + return fmt.Errorf("error decoding '%s': %w", name, err) + } + } + + var err error + outputKind := getKind(outVal) + addMetaKey := true + switch outputKind { + case reflect.Bool: + err = d.decodeBool(name, input, outVal) + case reflect.Interface: + err = d.decodeBasic(name, input, outVal) + case reflect.String: + err = d.decodeString(name, input, outVal) + case reflect.Int: + err = d.decodeInt(name, input, outVal) + case reflect.Uint: + err = d.decodeUint(name, input, outVal) + case reflect.Float32: + err = d.decodeFloat(name, input, outVal) + case reflect.Struct: + err = d.decodeStruct(name, input, outVal) + case reflect.Map: + err = d.decodeMap(name, input, outVal) + case reflect.Ptr: + addMetaKey, err = d.decodePtr(name, input, outVal) + case reflect.Slice: + err = d.decodeSlice(name, input, outVal) + case reflect.Array: + err = d.decodeArray(name, input, outVal) + case reflect.Func: + err = d.decodeFunc(name, input, outVal) + default: + // If we reached this point then we weren't able to decode it + return fmt.Errorf("%s: unsupported type: %s", name, outputKind) + } + + // If we reached here, then we successfully decoded SOMETHING, so + // mark the key as used if we're tracking metainput. + if addMetaKey && d.config.Metadata != nil && name != "" { + d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) + } + + return err +} + +// This decodes a basic type (bool, int, string, etc.) and sets the +// value to "data" of that type. +func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error { + if val.IsValid() && val.Elem().IsValid() { + elem := val.Elem() + + // If we can't address this element, then its not writable. Instead, + // we make a copy of the value (which is a pointer and therefore + // writable), decode into that, and replace the whole value. + copied := false + if !elem.CanAddr() { + copied = true + + // Make *T + copy := reflect.New(elem.Type()) + + // *T = elem + copy.Elem().Set(elem) + + // Set elem so we decode into it + elem = copy + } + + // Decode. If we have an error then return. We also return right + // away if we're not a copy because that means we decoded directly. + if err := d.decode(name, data, elem); err != nil || !copied { + return err + } + + // If we're a copy, we need to set te final result + val.Set(elem.Elem()) + return nil + } + + dataVal := reflect.ValueOf(data) + + // If the input data is a pointer, and the assigned type is the dereference + // of that exact pointer, then indirect it so that we can assign it. + // Example: *string to string + if dataVal.Kind() == reflect.Ptr && dataVal.Type().Elem() == val.Type() { + dataVal = reflect.Indirect(dataVal) + } + + if !dataVal.IsValid() { + dataVal = reflect.Zero(val.Type()) + } + + dataValType := dataVal.Type() + if !dataValType.AssignableTo(val.Type()) { + return fmt.Errorf( + "'%s' expected type '%s', got '%s'", + name, val.Type(), dataValType) + } + + val.Set(dataVal) + return nil +} + +func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + + converted := true + switch { + case dataKind == reflect.String: + val.SetString(dataVal.String()) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetString("1") + } else { + val.SetString("0") + } + case dataKind == reflect.Int && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatInt(dataVal.Int(), 10)) + case dataKind == reflect.Uint && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatUint(dataVal.Uint(), 10)) + case dataKind == reflect.Float32 && d.config.WeaklyTypedInput: + val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64)) + case dataKind == reflect.Slice && d.config.WeaklyTypedInput, + dataKind == reflect.Array && d.config.WeaklyTypedInput: + dataType := dataVal.Type() + elemKind := dataType.Elem().Kind() + switch elemKind { + case reflect.Uint8: + var uints []uint8 + if dataKind == reflect.Array { + uints = make([]uint8, dataVal.Len(), dataVal.Len()) + for i := range uints { + uints[i] = dataVal.Index(i).Interface().(uint8) + } + } else { + uints = dataVal.Interface().([]uint8) + } + val.SetString(string(uints)) + default: + converted = false + } + default: + converted = false + } + + if !converted { + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + +func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + dataType := dataVal.Type() + + switch { + case dataKind == reflect.Int: + val.SetInt(dataVal.Int()) + case dataKind == reflect.Uint: + val.SetInt(int64(dataVal.Uint())) + case dataKind == reflect.Float32: + val.SetInt(int64(dataVal.Float())) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetInt(1) + } else { + val.SetInt(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + str := dataVal.String() + if str == "" { + str = "0" + } + + i, err := strconv.ParseInt(str, 0, val.Type().Bits()) + if err == nil { + val.SetInt(i) + } else { + return fmt.Errorf("cannot parse '%s' as int: %s", name, err) + } + case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number": + jn := data.(json.Number) + i, err := jn.Int64() + if err != nil { + return fmt.Errorf( + "error decoding json.Number into %s: %s", name, err) + } + val.SetInt(i) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + +func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + dataType := dataVal.Type() + + switch { + case dataKind == reflect.Int: + i := dataVal.Int() + if i < 0 && !d.config.WeaklyTypedInput { + return fmt.Errorf("cannot parse '%s', %d overflows uint", + name, i) + } + val.SetUint(uint64(i)) + case dataKind == reflect.Uint: + val.SetUint(dataVal.Uint()) + case dataKind == reflect.Float32: + f := dataVal.Float() + if f < 0 && !d.config.WeaklyTypedInput { + return fmt.Errorf("cannot parse '%s', %f overflows uint", + name, f) + } + val.SetUint(uint64(f)) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetUint(1) + } else { + val.SetUint(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + str := dataVal.String() + if str == "" { + str = "0" + } + + i, err := strconv.ParseUint(str, 0, val.Type().Bits()) + if err == nil { + val.SetUint(i) + } else { + return fmt.Errorf("cannot parse '%s' as uint: %s", name, err) + } + case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number": + jn := data.(json.Number) + i, err := strconv.ParseUint(string(jn), 0, 64) + if err != nil { + return fmt.Errorf( + "error decoding json.Number into %s: %s", name, err) + } + val.SetUint(i) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + +func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + + switch { + case dataKind == reflect.Bool: + val.SetBool(dataVal.Bool()) + case dataKind == reflect.Int && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Int() != 0) + case dataKind == reflect.Uint && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Uint() != 0) + case dataKind == reflect.Float32 && d.config.WeaklyTypedInput: + val.SetBool(dataVal.Float() != 0) + case dataKind == reflect.String && d.config.WeaklyTypedInput: + b, err := strconv.ParseBool(dataVal.String()) + if err == nil { + val.SetBool(b) + } else if dataVal.String() == "" { + val.SetBool(false) + } else { + return fmt.Errorf("cannot parse '%s' as bool: %s", name, err) + } + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + +func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + dataType := dataVal.Type() + + switch { + case dataKind == reflect.Int: + val.SetFloat(float64(dataVal.Int())) + case dataKind == reflect.Uint: + val.SetFloat(float64(dataVal.Uint())) + case dataKind == reflect.Float32: + val.SetFloat(dataVal.Float()) + case dataKind == reflect.Bool && d.config.WeaklyTypedInput: + if dataVal.Bool() { + val.SetFloat(1) + } else { + val.SetFloat(0) + } + case dataKind == reflect.String && d.config.WeaklyTypedInput: + str := dataVal.String() + if str == "" { + str = "0" + } + + f, err := strconv.ParseFloat(str, val.Type().Bits()) + if err == nil { + val.SetFloat(f) + } else { + return fmt.Errorf("cannot parse '%s' as float: %s", name, err) + } + case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number": + jn := data.(json.Number) + i, err := jn.Float64() + if err != nil { + return fmt.Errorf( + "error decoding json.Number into %s: %s", name, err) + } + val.SetFloat(i) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + +func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error { + valType := val.Type() + valKeyType := valType.Key() + valElemType := valType.Elem() + + // By default we overwrite keys in the current map + valMap := val + + // If the map is nil or we're purposely zeroing fields, make a new map + if valMap.IsNil() || d.config.ZeroFields { + // Make a new map to hold our result + mapType := reflect.MapOf(valKeyType, valElemType) + valMap = reflect.MakeMap(mapType) + } + + dataVal := reflect.ValueOf(data) + + // Resolve any levels of indirection + for dataVal.Kind() == reflect.Pointer { + dataVal = reflect.Indirect(dataVal) + } + + // Check input type and based on the input type jump to the proper func + switch dataVal.Kind() { + case reflect.Map: + return d.decodeMapFromMap(name, dataVal, val, valMap) + + case reflect.Struct: + return d.decodeMapFromStruct(name, dataVal, val, valMap) + + case reflect.Array, reflect.Slice: + if d.config.WeaklyTypedInput { + return d.decodeMapFromSlice(name, dataVal, val, valMap) + } + + fallthrough + + default: + return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind()) + } +} + +func (d *Decoder) decodeMapFromSlice(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error { + // Special case for BC reasons (covered by tests) + if dataVal.Len() == 0 { + val.Set(valMap) + return nil + } + + for i := 0; i < dataVal.Len(); i++ { + err := d.decode( + name+"["+strconv.Itoa(i)+"]", + dataVal.Index(i).Interface(), val) + if err != nil { + return err + } + } + + return nil +} + +func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error { + valType := val.Type() + valKeyType := valType.Key() + valElemType := valType.Elem() + + // Accumulate errors + errors := make([]string, 0) + + // If the input data is empty, then we just match what the input data is. + if dataVal.Len() == 0 { + if dataVal.IsNil() { + if !val.IsNil() { + val.Set(dataVal) + } + } else { + // Set to empty allocated value + val.Set(valMap) + } + + return nil + } + + for _, k := range dataVal.MapKeys() { + fieldName := name + "[" + k.String() + "]" + + // First decode the key into the proper type + currentKey := reflect.Indirect(reflect.New(valKeyType)) + if err := d.decode(fieldName, k.Interface(), currentKey); err != nil { + errors = appendErrors(errors, err) + continue + } + + // Next decode the data into the proper type + v := dataVal.MapIndex(k).Interface() + currentVal := reflect.Indirect(reflect.New(valElemType)) + if err := d.decode(fieldName, v, currentVal); err != nil { + errors = appendErrors(errors, err) + continue + } + + valMap.SetMapIndex(currentKey, currentVal) + } + + // Set the built up map to the value + val.Set(valMap) + + // If we had errors, return those + if len(errors) > 0 { + return &Error{errors} + } + + return nil +} + +func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error { + typ := dataVal.Type() + for i := 0; i < typ.NumField(); i++ { + // Get the StructField first since this is a cheap operation. If the + // field is unexported, then ignore it. + f := typ.Field(i) + if f.PkgPath != "" { + continue + } + + // Next get the actual value of this field and verify it is assignable + // to the map value. + v := dataVal.Field(i) + if !v.Type().AssignableTo(valMap.Type().Elem()) { + return fmt.Errorf("cannot assign type '%s' to map value field of type '%s'", v.Type(), valMap.Type().Elem()) + } + + tagValue := f.Tag.Get(d.config.TagName) + keyName := f.Name + + if tagValue == "" && d.config.IgnoreUntaggedFields { + continue + } + + // If Squash is set in the config, we squash the field down. + squash := d.config.Squash && v.Kind() == reflect.Struct && f.Anonymous + + v = dereferencePtrToStructIfNeeded(v, d.config.TagName) + + // Determine the name of the key in the map + if index := strings.Index(tagValue, ","); index != -1 { + if tagValue[:index] == "-" { + continue + } + // If "omitempty" is specified in the tag, it ignores empty values. + if strings.Index(tagValue[index+1:], "omitempty") != -1 && isEmptyValue(v) { + continue + } + + // If "squash" is specified in the tag, we squash the field down. + squash = squash || strings.Index(tagValue[index+1:], "squash") != -1 + if squash { + // When squashing, the embedded type can be a pointer to a struct. + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Struct { + v = v.Elem() + } + + // The final type must be a struct + if v.Kind() != reflect.Struct { + return fmt.Errorf("cannot squash non-struct type '%s'", v.Type()) + } + } else { + if strings.Index(tagValue[index+1:], "remain") != -1 { + if v.Kind() != reflect.Map { + return fmt.Errorf("error remain-tag field with invalid type: '%s'", v.Type()) + } + + ptr := v.MapRange() + for ptr.Next() { + valMap.SetMapIndex(ptr.Key(), ptr.Value()) + } + continue + } + } + if keyNameTagValue := tagValue[:index]; keyNameTagValue != "" { + keyName = keyNameTagValue + } + } else if len(tagValue) > 0 { + if tagValue == "-" { + continue + } + keyName = tagValue + } + + switch v.Kind() { + // this is an embedded struct, so handle it differently + case reflect.Struct: + x := reflect.New(v.Type()) + x.Elem().Set(v) + + vType := valMap.Type() + vKeyType := vType.Key() + vElemType := vType.Elem() + mType := reflect.MapOf(vKeyType, vElemType) + vMap := reflect.MakeMap(mType) + + // Creating a pointer to a map so that other methods can completely + // overwrite the map if need be (looking at you decodeMapFromMap). The + // indirection allows the underlying map to be settable (CanSet() == true) + // where as reflect.MakeMap returns an unsettable map. + addrVal := reflect.New(vMap.Type()) + reflect.Indirect(addrVal).Set(vMap) + + err := d.decode(keyName, x.Interface(), reflect.Indirect(addrVal)) + if err != nil { + return err + } + + // the underlying map may have been completely overwritten so pull + // it indirectly out of the enclosing value. + vMap = reflect.Indirect(addrVal) + + if squash { + for _, k := range vMap.MapKeys() { + valMap.SetMapIndex(k, vMap.MapIndex(k)) + } + } else { + valMap.SetMapIndex(reflect.ValueOf(keyName), vMap) + } + + default: + valMap.SetMapIndex(reflect.ValueOf(keyName), v) + } + } + + if val.CanAddr() { + val.Set(valMap) + } + + return nil +} + +func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) (bool, error) { + // If the input data is nil, then we want to just set the output + // pointer to be nil as well. + isNil := data == nil + if !isNil { + switch v := reflect.Indirect(reflect.ValueOf(data)); v.Kind() { + case reflect.Chan, + reflect.Func, + reflect.Interface, + reflect.Map, + reflect.Ptr, + reflect.Slice: + isNil = v.IsNil() + } + } + if isNil { + if !val.IsNil() && val.CanSet() { + nilValue := reflect.New(val.Type()).Elem() + val.Set(nilValue) + } + + return true, nil + } + + // Create an element of the concrete (non pointer) type and decode + // into that. Then set the value of the pointer to this type. + valType := val.Type() + valElemType := valType.Elem() + if val.CanSet() { + realVal := val + if realVal.IsNil() || d.config.ZeroFields { + realVal = reflect.New(valElemType) + } + + if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil { + return false, err + } + + val.Set(realVal) + } else { + if err := d.decode(name, data, reflect.Indirect(val)); err != nil { + return false, err + } + } + return false, nil +} + +func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error { + // Create an element of the concrete (non pointer) type and decode + // into that. Then set the value of the pointer to this type. + dataVal := reflect.Indirect(reflect.ValueOf(data)) + if val.Type() != dataVal.Type() { + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + val.Set(dataVal) + return nil +} + +func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataValKind := dataVal.Kind() + valType := val.Type() + valElemType := valType.Elem() + sliceType := reflect.SliceOf(valElemType) + + // If we have a non array/slice type then we first attempt to convert. + if dataValKind != reflect.Array && dataValKind != reflect.Slice { + if d.config.WeaklyTypedInput { + switch { + // Slice and array we use the normal logic + case dataValKind == reflect.Slice, dataValKind == reflect.Array: + break + + // Empty maps turn into empty slices + case dataValKind == reflect.Map: + if dataVal.Len() == 0 { + val.Set(reflect.MakeSlice(sliceType, 0, 0)) + return nil + } + // Create slice of maps of other sizes + return d.decodeSlice(name, []interface{}{data}, val) + + case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8: + return d.decodeSlice(name, []byte(dataVal.String()), val) + + // All other types we try to convert to the slice type + // and "lift" it into it. i.e. a string becomes a string slice. + default: + // Just re-try this function with data as a slice. + return d.decodeSlice(name, []interface{}{data}, val) + } + } + + return fmt.Errorf( + "'%s': source data must be an array or slice, got %s", name, dataValKind) + } + + // If the input value is nil, then don't allocate since empty != nil + if dataValKind != reflect.Array && dataVal.IsNil() { + return nil + } + + valSlice := val + if valSlice.IsNil() || d.config.ZeroFields { + // Make a new slice to hold our result, same size as the original data. + valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len()) + } else if valSlice.Len() > dataVal.Len() { + valSlice = valSlice.Slice(0, dataVal.Len()) + } + + // Accumulate any errors + errors := make([]string, 0) + + for i := 0; i < dataVal.Len(); i++ { + currentData := dataVal.Index(i).Interface() + for valSlice.Len() <= i { + valSlice = reflect.Append(valSlice, reflect.Zero(valElemType)) + } + currentField := valSlice.Index(i) + + fieldName := name + "[" + strconv.Itoa(i) + "]" + if err := d.decode(fieldName, currentData, currentField); err != nil { + errors = appendErrors(errors, err) + } + } + + // Finally, set the value to the slice we built up + val.Set(valSlice) + + // If there were errors, we return those + if len(errors) > 0 { + return &Error{errors} + } + + return nil +} + +func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataValKind := dataVal.Kind() + valType := val.Type() + valElemType := valType.Elem() + arrayType := reflect.ArrayOf(valType.Len(), valElemType) + + valArray := val + + if isComparable(valArray) && valArray.Interface() == reflect.Zero(valArray.Type()).Interface() || d.config.ZeroFields { + // Check input type + if dataValKind != reflect.Array && dataValKind != reflect.Slice { + if d.config.WeaklyTypedInput { + switch { + // Empty maps turn into empty arrays + case dataValKind == reflect.Map: + if dataVal.Len() == 0 { + val.Set(reflect.Zero(arrayType)) + return nil + } + + // All other types we try to convert to the array type + // and "lift" it into it. i.e. a string becomes a string array. + default: + // Just re-try this function with data as a slice. + return d.decodeArray(name, []interface{}{data}, val) + } + } + + return fmt.Errorf( + "'%s': source data must be an array or slice, got %s", name, dataValKind) + + } + if dataVal.Len() > arrayType.Len() { + return fmt.Errorf( + "'%s': expected source data to have length less or equal to %d, got %d", name, arrayType.Len(), dataVal.Len()) + } + + // Make a new array to hold our result, same size as the original data. + valArray = reflect.New(arrayType).Elem() + } + + // Accumulate any errors + errors := make([]string, 0) + + for i := 0; i < dataVal.Len(); i++ { + currentData := dataVal.Index(i).Interface() + currentField := valArray.Index(i) + + fieldName := name + "[" + strconv.Itoa(i) + "]" + if err := d.decode(fieldName, currentData, currentField); err != nil { + errors = appendErrors(errors, err) + } + } + + // Finally, set the value to the array we built up + val.Set(valArray) + + // If there were errors, we return those + if len(errors) > 0 { + return &Error{errors} + } + + return nil +} + +func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + + // If the type of the value to write to and the data match directly, + // then we just set it directly instead of recursing into the structure. + if dataVal.Type() == val.Type() { + val.Set(dataVal) + return nil + } + + dataValKind := dataVal.Kind() + switch dataValKind { + case reflect.Map: + return d.decodeStructFromMap(name, dataVal, val) + + case reflect.Struct: + // Not the most efficient way to do this but we can optimize later if + // we want to. To convert from struct to struct we go to map first + // as an intermediary. + + // Make a new map to hold our result + mapType := reflect.TypeOf((map[string]interface{})(nil)) + mval := reflect.MakeMap(mapType) + + // Creating a pointer to a map so that other methods can completely + // overwrite the map if need be (looking at you decodeMapFromMap). The + // indirection allows the underlying map to be settable (CanSet() == true) + // where as reflect.MakeMap returns an unsettable map. + addrVal := reflect.New(mval.Type()) + + reflect.Indirect(addrVal).Set(mval) + if err := d.decodeMapFromStruct(name, dataVal, reflect.Indirect(addrVal), mval); err != nil { + return err + } + + result := d.decodeStructFromMap(name, reflect.Indirect(addrVal), val) + return result + + default: + return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind()) + } +} + +func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) error { + dataValType := dataVal.Type() + if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface { + return fmt.Errorf( + "'%s' needs a map with string keys, has '%s' keys", + name, dataValType.Key().Kind()) + } + + dataValKeys := make(map[reflect.Value]struct{}) + dataValKeysUnused := make(map[interface{}]struct{}) + for _, dataValKey := range dataVal.MapKeys() { + dataValKeys[dataValKey] = struct{}{} + dataValKeysUnused[dataValKey.Interface()] = struct{}{} + } + + targetValKeysUnused := make(map[interface{}]struct{}) + errors := make([]string, 0) + + // This slice will keep track of all the structs we'll be decoding. + // There can be more than one struct if there are embedded structs + // that are squashed. + structs := make([]reflect.Value, 1, 5) + structs[0] = val + + // Compile the list of all the fields that we're going to be decoding + // from all the structs. + type field struct { + field reflect.StructField + val reflect.Value + } + + // remainField is set to a valid field set with the "remain" tag if + // we are keeping track of remaining values. + var remainField *field + + fields := []field{} + for len(structs) > 0 { + structVal := structs[0] + structs = structs[1:] + + structType := structVal.Type() + + for i := 0; i < structType.NumField(); i++ { + fieldType := structType.Field(i) + fieldVal := structVal.Field(i) + if fieldVal.Kind() == reflect.Ptr && fieldVal.Elem().Kind() == reflect.Struct { + // Handle embedded struct pointers as embedded structs. + fieldVal = fieldVal.Elem() + } + + // If "squash" is specified in the tag, we squash the field down. + squash := d.config.Squash && fieldVal.Kind() == reflect.Struct && fieldType.Anonymous + remain := false + + // We always parse the tags cause we're looking for other tags too + tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",") + for _, tag := range tagParts[1:] { + if tag == "squash" { + squash = true + break + } + + if tag == "remain" { + remain = true + break + } + } + + if squash { + if fieldVal.Kind() != reflect.Struct { + errors = appendErrors(errors, + fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldVal.Kind())) + } else { + structs = append(structs, fieldVal) + } + continue + } + + // Build our field + if remain { + remainField = &field{fieldType, fieldVal} + } else { + // Normal struct field, store it away + fields = append(fields, field{fieldType, fieldVal}) + } + } + } + + // for fieldType, field := range fields { + for _, f := range fields { + field, fieldValue := f.field, f.val + fieldName := field.Name + + tagValue := field.Tag.Get(d.config.TagName) + if tagValue == "" && d.config.IgnoreUntaggedFields { + continue + } + tagValue = strings.SplitN(tagValue, ",", 2)[0] + if tagValue != "" { + fieldName = tagValue + } + + rawMapKey := reflect.ValueOf(fieldName) + rawMapVal := dataVal.MapIndex(rawMapKey) + if !rawMapVal.IsValid() { + // Do a slower search by iterating over each key and + // doing case-insensitive search. + for dataValKey := range dataValKeys { + mK, ok := dataValKey.Interface().(string) + if !ok { + // Not a string key + continue + } + + if d.config.MatchName(mK, fieldName) { + rawMapKey = dataValKey + rawMapVal = dataVal.MapIndex(dataValKey) + break + } + } + + if !rawMapVal.IsValid() { + // There was no matching key in the map for the value in + // the struct. Remember it for potential errors and metadata. + targetValKeysUnused[fieldName] = struct{}{} + continue + } + } + + if !fieldValue.IsValid() { + // This should never happen + panic("field is not valid") + } + + // If we can't set the field, then it is unexported or something, + // and we just continue onwards. + if !fieldValue.CanSet() { + continue + } + + // Delete the key we're using from the unused map so we stop tracking + delete(dataValKeysUnused, rawMapKey.Interface()) + + // If the name is empty string, then we're at the root, and we + // don't dot-join the fields. + if name != "" { + fieldName = name + "." + fieldName + } + + if err := d.decode(fieldName, rawMapVal.Interface(), fieldValue); err != nil { + errors = appendErrors(errors, err) + } + } + + // If we have a "remain"-tagged field and we have unused keys then + // we put the unused keys directly into the remain field. + if remainField != nil && len(dataValKeysUnused) > 0 { + // Build a map of only the unused values + remain := map[interface{}]interface{}{} + for key := range dataValKeysUnused { + remain[key] = dataVal.MapIndex(reflect.ValueOf(key)).Interface() + } + + // Decode it as-if we were just decoding this map onto our map. + if err := d.decodeMap(name, remain, remainField.val); err != nil { + errors = appendErrors(errors, err) + } + + // Set the map to nil so we have none so that the next check will + // not error (ErrorUnused) + dataValKeysUnused = nil + } + + if d.config.ErrorUnused && len(dataValKeysUnused) > 0 { + keys := make([]string, 0, len(dataValKeysUnused)) + for rawKey := range dataValKeysUnused { + keys = append(keys, rawKey.(string)) + } + sort.Strings(keys) + + err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", ")) + errors = appendErrors(errors, err) + } + + if d.config.ErrorUnset && len(targetValKeysUnused) > 0 { + keys := make([]string, 0, len(targetValKeysUnused)) + for rawKey := range targetValKeysUnused { + keys = append(keys, rawKey.(string)) + } + sort.Strings(keys) + + err := fmt.Errorf("'%s' has unset fields: %s", name, strings.Join(keys, ", ")) + errors = appendErrors(errors, err) + } + + if len(errors) > 0 { + return &Error{errors} + } + + // Add the unused keys to the list of unused keys if we're tracking metadata + if d.config.Metadata != nil { + for rawKey := range dataValKeysUnused { + key := rawKey.(string) + if name != "" { + key = name + "." + key + } + + d.config.Metadata.Unused = append(d.config.Metadata.Unused, key) + } + for rawKey := range targetValKeysUnused { + key := rawKey.(string) + if name != "" { + key = name + "." + key + } + + d.config.Metadata.Unset = append(d.config.Metadata.Unset, key) + } + } + + return nil +} + +func isEmptyValue(v reflect.Value) bool { + switch getKind(v) { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func getKind(val reflect.Value) reflect.Kind { + kind := val.Kind() + + switch { + case kind >= reflect.Int && kind <= reflect.Int64: + return reflect.Int + case kind >= reflect.Uint && kind <= reflect.Uint64: + return reflect.Uint + case kind >= reflect.Float32 && kind <= reflect.Float64: + return reflect.Float32 + default: + return kind + } +} + +func isStructTypeConvertibleToMap(typ reflect.Type, checkMapstructureTags bool, tagName string) bool { + for i := 0; i < typ.NumField(); i++ { + f := typ.Field(i) + if f.PkgPath == "" && !checkMapstructureTags { // check for unexported fields + return true + } + if checkMapstructureTags && f.Tag.Get(tagName) != "" { // check for mapstructure tags inside + return true + } + } + return false +} + +func dereferencePtrToStructIfNeeded(v reflect.Value, tagName string) reflect.Value { + if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct { + return v + } + deref := v.Elem() + derefT := deref.Type() + if isStructTypeConvertibleToMap(derefT, true, tagName) { + return deref + } + return v +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_19.go b/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_19.go new file mode 100644 index 00000000..d0913fff --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_19.go @@ -0,0 +1,44 @@ +//go:build !go1.20 + +package mapstructure + +import "reflect" + +func isComparable(v reflect.Value) bool { + k := v.Kind() + switch k { + case reflect.Invalid: + return false + + case reflect.Array: + switch v.Type().Elem().Kind() { + case reflect.Interface, reflect.Array, reflect.Struct: + for i := 0; i < v.Type().Len(); i++ { + // if !v.Index(i).Comparable() { + if !isComparable(v.Index(i)) { + return false + } + } + return true + } + return v.Type().Comparable() + + case reflect.Interface: + // return v.Elem().Comparable() + return isComparable(v.Elem()) + + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + return false + + // if !v.Field(i).Comparable() { + if !isComparable(v.Field(i)) { + return false + } + } + return true + + default: + return v.Type().Comparable() + } +} diff --git a/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_20.go b/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_20.go new file mode 100644 index 00000000..f8255a1b --- /dev/null +++ b/vendor/github.com/go-viper/mapstructure/v2/reflect_go1_20.go @@ -0,0 +1,10 @@ +//go:build go1.20 + +package mapstructure + +import "reflect" + +// TODO: remove once we drop support for Go <1.20 +func isComparable(v reflect.Value) bool { + return v.Comparable() +} diff --git a/vendor/github.com/knadh/koanf/v2/README.md b/vendor/github.com/knadh/koanf/v2/README.md index 71ae6de0..d7412704 100644 --- a/vendor/github.com/knadh/koanf/v2/README.md +++ b/vendor/github.com/knadh/koanf/v2/README.md @@ -6,7 +6,7 @@ koanf v2 has modules (Providers) for reading configuration from a variety of sources such as files, command line flags, environment variables, Vault, and S3 and for parsing (Parsers) formats such as JSON, YAML, TOML, Hashicorp HCL. It is easy to plug in custom parsers and providers. -All external dependencies in providers and parsers are detatched from the core and can be installed separately as necessary. +All external dependencies in providers and parsers are detached from the core and can be installed separately as necessary. [![Run Tests](https://github.com/knadh/koanf/actions/workflows/test.yml/badge.svg)](https://github.com/knadh/koanf/actions/workflows/test.yml) [![GoDoc](https://godoc.org/github.com/knadh/koanf?status.svg)](https://godoc.org/github.com/knadh/koanf) @@ -18,8 +18,9 @@ go get -u github.com/knadh/koanf/v2 # Install the necessary Provider(s). # Available: file, env, posflag, basicflag, confmap, rawbytes, -# structs, appconfig, consul, etcd, fs, s3, vault -# go get -u github.com/knadh/koanf/providers/$provider +# structs, fs, s3, appconfig/v2, consul/v2, etcd/v2, vault/v2, parameterstore/v2 +# eg: go get -u github.com/knadh/koanf/providers/s3 +# eg: go get -u github.com/knadh/koanf/providers/consul/v2 go get -u github.com/knadh/koanf/providers/file @@ -44,7 +45,7 @@ go get -u github.com/knadh/koanf/parsers/toml - [Reading raw bytes](#reading-raw-bytes) - [Reading from maps and structs](#reading-from-nested-maps) - [Unmarshalling and marshalling](#unmarshalling-and-marshalling) -- [Order of merge and key case senstivity](#order-of-merge-and-key-case-sensitivity) +- [Order of merge and key case sensitivity](#order-of-merge-and-key-case-sensitivity) - [Custom Providers and Parsers](#custom-providers-and-parsers) - [Custom merge strategies](#custom-merge-strategies) - [List of installable Providers and Parsers](#api) @@ -660,10 +661,11 @@ Install with `go get -u github.com/knadh/koanf/providers/$provider` | structs | `structs.Provider(s interface{}, tag string)` | Takes a struct and struct tag. | | s3 | `s3.Provider(s3.S3Config{})` | Takes a s3 config struct. | | rawbytes | `rawbytes.Provider(b []byte)` | Takes a raw `[]byte` slice to be parsed with a koanf.Parser | -| vault | `vault.Provider(vault.Config{})` | Hashicorp Vault provider | -| appconfig | `vault.AppConfig(appconfig.Config{})` | AWS AppConfig provider | -| etcd | `etcd.Provider(etcd.Config{})` | CNCF etcd provider | -| consul | `consul.Provider(consul.Config{})` | Hashicorp Consul provider | +| vault/v2 | `vault.Provider(vault.Config{})` | Hashicorp Vault provider | +| appconfig/v2 | `vault.AppConfig(appconfig.Config{})` | AWS AppConfig provider | +| etcd/v2 | `etcd.Provider(etcd.Config{})` | CNCF etcd provider | +| consul/v2 | `consul.Provider(consul.Config{})` | Hashicorp Consul provider | +| parameterstore/v2 | `parameterstore.Provider(parameterstore.Config{})` | AWS Systems Manager Parameter Store provider | ### Bundled Parsers diff --git a/vendor/github.com/knadh/koanf/v2/getters.go b/vendor/github.com/knadh/koanf/v2/getters.go index 5e2eabd2..266230f7 100644 --- a/vendor/github.com/knadh/koanf/v2/getters.go +++ b/vendor/github.com/knadh/koanf/v2/getters.go @@ -114,7 +114,7 @@ func (ko *Koanf) Int64Map(path string) map[string]int64 { } // MustInt64Map returns the map[string]int64 value of a given key path -// or panics if its not set or set to default value. +// or panics if it isn't set or set to default value. func (ko *Koanf) MustInt64Map(path string) map[string]int64 { val := ko.Int64Map(path) if len(val) == 0 { @@ -130,7 +130,7 @@ func (ko *Koanf) Int(path string) int { } // MustInt returns the int value of a given key path or panics -// or panics if its not set or set to default value of 0. +// if it isn't set or set to default value of 0. func (ko *Koanf) MustInt(path string) int { val := ko.Int(path) if val == 0 { @@ -221,7 +221,7 @@ func (ko *Koanf) Float64(path string) float64 { } // MustFloat64 returns the float64 value of a given key path or panics -// or panics if its not set or set to default value 0. +// if it isn't set or set to default value 0. func (ko *Koanf) MustFloat64(path string) float64 { val := ko.Float64(path) if val == 0 { @@ -328,7 +328,7 @@ func (ko *Koanf) Duration(path string) time.Duration { } // MustDuration returns the time.Duration value of a given key path or panics -// if its not set or set to default value 0. +// if it isn't set or set to default value 0. func (ko *Koanf) MustDuration(path string) time.Duration { val := ko.Duration(path) if val == 0 { @@ -382,7 +382,7 @@ func (ko *Koanf) String(path string) string { } // MustString returns the string value of a given key path -// or panics if its not set or set to default value "". +// or panics if it isn't set or set to default value "". func (ko *Koanf) MustString(path string) string { val := ko.String(path) if val == "" { @@ -414,7 +414,7 @@ func (ko *Koanf) Strings(path string) []string { return out case []string: out := make([]string, len(v)) - copy(out[:], v[:]) + copy(out, v) return out } diff --git a/vendor/github.com/knadh/koanf/v2/interfaces.go b/vendor/github.com/knadh/koanf/v2/interfaces.go index e15ba594..ba69a244 100644 --- a/vendor/github.com/knadh/koanf/v2/interfaces.go +++ b/vendor/github.com/knadh/koanf/v2/interfaces.go @@ -3,7 +3,7 @@ package koanf // Provider represents a configuration provider. Providers can // read configuration from a source (file, HTTP etc.) type Provider interface { - // Read returns the entire configuration as raw []bytes to be parsed. + // ReadBytes returns the entire configuration as raw []bytes to be parsed. // with a Parser. ReadBytes() ([]byte, error) diff --git a/vendor/github.com/knadh/koanf/v2/koanf.go b/vendor/github.com/knadh/koanf/v2/koanf.go index 8e575de8..bd06a2d7 100644 --- a/vendor/github.com/knadh/koanf/v2/koanf.go +++ b/vendor/github.com/knadh/koanf/v2/koanf.go @@ -10,7 +10,7 @@ import ( "github.com/knadh/koanf/maps" "github.com/mitchellh/copystructure" - "github.com/mitchellh/mapstructure" + "github.com/go-viper/mapstructure/v2" ) // Koanf is the configuration apparatus. @@ -132,12 +132,12 @@ func (ko *Koanf) Keys() []string { } // KeyMap returns a map of flattened keys and the individual parts of the -// key as slices. eg: "parent.child.key" => ["parent", "child", "key"] +// key as slices. eg: "parent.child.key" => ["parent", "child", "key"]. func (ko *Koanf) KeyMap() KeyMap { out := make(KeyMap, len(ko.keyMap)) for key, parts := range ko.keyMap { out[key] = make([]string, len(parts)) - copy(out[key][:], parts[:]) + copy(out[key], parts) } return out } @@ -161,7 +161,7 @@ func (ko *Koanf) Raw() map[string]interface{} { func (ko *Koanf) Sprint() string { b := bytes.Buffer{} for _, k := range ko.Keys() { - b.Write([]byte(fmt.Sprintf("%s -> %v\n", k, ko.confMapFlat[k]))) + b.WriteString(fmt.Sprintf("%s -> %v\n", k, ko.confMapFlat[k])) } return b.String() } @@ -425,7 +425,7 @@ func (ko *Koanf) merge(c map[string]interface{}, opts *options) error { // toInt64 takes an interface value and if it is an integer type, // converts and returns int64. If it's any other type, -// forces it to a string and attempts to an strconv.Atoi +// forces it to a string and attempts to do a strconv.Atoi // to get an integer out. func toInt64(v interface{}) (int64, error) { switch i := v.(type) { @@ -507,19 +507,20 @@ func populateKeyParts(m KeyMap, delim string) KeyMap { continue } out[nk] = make([]string, i+1) - copy(out[nk][:], parts[0:i+1]) + copy(out[nk], parts[0:i+1]) } } return out } // textUnmarshalerHookFunc is a fixed version of mapstructure.TextUnmarshallerHookFunc. -// This hook allows to additionally unmarshal text into custom string types that implement the encoding.(Un)TextMarshaler interface(s) +// This hook allows to additionally unmarshal text into custom string types that implement the encoding.Text(Un)Marshaler interface(s). func textUnmarshalerHookFunc() mapstructure.DecodeHookFuncType { return func( f reflect.Type, t reflect.Type, - data interface{}) (interface{}, error) { + data interface{}, + ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } @@ -529,7 +530,7 @@ func textUnmarshalerHookFunc() mapstructure.DecodeHookFuncType { return data, nil } - // default text representaion is the actual value of the `from` string + // default text representation is the actual value of the `from` string var ( dataVal = reflect.ValueOf(data) text = []byte(dataVal.String()) @@ -550,8 +551,8 @@ func textUnmarshalerHookFunc() mapstructure.DecodeHookFuncType { ptrVal.Elem().Set(dataVal) // We need to assert that both, the value type and the pointer type - // do (not) implement the TextMarshaler interface before proceeding and simmply - // using the the string value of the string type. + // do (not) implement the TextMarshaller interface before proceeding and simply + // using the string value of the string type. // it might be the case that the internal string representation differs from // the (un)marshalled string. @@ -567,7 +568,7 @@ func textUnmarshalerHookFunc() mapstructure.DecodeHookFuncType { } // text is either the source string's value or the source string type's marshaled value - // which may differ fromit internal string value. + // which may differ from its internal string value. if err := unmarshaller.UnmarshalText(text); err != nil { return nil, err } diff --git a/vendor/github.com/prometheus/statsd_exporter/LICENSE b/vendor/github.com/prometheus/statsd_exporter/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/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/github.com/prometheus/statsd_exporter/NOTICE b/vendor/github.com/prometheus/statsd_exporter/NOTICE deleted file mode 100644 index 33179a98..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -StatsD-to-Prometheus exporter -Copyright 2013-2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/level/level.go b/vendor/github.com/prometheus/statsd_exporter/pkg/level/level.go deleted file mode 100644 index 5b03c6d6..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/level/level.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2021 The Prometheus 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 level - -import ( - "fmt" - - "github.com/go-kit/log" - "github.com/go-kit/log/level" -) - -var logLevel = LevelInfo - -// A Level is a logging priority. Higher levels are more important. -type Level int - -const ( - // LevelDebug logs are typically voluminous, and are usually disabled in - // production. - LevelDebug Level = iota - // LevelInfo is the default logging priority. - LevelInfo - // LevelWarn logs are more important than Info, but don't need individual - // human review. - LevelWarn - // LevelError logs are high-priority. If an application is running smoothly, - // it shouldn't generate any error-level logs. - LevelError -) - -var emptyLogger = &EmptyLogger{} - -type EmptyLogger struct{} - -func (l *EmptyLogger) Log(keyvals ...interface{}) error { - return nil -} - -// SetLogLevel sets the log level. -func SetLogLevel(level string) error { - switch level { - case "debug": - logLevel = LevelDebug - case "info": - logLevel = LevelInfo - case "warn": - logLevel = LevelWarn - case "error": - logLevel = LevelError - default: - return fmt.Errorf("unrecognized log level %s", level) - } - return nil -} - -// Error returns a logger that includes a Key/ErrorValue pair. -func Error(logger log.Logger) log.Logger { - if logLevel <= LevelError { - return level.Error(logger) - } - return emptyLogger -} - -// Warn returns a logger that includes a Key/WarnValue pair. -func Warn(logger log.Logger) log.Logger { - if logLevel <= LevelWarn { - return level.Warn(logger) - } - return emptyLogger -} - -// Info returns a logger that includes a Key/InfoValue pair. -func Info(logger log.Logger) log.Logger { - if logLevel <= LevelInfo { - return level.Info(logger) - } - return emptyLogger -} - -// Debug returns a logger that includes a Key/DebugValue pair. -func Debug(logger log.Logger) log.Logger { - if logLevel <= LevelDebug { - return level.Debug(logger) - } - return emptyLogger -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/action.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/action.go deleted file mode 100644 index b8c09771..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/action.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Prometheus 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 mapper - -import "fmt" - -type ActionType string - -const ( - ActionTypeMap ActionType = "map" - ActionTypeDrop ActionType = "drop" - ActionTypeDefault ActionType = "" -) - -func (t *ActionType) UnmarshalYAML(unmarshal func(interface{}) error) error { - var v string - - if err := unmarshal(&v); err != nil { - return err - } - - switch ActionType(v) { - case ActionTypeDrop: - *t = ActionTypeDrop - case ActionTypeMap, ActionTypeDefault: - *t = ActionTypeMap - default: - return fmt.Errorf("invalid action type %q", v) - } - return nil -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/escape.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/escape.go deleted file mode 100644 index f73b16d4..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/escape.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 The Prometheus 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 mapper - -import ( - "strings" - "unicode/utf8" -) - -// EscapeMetricName replaces invalid characters in the metric name with "_" -// Valid characters are a-z, A-Z, 0-9, and _ -func EscapeMetricName(metricName string) string { - metricLen := len(metricName) - if metricLen == 0 { - return "" - } - - escaped := false - var sb strings.Builder - // If a metric starts with a digit, allocate the memory and prepend an - // underscore. - if metricName[0] >= '0' && metricName[0] <= '9' { - escaped = true - sb.Grow(metricLen + 1) - sb.WriteByte('_') - } - - // This is an character replacement method optimized for this limited - // use case. It is much faster than using a regex. - offset := 0 - - var prevChar rune - - for i, c := range metricName { - // Seek forward, skipping valid characters until we find one that needs - // to be replaced, then add all the characters we've seen so far to the - // string.Builder. - if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || (c == '_') { - // Character is valid, so skip over it without doing anything. - } else { - // Double-dashes are allowed if there is a corresponding mapping. - // For consistency, double-dashes should also be allowed in the default case. - if c == '-' && prevChar == '-' { - offset = i + utf8.RuneLen(c) - continue - } - - if !escaped { - // Up until now we've been lazy and avoided actually allocating - // memory. Unfortunately we've now determined this string needs - // escaping, so allocate the buffer for the whole string. - escaped = true - sb.Grow(metricLen) - } - sb.WriteString(metricName[offset:i]) - offset = i + utf8.RuneLen(c) - sb.WriteByte('_') - } - - prevChar = c - } - - if !escaped { - // This is the happy path where nothing had to be escaped, so we can - // avoid doing anything. - return metricName - } - - if offset < metricLen { - sb.WriteString(metricName[offset:]) - } - - return sb.String() -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/README.md b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/README.md deleted file mode 100644 index 9d7da44e..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# FSM Mapping - -## Overview - -This package implements a fast and efficient algorithm for generic glob style -string matching using a finite state machine (FSM). - -### Source Hierachy - -``` - '-- fsm - '-- dump.go // functionality to dump the FSM to Dot file - '-- formatter.go // format glob templates using captured * groups - '-- fsm.go // manipulating and searching of FSM - '-- minmax.go // min() max() function for interger -``` - -## FSM Explained - -Per [Wikipedia](https://en.wikipedia.org/wiki/Finite-state_machine): - -> A finite-state machine (FSM) or finite-state automaton (FSA, plural: automata), -> finite automaton, or simply a state machine, is a mathematical model of -> computation. It is an abstract machine that can be in exactly one of a finite -> number of states at any given time. The FSM can change from one state to -> another in response to some external inputs; the change from one state to -> another is called a transition. An FSM is defined by a list of its states, its -> initial state, and the conditions for each transition. - -In our use case, each *state* is a substring after the input StatsD metric name is splitted by `.`. - -### Add state to FSM - -`func (f *FSM) AddState(match string, matchMetricType string, -maxPossibleTransitions int, result interface{}) int` - -At first, the FSM only contains three states, representing three possible metric types: - - ____ [gauge] - / - (start)---- [counter] - \ - '--- [observer] - - -Adding a rule `client.*.request.count` with type `counter` will make the FSM to be: - - - ____ [gauge] - / - (start)---- [counter] -- [client] -- [*] -- [request] -- [count] -- {R1} - \ - '--- [observer] - -`{R1}` is short for result 1, which is the match result for `client.*.request.count`. - -Adding a rule `client.*.*.size` with type `counter` will make the FSM to be: - - ____ [gauge] __ [request] -- [count] -- {R1} - / / - (start)---- [counter] -- [client] -- [*] - \ \__ [*] -- [size] -- {R2} - '--- [observer] - - -### Finding a result state in FSM - -`func (f *FSM) GetMapping(statsdMetric string, statsdMetricType string) -(*mappingState, []string)` - -For example, when mapping `client.aaa.request.count` with `counter` type in the -FSM, the `^1` to `^7` symbols indicate how FSM will traversal in its tree: - - - ____ [gauge] __ [request] -- [count] -- {R1} - / / ^5 ^6 ^7 - (start)---- [counter] -- [client] -- [*] - ^1 \ ^2 ^3 \__ [*] -- [size] -- {R2} - '--- [observer] ^4 - - -To map `client.bbb.request.size`, FSM will do a backtracking: - - - ____ [gauge] __ [request] -- [count] -- {R1} - / / ^5 ^6 - (start)---- [counter] -- [client] -- [*] - ^1 \ ^2 ^3 \__ [*] -- [size] -- {R2} - '--- [observer] ^4 - ^7 ^8 ^9 - - -## Debugging - -To see all the states of the current FSM, use `func (f *FSM) DumpFSM(w io.Writer)` -to dump into a Dot file. The Dot file can be further renderer into image using: - -```shell -$ dot -Tpng dump.dot > dump.png -``` - -In StatsD exporter, one could use the following: - -```shell -$ statsd_exporter --statsd.mapping-config=statsd.rules --debug.dump-fsm=dump.dot -$ dot -Tpng dump.dot > dump.png -``` - -For example, the following rules: - -```yaml -mappings: -- match: client.*.request.count - name: request_count - match_metric_type: counter - labels: - client: $1 - -- match: client.*.*.size - name: sizes - match_metric_type: counter - labels: - client: $1 - direction: $2 -``` - -will be rendered as: - -![FSM](fsm.png) - -The `dot` program is part of [Graphviz](https://www.graphviz.org/) and is -available in most of popular operating systems. diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/dump.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/dump.go deleted file mode 100644 index 35772f9c..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/dump.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 The Prometheus 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 fsm - -import ( - "fmt" - "io" -) - -// DumpFSM accepts a io.writer and write the current FSM into dot file format. -func (f *FSM) DumpFSM(w io.Writer) { - idx := 0 - states := make(map[int]*mappingState) - states[idx] = f.root - - w.Write([]byte("digraph g {\n")) - w.Write([]byte("rankdir=LR\n")) // make it vertical - w.Write([]byte("node [ label=\"\",style=filled,fillcolor=white,shape=circle ]\n")) // remove label of node - - for idx < len(states) { - for field, transition := range states[idx].transitions { - states[len(states)] = transition - w.Write([]byte(fmt.Sprintf("%d -> %d [label = \"%s\"];\n", idx, len(states)-1, field))) - if idx == 0 { - // color for metric types - w.Write([]byte(fmt.Sprintf("%d [color=\"#D6B656\",fillcolor=\"#FFF2CC\"];\n", len(states)-1))) - } else if transition.transitions == nil || len(transition.transitions) == 0 { - // color for end state - w.Write([]byte(fmt.Sprintf("%d [color=\"#82B366\",fillcolor=\"#D5E8D4\"];\n", len(states)-1))) - } - } - idx++ - } - // color for start state - w.Write([]byte(fmt.Sprintln("0 [color=\"#a94442\",fillcolor=\"#f2dede\"];"))) - w.Write([]byte("}")) -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/formatter.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/formatter.go deleted file mode 100644 index 567bbc28..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/formatter.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2018 The Prometheus 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 fsm - -import ( - "fmt" - "regexp" - "strconv" - "strings" -) - -var ( - templateReplaceCaptureRE = regexp.MustCompile(`\$\{?([a-zA-Z0-9_\$]+)\}?`) -) - -type TemplateFormatter struct { - captureIndexes []int - captureCount int - fmtString string -} - -// NewTemplateFormatter instantiates a TemplateFormatter -// from given template string and the maximum amount of captures. -func NewTemplateFormatter(template string, captureCount int) *TemplateFormatter { - matches := templateReplaceCaptureRE.FindAllStringSubmatch(template, -1) - if len(matches) == 0 { - // if no regex reference found, keep it as it is - return &TemplateFormatter{captureCount: 0, fmtString: template} - } - - var indexes []int - valueFormatter := template - for _, match := range matches { - idx, err := strconv.Atoi(match[len(match)-1]) - if err != nil || idx > captureCount || idx < 1 { - // if index larger than captured count or using unsupported named capture group, - // replace with empty string - valueFormatter = strings.Replace(valueFormatter, match[0], "", -1) - } else { - valueFormatter = strings.Replace(valueFormatter, match[0], "%s", -1) - // note: the regex reference variable $? starts from 1 - indexes = append(indexes, idx-1) - } - } - return &TemplateFormatter{ - captureIndexes: indexes, - captureCount: len(indexes), - fmtString: valueFormatter, - } -} - -// Format accepts a list containing captured strings and returns the formatted -// string using the template stored in current TemplateFormatter. -func (formatter *TemplateFormatter) Format(captures []string) string { - if formatter.captureCount == 0 { - // no label substitution, keep as it is - return formatter.fmtString - } - indexes := formatter.captureIndexes - vargs := make([]interface{}, formatter.captureCount) - for i, idx := range indexes { - vargs[i] = captures[idx] - } - return fmt.Sprintf(formatter.fmtString, vargs...) -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go deleted file mode 100644 index 85068f7f..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright 2018 The Prometheus 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 fsm - -import ( - "regexp" - "strings" - - "github.com/go-kit/log" - - "github.com/prometheus/statsd_exporter/pkg/level" -) - -type mappingState struct { - transitions map[string]*mappingState - minRemainingLength int - maxRemainingLength int - // result* members are nil unless there's a metric ends with this state - Result interface{} - ResultPriority int -} - -type fsmBacktrackStackCursor struct { - fieldIndex int - captureIndex int - currentCapture string - state *mappingState - prev *fsmBacktrackStackCursor - next *fsmBacktrackStackCursor -} - -type FSM struct { - root *mappingState - metricTypes []string - statesCount int - BacktrackingNeeded bool - OrderingDisabled bool -} - -// NewFSM creates a new FSM instance -func NewFSM(metricTypes []string, maxPossibleTransitions int, orderingDisabled bool) *FSM { - fsm := FSM{} - root := &mappingState{} - root.transitions = make(map[string]*mappingState, len(metricTypes)) - - for _, field := range metricTypes { - state := &mappingState{} - (*state).transitions = make(map[string]*mappingState, maxPossibleTransitions) - root.transitions[string(field)] = state - } - fsm.OrderingDisabled = orderingDisabled - fsm.metricTypes = metricTypes - fsm.statesCount = 0 - fsm.root = root - return &fsm -} - -// AddState adds a mapping rule into the existing FSM. -// The maxPossibleTransitions parameter sets the expected count of transitions left. -// The result parameter sets the generic type to be returned when fsm found a match in GetMapping. -func (f *FSM) AddState(match string, matchMetricType string, maxPossibleTransitions int, result interface{}) int { - // first split by "." - matchFields := strings.Split(match, ".") - // fill into our FSM - roots := []*mappingState{} - // first state is the metric type - if matchMetricType == "" { - // if metricType not specified, connect the start state from all three types - for _, metricType := range f.metricTypes { - roots = append(roots, f.root.transitions[string(metricType)]) - } - } else { - roots = append(roots, f.root.transitions[matchMetricType]) - } - var captureCount int - var finalStates []*mappingState - // iterating over different start state (different metric types) - for _, root := range roots { - captureCount = 0 - // for each start state, connect from start state to end state - for i, field := range matchFields { - state, prs := root.transitions[field] - if !prs { - // create a state if it's not exist in the fsm - state = &mappingState{} - (*state).transitions = make(map[string]*mappingState, maxPossibleTransitions) - (*state).maxRemainingLength = len(matchFields) - i - 1 - (*state).minRemainingLength = len(matchFields) - i - 1 - root.transitions[field] = state - // if this is last field, set result to currentMapping instance - if i == len(matchFields)-1 { - root.transitions[field].Result = result - } - } else { - (*state).maxRemainingLength = max(len(matchFields)-i-1, (*state).maxRemainingLength) - (*state).minRemainingLength = min(len(matchFields)-i-1, (*state).minRemainingLength) - } - if field == "*" { - captureCount++ - } - - // goto next state - root = state - } - finalStates = append(finalStates, root) - } - - for _, state := range finalStates { - state.ResultPriority = f.statesCount - } - - f.statesCount++ - - return captureCount -} - -// GetMapping using the fsm to find matching rules according to given statsdMetric and statsdMetricType. -// If it finds a match, the final state and the captured strings are returned; -// if there's no match found, nil and a empty list will be returned. -func (f *FSM) GetMapping(statsdMetric string, statsdMetricType string) (*mappingState, []string) { - matchFields := strings.Split(statsdMetric, ".") - currentState := f.root.transitions[statsdMetricType] - - // the cursor/pointer in the backtrack stack implemented as a double-linked list - var backtrackCursor *fsmBacktrackStackCursor - resumeFromBacktrack := false - - // the return variable - var finalState *mappingState - - captures := make([]string, len(matchFields)) - finalCaptures := make([]string, len(matchFields)) - // keep track of captured group so we don't need to do append() on captures - captureIdx := 0 - filedsCount := len(matchFields) - i := 0 - var state *mappingState - for { // the loop for backtracking - for { // the loop for a single "depth only" search - var present bool - // if we resume from backtrack, we should skip this branch in this case - // since the state that were saved at the end of this branch - if !resumeFromBacktrack { - if len(currentState.transitions) > 0 { - field := matchFields[i] - state, present = currentState.transitions[field] - fieldsLeft := filedsCount - i - 1 - // also compare length upfront to avoid unnecessary loop or backtrack - if !present || fieldsLeft > state.maxRemainingLength || fieldsLeft < state.minRemainingLength { - state, present = currentState.transitions["*"] - if !present || fieldsLeft > state.maxRemainingLength || fieldsLeft < state.minRemainingLength { - break - } else { - captures[captureIdx] = field - captureIdx++ - } - } else if f.BacktrackingNeeded { - // if backtracking is needed, also check for alternative transition, i.e. * - altState, present := currentState.transitions["*"] - if !present || fieldsLeft > altState.maxRemainingLength || fieldsLeft < altState.minRemainingLength { - } else { - // push to backtracking stack - newCursor := fsmBacktrackStackCursor{prev: backtrackCursor, state: altState, - fieldIndex: i, - captureIndex: captureIdx, currentCapture: field, - } - // if this is not the first time, connect to the previous cursor - if backtrackCursor != nil { - backtrackCursor.next = &newCursor - } - backtrackCursor = &newCursor - } - } - } else { - // no more transitions for this state - break - } - } // backtrack will resume from here - - // do we reach a final state? - if state.Result != nil && i == filedsCount-1 { - if f.OrderingDisabled { - finalState = state - return finalState, captures - } else if finalState == nil || finalState.ResultPriority > state.ResultPriority { - // if we care about ordering, try to find a result with highest prioity - finalState = state - // do a deep copy to preserve current captures - copy(finalCaptures, captures) - } - break - } - - i++ - if i >= filedsCount { - break - } - - resumeFromBacktrack = false - currentState = state - } - if backtrackCursor == nil { - // if we are not doing backtracking or all path has been travesaled - break - } else { - // pop one from stack - state = backtrackCursor.state - currentState = state - i = backtrackCursor.fieldIndex - captureIdx = backtrackCursor.captureIndex + 1 - // put the * capture back - captures[captureIdx-1] = backtrackCursor.currentCapture - backtrackCursor = backtrackCursor.prev - if backtrackCursor != nil { - // deref for GC - backtrackCursor.next = nil - } - resumeFromBacktrack = true - } - } - return finalState, finalCaptures -} - -// TestIfNeedBacktracking tests if backtrack is needed for given list of mappings -// and whether ordering is disabled. -func TestIfNeedBacktracking(mappings []string, orderingDisabled bool, logger log.Logger) bool { - backtrackingNeeded := false - // A has * in rules, but there's other transisitions at the same state, - // this makes A the cause of backtracking - ruleByLength := make(map[int][]string) - ruleREByLength := make(map[int][]*regexp.Regexp) - - // first sort rules by length - for _, mapping := range mappings { - l := len(strings.Split(mapping, ".")) - ruleByLength[l] = append(ruleByLength[l], mapping) - - metricRe := strings.Replace(mapping, ".", "\\.", -1) - metricRe = strings.Replace(metricRe, "*", "([^.]*)", -1) - regex, err := regexp.Compile("^" + metricRe + "$") - if err != nil { - level.Warn(logger).Log("msg", "Invalid match, cannot compile regex in mapping", "mapping", mapping, "err", err) - } - // put into array no matter there's error or not, we will skip later if regex is nil - ruleREByLength[l] = append(ruleREByLength[l], regex) - } - - for l, rules := range ruleByLength { - if len(rules) == 1 { - continue - } - rulesRE := ruleREByLength[l] - for i1, r1 := range rules { - currentRuleNeedBacktrack := false - re1 := rulesRE[i1] - if re1 == nil || !strings.Contains(r1, "*") { - continue - } - // if rule r1 is A.B.C.*.E.*, is there a rule r2 is A.B.C.D.x.x or A.B.C.*.E.F ? (x is any string or *) - // if such r2 exists, then to match r1 we will need backtracking - for index := 0; index < len(r1); index++ { - if r1[index] != '*' { - continue - } - // translate the substring of r1 from 0 to the index of current * into regex - // A.B.C.*.E.* will becomes ^A\.B\.C\. and ^A\.B\.C\.\*\.E\. - reStr := strings.Replace(r1[:index], ".", "\\.", -1) - reStr = strings.Replace(reStr, "*", "\\*", -1) - re := regexp.MustCompile("^" + reStr) - for i2, r2 := range rules { - if i2 == i1 { - continue - } - if len(re.FindStringSubmatchIndex(r2)) > 0 { - currentRuleNeedBacktrack = true - break - } - } - } - - for i2, r2 := range rules { - if i2 != i1 && len(re1.FindStringSubmatchIndex(r2)) > 0 { - // log if we care about ordering and the superset occurs before - if !orderingDisabled && i1 < i2 { - level.Warn(logger).Log("msg", "match is a super set of match but in a lower order, the first will never be matched", "first_match", r1, "second_match", r2) - } - currentRuleNeedBacktrack = false - } - } - for i2, re2 := range rulesRE { - if i2 == i1 || re2 == nil { - continue - } - // if r1 is a subset of other rule, we don't need backtrack - // because either we turned on ordering - // or we disabled ordering and can't match it even with backtrack - if len(re2.FindStringSubmatchIndex(r1)) > 0 { - currentRuleNeedBacktrack = false - } - } - - if currentRuleNeedBacktrack { - level.Warn(logger).Log("msg", "backtracking required because of match. Performance may be degraded", "match", r1) - backtrackingNeeded = true - } - } - } - - // backtracking will always be needed if ordering of rules is not disabled - // since transistions are stored in (unordered) map - // note: don't move this branch to the beginning of this function - // since we need logs for superset rules - - return !orderingDisabled || backtrackingNeeded -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.png b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.png deleted file mode 100644 index ef87d92a472eda969178cd71c6cff3fc4ac3a19f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33685 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 IKI{1WA3s+3)c^nh diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/minmax.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/minmax.go deleted file mode 100644 index 95bd9c55..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/minmax.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Prometheus 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 fsm - -// min and max implementation for integer - -func min(x, y int) int { - if x < y { - return x - } - return y -} - -func max(x, y int) int { - if x > y { - return x - } - return y -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go deleted file mode 100644 index 1471444e..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2013 The Prometheus 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 mapper - -import ( - "fmt" - "io/ioutil" - "regexp" - "sync" - "time" - - "github.com/go-kit/log" - "github.com/prometheus/client_golang/prometheus" - "gopkg.in/yaml.v2" - - "github.com/prometheus/statsd_exporter/pkg/level" - "github.com/prometheus/statsd_exporter/pkg/mapper/fsm" -) - -var ( - // The first segment of a match cannot start with a number - statsdMetricRE = `[a-zA-Z_]([a-zA-Z0-9_\-])*` - // The subsequent segments of a match can start with a number - // See https://github.com/prometheus/statsd_exporter/issues/328 - statsdMetricSubsequentRE = `[a-zA-Z0-9_]([a-zA-Z0-9_\-])*` - templateReplaceRE = `(\$\{?\d+\}?)` - - metricLineRE = regexp.MustCompile(`^(\*|` + statsdMetricRE + `)(\.\*|\.` + statsdMetricSubsequentRE + `)*$`) - metricNameRE = regexp.MustCompile(`^([a-zA-Z_]|` + templateReplaceRE + `)([a-zA-Z0-9_]|` + templateReplaceRE + `)*$`) - labelNameRE = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]+$`) -) - -type MetricMapper struct { - Registerer prometheus.Registerer - Defaults mapperConfigDefaults `yaml:"defaults"` - Mappings []MetricMapping `yaml:"mappings"` - FSM *fsm.FSM - doFSM bool - doRegex bool - cache MetricMapperCache - mutex sync.RWMutex - - MappingsCount prometheus.Gauge - - Logger log.Logger -} - -type SummaryOptions struct { - Quantiles []metricObjective `yaml:"quantiles"` - MaxAge time.Duration `yaml:"max_age"` - AgeBuckets uint32 `yaml:"age_buckets"` - BufCap uint32 `yaml:"buf_cap"` -} - -type HistogramOptions struct { - Buckets []float64 `yaml:"buckets"` -} - -type metricObjective struct { - Quantile float64 `yaml:"quantile"` - Error float64 `yaml:"error"` -} - -var defaultQuantiles = []metricObjective{ - {Quantile: 0.5, Error: 0.05}, - {Quantile: 0.9, Error: 0.01}, - {Quantile: 0.99, Error: 0.001}, -} - -func (m *MetricMapper) InitFromYAMLString(fileContents string) error { - var n MetricMapper - - if err := yaml.Unmarshal([]byte(fileContents), &n); err != nil { - return err - } - - if len(n.Defaults.HistogramOptions.Buckets) == 0 { - n.Defaults.HistogramOptions.Buckets = prometheus.DefBuckets - } - - if len(n.Defaults.SummaryOptions.Quantiles) == 0 { - n.Defaults.SummaryOptions.Quantiles = defaultQuantiles - } - - if n.Defaults.MatchType == MatchTypeDefault { - n.Defaults.MatchType = MatchTypeGlob - } - - remainingMappingsCount := len(n.Mappings) - - n.FSM = fsm.NewFSM([]string{string(MetricTypeCounter), string(MetricTypeGauge), string(MetricTypeObserver)}, - remainingMappingsCount, n.Defaults.GlobDisableOrdering) - - for i := range n.Mappings { - remainingMappingsCount-- - - currentMapping := &n.Mappings[i] - - // check that label is correct - for k := range currentMapping.Labels { - if !labelNameRE.MatchString(k) { - return fmt.Errorf("invalid label key: %s", k) - } - } - - if currentMapping.Name == "" { - return fmt.Errorf("line %d: metric mapping didn't set a metric name", i) - } - - if !metricNameRE.MatchString(currentMapping.Name) { - return fmt.Errorf("metric name '%s' doesn't match regex '%s'", currentMapping.Name, metricNameRE) - } - - if currentMapping.MatchType == "" { - currentMapping.MatchType = n.Defaults.MatchType - } - - if currentMapping.Action == "" { - currentMapping.Action = ActionTypeMap - } - - if currentMapping.MatchType == MatchTypeGlob { - n.doFSM = true - if !metricLineRE.MatchString(currentMapping.Match) { - return fmt.Errorf("invalid match: %s", currentMapping.Match) - } - - captureCount := n.FSM.AddState(currentMapping.Match, string(currentMapping.MatchMetricType), - remainingMappingsCount, currentMapping) - - currentMapping.nameFormatter = fsm.NewTemplateFormatter(currentMapping.Name, captureCount) - - labelKeys := make([]string, len(currentMapping.Labels)) - labelFormatters := make([]*fsm.TemplateFormatter, len(currentMapping.Labels)) - labelIndex := 0 - for label, valueExpr := range currentMapping.Labels { - labelKeys[labelIndex] = label - labelFormatters[labelIndex] = fsm.NewTemplateFormatter(valueExpr, captureCount) - labelIndex++ - } - currentMapping.labelFormatters = labelFormatters - currentMapping.labelKeys = labelKeys - } else { - if regex, err := regexp.Compile(currentMapping.Match); err != nil { - return fmt.Errorf("invalid regex %s in mapping: %v", currentMapping.Match, err) - } else { - currentMapping.regex = regex - } - n.doRegex = true - } - - if currentMapping.ObserverType == "" { - currentMapping.ObserverType = n.Defaults.ObserverType - } - - if currentMapping.LegacyQuantiles != nil && - (currentMapping.SummaryOptions == nil || currentMapping.SummaryOptions.Quantiles != nil) { - level.Warn(m.Logger).Log("msg", "using the top level quantiles is deprecated. Please use quantiles in the summary_options hierarchy") - } - - if currentMapping.LegacyBuckets != nil && - (currentMapping.HistogramOptions == nil || currentMapping.HistogramOptions.Buckets != nil) { - level.Warn(m.Logger).Log("msg", "using the top level buckets is deprecated. Please use buckets in the histogram_options hierarchy") - } - - if currentMapping.SummaryOptions != nil && - currentMapping.LegacyQuantiles != nil && - currentMapping.SummaryOptions.Quantiles != nil { - return fmt.Errorf("cannot use quantiles in both the top level and summary options at the same time in %s", currentMapping.Match) - } - - if currentMapping.HistogramOptions != nil && - currentMapping.LegacyBuckets != nil && - currentMapping.HistogramOptions.Buckets != nil { - return fmt.Errorf("cannot use buckets in both the top level and histogram options at the same time in %s", currentMapping.Match) - } - - if currentMapping.ObserverType == ObserverTypeHistogram { - if currentMapping.SummaryOptions != nil { - return fmt.Errorf("cannot use histogram observer and summary options at the same time") - } - if currentMapping.HistogramOptions == nil { - currentMapping.HistogramOptions = &HistogramOptions{} - } - if currentMapping.LegacyBuckets != nil && len(currentMapping.LegacyBuckets) != 0 { - currentMapping.HistogramOptions.Buckets = currentMapping.LegacyBuckets - } - if currentMapping.HistogramOptions.Buckets == nil || len(currentMapping.HistogramOptions.Buckets) == 0 { - currentMapping.HistogramOptions.Buckets = n.Defaults.HistogramOptions.Buckets - } - } - - if currentMapping.ObserverType == ObserverTypeSummary { - if currentMapping.HistogramOptions != nil { - return fmt.Errorf("cannot use summary observer and histogram options at the same time") - } - if currentMapping.SummaryOptions == nil { - currentMapping.SummaryOptions = &SummaryOptions{} - } - if currentMapping.LegacyQuantiles != nil && len(currentMapping.LegacyQuantiles) != 0 { - currentMapping.SummaryOptions.Quantiles = currentMapping.LegacyQuantiles - } - if currentMapping.SummaryOptions.Quantiles == nil || len(currentMapping.SummaryOptions.Quantiles) == 0 { - currentMapping.SummaryOptions.Quantiles = n.Defaults.SummaryOptions.Quantiles - } - if currentMapping.SummaryOptions.MaxAge == 0 { - currentMapping.SummaryOptions.MaxAge = n.Defaults.SummaryOptions.MaxAge - } - if currentMapping.SummaryOptions.AgeBuckets == 0 { - currentMapping.SummaryOptions.AgeBuckets = n.Defaults.SummaryOptions.AgeBuckets - } - if currentMapping.SummaryOptions.BufCap == 0 { - currentMapping.SummaryOptions.BufCap = n.Defaults.SummaryOptions.BufCap - } - } - - if currentMapping.Ttl == 0 && n.Defaults.Ttl > 0 { - currentMapping.Ttl = n.Defaults.Ttl - } - } - - m.mutex.Lock() - defer m.mutex.Unlock() - - m.Defaults = n.Defaults - m.Mappings = n.Mappings - - // Reset the cache since this function can be used to reload config - if m.cache != nil { - m.cache.Reset() - } - - if n.doFSM { - var mappings []string - for _, mapping := range n.Mappings { - if mapping.MatchType == MatchTypeGlob { - mappings = append(mappings, mapping.Match) - } - } - n.FSM.BacktrackingNeeded = fsm.TestIfNeedBacktracking(mappings, n.FSM.OrderingDisabled, m.Logger) - - m.FSM = n.FSM - m.doRegex = n.doRegex - } - m.doFSM = n.doFSM - - if m.MappingsCount != nil { - m.MappingsCount.Set(float64(len(n.Mappings))) - } - - if m.Logger == nil { - m.Logger = log.NewNopLogger() - } - - return nil -} - -func (m *MetricMapper) InitFromFile(fileName string) error { - mappingStr, err := ioutil.ReadFile(fileName) - if err != nil { - return err - } - - return m.InitFromYAMLString(string(mappingStr)) -} - -// UseCache tells the mapper to use a cache that implements the MetricMapperCache interface. -// This cache MUST be thread-safe! -func (m *MetricMapper) UseCache(cache MetricMapperCache) { - m.mutex.Lock() - defer m.mutex.Unlock() - m.cache = cache -} - -func (m *MetricMapper) GetMapping(statsdMetric string, statsdMetricType MetricType) (*MetricMapping, prometheus.Labels, bool) { - m.mutex.RLock() - defer m.mutex.RUnlock() - - // only use a cache if one is present - if m.cache != nil { - result, cached := m.cache.Get(formatKey(statsdMetric, statsdMetricType)) - if cached { - r := result.(MetricMapperCacheResult) - return r.Mapping, r.Labels, r.Matched - } - } - - // glob matching - if m.doFSM { - finalState, captures := m.FSM.GetMapping(statsdMetric, string(statsdMetricType)) - if finalState != nil && finalState.Result != nil { - v := finalState.Result.(*MetricMapping) - result := copyMetricMapping(v) - result.Name = result.nameFormatter.Format(captures) - - labels := prometheus.Labels{} - for index, formatter := range result.labelFormatters { - labels[result.labelKeys[index]] = formatter.Format(captures) - } - - r := MetricMapperCacheResult{ - Mapping: result, - Matched: true, - Labels: labels, - } - // add match to cache - if m.cache != nil { - m.cache.Add(formatKey(statsdMetric, statsdMetricType), r) - } - - return result, labels, true - } else if !m.doRegex { - // if there's no regex match type, return immediately - // Add miss to cache - if m.cache != nil { - m.cache.Add(formatKey(statsdMetric, statsdMetricType), MetricMapperCacheResult{}) - } - return nil, nil, false - } - } - - // regex matching - for _, mapping := range m.Mappings { - // if a rule don't have regex matching type, the regex field is unset - if mapping.regex == nil { - continue - } - matches := mapping.regex.FindStringSubmatchIndex(statsdMetric) - if len(matches) == 0 { - continue - } - - mapping.Name = string(mapping.regex.ExpandString( - []byte{}, - mapping.Name, - statsdMetric, - matches, - )) - - if mt := mapping.MatchMetricType; mt != "" && mt != statsdMetricType { - continue - } - - labels := prometheus.Labels{} - for label, valueExpr := range mapping.Labels { - value := mapping.regex.ExpandString([]byte{}, valueExpr, statsdMetric, matches) - labels[label] = string(value) - } - - r := MetricMapperCacheResult{ - Mapping: &mapping, - Matched: true, - Labels: labels, - } - // Add Match to cache - if m.cache != nil { - m.cache.Add(formatKey(statsdMetric, statsdMetricType), r) - } - - return &mapping, labels, true - } - - // Add Miss to cache - if m.cache != nil { - m.cache.Add(formatKey(statsdMetric, statsdMetricType), MetricMapperCacheResult{}) - } - return nil, nil, false -} - -// make a shallow copy so that we do not overwrite name -// as multiple names can be matched by same mapping -func copyMetricMapping(in *MetricMapping) *MetricMapping { - out := *in - return &out -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_cache.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_cache.go deleted file mode 100644 index 9d65f8c2..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_cache.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 The Prometheus 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 mapper - -import ( - "github.com/prometheus/client_golang/prometheus" -) - -type CacheMetrics struct { - CacheLength prometheus.Gauge - CacheGetsTotal prometheus.Counter - CacheHitsTotal prometheus.Counter -} - -func NewCacheMetrics(reg prometheus.Registerer) *CacheMetrics { - var m CacheMetrics - - m.CacheLength = prometheus.NewGauge( - prometheus.GaugeOpts{ - Name: "statsd_metric_mapper_cache_length", - Help: "The count of unique metrics currently cached.", - }, - ) - m.CacheGetsTotal = prometheus.NewCounter( - prometheus.CounterOpts{ - Name: "statsd_metric_mapper_cache_gets_total", - Help: "The count of total metric cache gets.", - }, - ) - m.CacheHitsTotal = prometheus.NewCounter( - prometheus.CounterOpts{ - Name: "statsd_metric_mapper_cache_hits_total", - Help: "The count of total metric cache hits.", - }, - ) - - if reg != nil { - reg.MustRegister(m.CacheLength) - reg.MustRegister(m.CacheGetsTotal) - reg.MustRegister(m.CacheHitsTotal) - } - return &m -} - -type MetricMapperCacheResult struct { - Mapping *MetricMapping - Matched bool - Labels prometheus.Labels -} - -// MetricMapperCache MUST be thread-safe and should be instrumented with CacheMetrics -type MetricMapperCache interface { - // Get a cached result - Get(metricKey string) (interface{}, bool) - // Add a statsd MetricMapperResult to the cache - Add(metricKey string, result interface{}) // Add an item to the cache - // Reset clears the cache for config reloads - Reset() -} - -func formatKey(metricString string, metricType MetricType) string { - return string(metricType) + "." + metricString -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_defaults.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_defaults.go deleted file mode 100644 index 754a677b..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_defaults.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2020 The Prometheus 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 mapper - -import "time" - -type mapperConfigDefaults struct { - ObserverType ObserverType `yaml:"observer_type"` - MatchType MatchType `yaml:"match_type"` - GlobDisableOrdering bool `yaml:"glob_disable_ordering"` - Ttl time.Duration `yaml:"ttl"` - SummaryOptions SummaryOptions `yaml:"summary_options"` - HistogramOptions HistogramOptions `yaml:"histogram_options"` -} - -// mapperConfigDefaultsAlias is used to unmarshal the yaml config into mapperConfigDefaults and allows deprecated fields -type mapperConfigDefaultsAlias struct { - ObserverType ObserverType `yaml:"observer_type"` - TimerType ObserverType `yaml:"timer_type,omitempty"` // DEPRECATED - field only present to preserve backwards compatibility in configs - Buckets []float64 `yaml:"buckets"` // DEPRECATED - field only present to preserve backwards compatibility in configs - Quantiles []metricObjective `yaml:"quantiles"` // DEPRECATED - field only present to preserve backwards compatibility in configs - MatchType MatchType `yaml:"match_type"` - GlobDisableOrdering bool `yaml:"glob_disable_ordering"` - Ttl time.Duration `yaml:"ttl"` - SummaryOptions SummaryOptions `yaml:"summary_options"` - HistogramOptions HistogramOptions `yaml:"histogram_options"` -} - -// UnmarshalYAML is a custom unmarshal function to allow use of deprecated config keys -// observer_type will override timer_type -func (d *mapperConfigDefaults) UnmarshalYAML(unmarshal func(interface{}) error) error { - var tmp mapperConfigDefaultsAlias - if err := unmarshal(&tmp); err != nil { - return err - } - - // Copy defaults - d.ObserverType = tmp.ObserverType - d.MatchType = tmp.MatchType - d.GlobDisableOrdering = tmp.GlobDisableOrdering - d.Ttl = tmp.Ttl - d.SummaryOptions = tmp.SummaryOptions - d.HistogramOptions = tmp.HistogramOptions - - // Use deprecated TimerType if necessary - if tmp.ObserverType == "" { - d.ObserverType = tmp.TimerType - } - - // Use deprecated quantiles if necessary - if len(tmp.SummaryOptions.Quantiles) == 0 && len(tmp.Quantiles) > 0 { - d.SummaryOptions = SummaryOptions{Quantiles: tmp.Quantiles} - } - - // Use deprecated buckets if necessary - if len(tmp.HistogramOptions.Buckets) == 0 && len(tmp.Buckets) > 0 { - d.HistogramOptions = HistogramOptions{Buckets: tmp.Buckets} - } - - return nil -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapping.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapping.go deleted file mode 100644 index cdba27af..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapping.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2020 The Prometheus 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 xpress or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mapper - -import ( - "regexp" - "time" - - "github.com/prometheus/client_golang/prometheus" - - "github.com/prometheus/statsd_exporter/pkg/mapper/fsm" -) - -type MetricMapping struct { - Match string `yaml:"match"` - Name string `yaml:"name"` - nameFormatter *fsm.TemplateFormatter - regex *regexp.Regexp - Labels prometheus.Labels `yaml:"labels"` - labelKeys []string - labelFormatters []*fsm.TemplateFormatter - ObserverType ObserverType `yaml:"observer_type"` - TimerType ObserverType `yaml:"timer_type,omitempty"` // DEPRECATED - field only present to preserve backwards compatibility in configs. Always empty - LegacyBuckets []float64 `yaml:"buckets"` - LegacyQuantiles []metricObjective `yaml:"quantiles"` - MatchType MatchType `yaml:"match_type"` - HelpText string `yaml:"help"` - Action ActionType `yaml:"action"` - MatchMetricType MetricType `yaml:"match_metric_type"` - Ttl time.Duration `yaml:"ttl"` - SummaryOptions *SummaryOptions `yaml:"summary_options"` - HistogramOptions *HistogramOptions `yaml:"histogram_options"` -} - -// UnmarshalYAML is a custom unmarshal function to allow use of deprecated config keys -// observer_type will override timer_type -func (m *MetricMapping) UnmarshalYAML(unmarshal func(interface{}) error) error { - type MetricMappingAlias MetricMapping - var tmp MetricMappingAlias - if err := unmarshal(&tmp); err != nil { - return err - } - - // Copy defaults - m.Match = tmp.Match - m.Name = tmp.Name - m.Labels = tmp.Labels - m.ObserverType = tmp.ObserverType - m.LegacyBuckets = tmp.LegacyBuckets - m.LegacyQuantiles = tmp.LegacyQuantiles - m.MatchType = tmp.MatchType - m.HelpText = tmp.HelpText - m.Action = tmp.Action - m.MatchMetricType = tmp.MatchMetricType - m.Ttl = tmp.Ttl - m.SummaryOptions = tmp.SummaryOptions - m.HistogramOptions = tmp.HistogramOptions - - // Use deprecated TimerType if necessary - if tmp.ObserverType == "" { - m.ObserverType = tmp.TimerType - } - - return nil -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/match.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/match.go deleted file mode 100644 index 12d5e8d6..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/match.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Prometheus 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 mapper - -import "fmt" - -type MatchType string - -const ( - MatchTypeGlob MatchType = "glob" - MatchTypeRegex MatchType = "regex" - MatchTypeDefault MatchType = "" -) - -func (t *MatchType) UnmarshalYAML(unmarshal func(interface{}) error) error { - var v string - if err := unmarshal(&v); err != nil { - return err - } - - switch MatchType(v) { - case MatchTypeRegex: - *t = MatchTypeRegex - case MatchTypeGlob, MatchTypeDefault: - *t = MatchTypeGlob - default: - return fmt.Errorf("invalid match type %q", v) - } - return nil -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/metric_type.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/metric_type.go deleted file mode 100644 index 920c16ed..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/metric_type.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018 The Prometheus 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 mapper - -import "fmt" - -type MetricType string - -const ( - MetricTypeCounter MetricType = "counter" - MetricTypeGauge MetricType = "gauge" - MetricTypeObserver MetricType = "observer" - MetricTypeTimer MetricType = "timer" // DEPRECATED -) - -func (m *MetricType) UnmarshalYAML(unmarshal func(interface{}) error) error { - var v string - if err := unmarshal(&v); err != nil { - return err - } - - switch MetricType(v) { - case MetricTypeCounter: - *m = MetricTypeCounter - case MetricTypeGauge: - *m = MetricTypeGauge - case MetricTypeObserver: - *m = MetricTypeObserver - case MetricTypeTimer: - *m = MetricTypeObserver - default: - return fmt.Errorf("invalid metric type '%s'", v) - } - return nil -} diff --git a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/observer.go b/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/observer.go deleted file mode 100644 index 3d5da7ea..00000000 --- a/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/observer.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Prometheus 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 mapper - -import "fmt" - -type ObserverType string - -const ( - ObserverTypeHistogram ObserverType = "histogram" - ObserverTypeSummary ObserverType = "summary" - ObserverTypeDefault ObserverType = "" -) - -func (t *ObserverType) UnmarshalYAML(unmarshal func(interface{}) error) error { - var v string - if err := unmarshal(&v); err != nil { - return err - } - - switch ObserverType(v) { - case ObserverTypeHistogram: - *t = ObserverTypeHistogram - case ObserverTypeSummary, ObserverTypeDefault: - *t = ObserverTypeSummary - default: - return fmt.Errorf("invalid observer type '%s'", v) - } - return nil -} diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go index 99ed6a58..5e25e507 100644 --- a/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common.go @@ -343,7 +343,7 @@ func PathExistsWithContents(filename string) bool { if err != nil { return false } - return info.Size() > 4 // at least 4 bytes + return info.Size() > 4 && !info.IsDir() // at least 4 bytes } // GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default. diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go index a644687b..a429e16a 100644 --- a/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go @@ -12,10 +12,14 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "syscall" "time" ) +// cachedBootTime must be accessed via atomic.Load/StoreUint64 +var cachedBootTime uint64 + func DoSysctrl(mib string) ([]string, error) { cmd := exec.Command("sysctl", "-n", mib) cmd.Env = getSysctrlEnv(os.Environ()) @@ -56,7 +60,14 @@ func NumProcsWithContext(ctx context.Context) (uint64, error) { return cnt, nil } -func BootTimeWithContext(ctx context.Context) (uint64, error) { +func BootTimeWithContext(ctx context.Context, enableCache bool) (uint64, error) { + if enableCache { + t := atomic.LoadUint64(&cachedBootTime) + if t != 0 { + return t, nil + } + } + system, role, err := VirtualizationWithContext(ctx) if err != nil { return 0, err @@ -72,7 +83,13 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) { } if useStatFile { - return readBootTimeStat(ctx) + t, err := readBootTimeStat(ctx) + if err != nil { + return 0, err + } + if enableCache { + atomic.StoreUint64(&cachedBootTime, t) + } } filename := HostProcWithContext(ctx, "uptime") @@ -90,6 +107,11 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) { } currentTime := float64(time.Now().UnixNano()) / float64(time.Second) t := currentTime - b + + if enableCache { + atomic.StoreUint64(&cachedBootTime, uint64(t)) + } + return uint64(t), nil } @@ -307,7 +329,7 @@ func GetOSReleaseWithContext(ctx context.Context) (platform string, version stri switch field[0] { case "ID": // use ID for lowercase platform = trimQuotes(field[1]) - case "VERSION": + case "VERSION_ID": version = trimQuotes(field[1]) } } diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process.go b/vendor/github.com/shirou/gopsutil/v3/process/process.go index 1a7fe1b8..1bb27abf 100644 --- a/vendor/github.com/shirou/gopsutil/v3/process/process.go +++ b/vendor/github.com/shirou/gopsutil/v3/process/process.go @@ -171,6 +171,13 @@ func (p NumCtxSwitchesStat) String() string { return string(s) } +var enableBootTimeCache bool + +// EnableBootTimeCache change cache behavior of BootTime. If true, cache BootTime value. Default is false. +func EnableBootTimeCache(enable bool) { + enableBootTimeCache = enable +} + // Pids returns a slice of process ID list which are running now. func Pids() ([]int32, error) { return PidsWithContext(context.Background()) diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go b/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go index f7989cd2..557435b3 100644 --- a/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_linux.go @@ -1071,7 +1071,7 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui Iowait: iotime / float64(clockTicks), } - bootTime, _ := common.BootTimeWithContext(ctx) + bootTime, _ := common.BootTimeWithContext(ctx, enableBootTimeCache) t, err := strconv.ParseUint(fields[22], 10, 64) if err != nil { return 0, 0, nil, 0, 0, 0, nil, err diff --git a/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go b/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go index 14ed0309..f2053d98 100644 --- a/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go +++ b/vendor/github.com/shirou/gopsutil/v3/process/process_windows.go @@ -253,7 +253,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) { if err := windows.EnumProcesses(ps, &read); err != nil { return nil, err } - if uint32(len(ps)) == read { // ps buffer was too small to host every results, retry with a bigger one + if uint32(len(ps)) == read/dwordSize { // ps buffer was too small to host every results, retry with a bigger one psSize += 1024 continue } diff --git a/vendor/go.opencensus.io/metric/metricexport/export.go b/vendor/go.opencensus.io/metric/metricexport/export.go deleted file mode 100644 index 23f4a864..00000000 --- a/vendor/go.opencensus.io/metric/metricexport/export.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2019, OpenCensus 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 metricexport - -import ( - "context" - - "go.opencensus.io/metric/metricdata" -) - -// Exporter is an interface that exporters implement to export the metric data. -type Exporter interface { - ExportMetrics(ctx context.Context, data []*metricdata.Metric) error -} diff --git a/vendor/go.opencensus.io/metric/metricexport/reader.go b/vendor/go.opencensus.io/metric/metricexport/reader.go deleted file mode 100644 index 8a09d0f0..00000000 --- a/vendor/go.opencensus.io/metric/metricexport/reader.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2019, OpenCensus 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 metricexport - -import ( - "context" - "fmt" - "sync" - "time" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricproducer" - "go.opencensus.io/trace" -) - -var ( - defaultSampler = trace.ProbabilitySampler(0.0001) - errReportingIntervalTooLow = fmt.Errorf("reporting interval less than %d", minimumReportingDuration) - errAlreadyStarted = fmt.Errorf("already started") - errIntervalReaderNil = fmt.Errorf("interval reader is nil") - errExporterNil = fmt.Errorf("exporter is nil") - errReaderNil = fmt.Errorf("reader is nil") -) - -const ( - defaultReportingDuration = 60 * time.Second - minimumReportingDuration = 1 * time.Second - defaultSpanName = "ExportMetrics" -) - -// ReaderOptions contains options pertaining to metrics reader. -type ReaderOptions struct { - // SpanName is the name used for span created to export metrics. - SpanName string -} - -// Reader reads metrics from all producers registered -// with producer manager and exports those metrics using provided -// exporter. -type Reader struct { - sampler trace.Sampler - - spanName string -} - -// IntervalReader periodically reads metrics from all producers registered -// with producer manager and exports those metrics using provided -// exporter. Call Reader.Stop() to stop the reader. -type IntervalReader struct { - // ReportingInterval it the time duration between two consecutive - // metrics reporting. defaultReportingDuration is used if it is not set. - // It cannot be set lower than minimumReportingDuration. - ReportingInterval time.Duration - - exporter Exporter - timer *time.Ticker - quit, done chan bool - mu sync.RWMutex - reader *Reader -} - -// ReaderOption apply changes to ReaderOptions. -type ReaderOption func(*ReaderOptions) - -// WithSpanName makes new reader to use given span name when exporting metrics. -func WithSpanName(spanName string) ReaderOption { - return func(o *ReaderOptions) { - o.SpanName = spanName - } -} - -// NewReader returns a reader configured with specified options. -func NewReader(o ...ReaderOption) *Reader { - var opts ReaderOptions - for _, op := range o { - op(&opts) - } - reader := &Reader{defaultSampler, defaultSpanName} - if opts.SpanName != "" { - reader.spanName = opts.SpanName - } - return reader -} - -// NewIntervalReader creates a reader. Once started it periodically -// reads metrics from all producers and exports them using provided exporter. -func NewIntervalReader(reader *Reader, exporter Exporter) (*IntervalReader, error) { - if exporter == nil { - return nil, errExporterNil - } - if reader == nil { - return nil, errReaderNil - } - - r := &IntervalReader{ - exporter: exporter, - reader: reader, - } - return r, nil -} - -// Start starts the IntervalReader which periodically reads metrics from all -// producers registered with global producer manager. If the reporting interval -// is not set prior to calling this function then default reporting interval -// is used. -func (ir *IntervalReader) Start() error { - if ir == nil { - return errIntervalReaderNil - } - ir.mu.Lock() - defer ir.mu.Unlock() - var reportingInterval = defaultReportingDuration - if ir.ReportingInterval != 0 { - if ir.ReportingInterval < minimumReportingDuration { - return errReportingIntervalTooLow - } - reportingInterval = ir.ReportingInterval - } - - if ir.quit != nil { - return errAlreadyStarted - } - ir.timer = time.NewTicker(reportingInterval) - ir.quit = make(chan bool) - ir.done = make(chan bool) - - go ir.startInternal() - return nil -} - -func (ir *IntervalReader) startInternal() { - for { - select { - case <-ir.timer.C: - ir.reader.ReadAndExport(ir.exporter) - case <-ir.quit: - ir.timer.Stop() - ir.done <- true - return - } - } -} - -// Stop stops the reader from reading and exporting metrics. -// Additional call to Stop are no-ops. -func (ir *IntervalReader) Stop() { - if ir == nil { - return - } - ir.mu.Lock() - defer ir.mu.Unlock() - if ir.quit == nil { - return - } - ir.quit <- true - <-ir.done - close(ir.quit) - close(ir.done) - ir.quit = nil -} - -// Flush flushes the metrics if IntervalReader is stopped, otherwise no-op. -func (ir *IntervalReader) Flush() { - ir.mu.Lock() - defer ir.mu.Unlock() - - // No-op if IntervalReader is not stopped - if ir.quit != nil { - return - } - - ir.reader.ReadAndExport(ir.exporter) -} - -// ReadAndExport reads metrics from all producer registered with -// producer manager and then exports them using provided exporter. -func (r *Reader) ReadAndExport(exporter Exporter) { - ctx, span := trace.StartSpan(context.Background(), r.spanName, trace.WithSampler(r.sampler)) - defer span.End() - producers := metricproducer.GlobalManager().GetAll() - data := []*metricdata.Metric{} - for _, producer := range producers { - data = append(data, producer.Read()...) - } - // TODO: [rghetia] add metrics for errors. - exporter.ExportMetrics(ctx, data) -} diff --git a/vendor/go.opentelemetry.io/collector/component/componenttest/obsreporttest.go b/vendor/go.opentelemetry.io/collector/component/componenttest/obsreporttest.go index 36fc28b1..f342879a 100644 --- a/vendor/go.opentelemetry.io/collector/component/componenttest/obsreporttest.go +++ b/vendor/go.opentelemetry.io/collector/component/componenttest/obsreporttest.go @@ -6,10 +6,8 @@ package componenttest // import "go.opentelemetry.io/collector/component/compone import ( "context" - ocprom "contrib.go.opencensus.io/exporter/prometheus" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" - "go.opencensus.io/stats/view" otelprom "go.opentelemetry.io/otel/exporters/prometheus" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" @@ -39,11 +37,9 @@ type TestTelemetry struct { ts component.TelemetrySettings id component.ID SpanRecorder *tracetest.SpanRecorder - views []*view.View prometheusChecker *prometheusChecker meterProvider *sdkmetric.MeterProvider - ocExporter *ocprom.Exporter } // CheckExporterTraces checks that for the current exported values for trace exporter metrics match given values. @@ -124,8 +120,6 @@ func (tts *TestTelemetry) CheckScraperMetrics(receiver component.ID, scraper com // Shutdown unregisters any views and shuts down the SpanRecorder func (tts *TestTelemetry) Shutdown(ctx context.Context) error { - view.Unregister(tts.views...) - view.UnregisterExporter(tts.ocExporter) var errs error errs = multierr.Append(errs, tts.SpanRecorder.Shutdown(ctx)) if tts.meterProvider != nil { @@ -153,18 +147,6 @@ func SetupTelemetry(id component.ID) (TestTelemetry, error) { } settings.ts.TracerProvider = tp settings.ts.MetricsLevel = configtelemetry.LevelNormal - err := view.Register(settings.views...) - if err != nil { - return settings, err - } - - promReg := prometheus.NewRegistry() - - settings.ocExporter, err = ocprom.NewExporter(ocprom.Options{Registry: promReg}) - if err != nil { - return settings, err - } - view.RegisterExporter(settings.ocExporter) promRegOtel := prometheus.NewRegistry() diff --git a/vendor/go.opentelemetry.io/collector/component/componenttest/otelprometheuschecker.go b/vendor/go.opentelemetry.io/collector/component/componenttest/otelprometheuschecker.go index d3302e6b..878bfd0a 100644 --- a/vendor/go.opentelemetry.io/collector/component/componenttest/otelprometheuschecker.go +++ b/vendor/go.opentelemetry.io/collector/component/componenttest/otelprometheuschecker.go @@ -11,7 +11,6 @@ import ( io_prometheus_client "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" - "go.opencensus.io/stats/view" "go.opentelemetry.io/otel/attribute" "go.uber.org/multierr" @@ -101,8 +100,6 @@ func (pc *prometheusChecker) checkExporterEnqueueFailed(exporter component.ID, d func (pc *prometheusChecker) checkExporterMetricGauge(exporter component.ID, metric string, val int64) error { exporterAttrs := attributesForExporterMetrics(exporter) - // Forces a flush for the opencensus view data. - _, _ = view.RetrieveData(metric) ts, err := pc.getMetric(metric, io_prometheus_client.MetricType_GAUGE, exporterAttrs) if err != nil { @@ -118,8 +115,6 @@ func (pc *prometheusChecker) checkExporterMetricGauge(exporter component.ID, met } func (pc *prometheusChecker) checkCounter(expectedMetric string, value int64, attrs []attribute.KeyValue) error { - // Forces a flush for the opencensus view data. - _, _ = view.RetrieveData(expectedMetric) ts, err := pc.getMetric(expectedMetric, io_prometheus_client.MetricType_COUNTER, attrs) if err != nil { diff --git a/vendor/go.opentelemetry.io/collector/component/config.go b/vendor/go.opentelemetry.io/collector/component/config.go index f34f04b8..f54b3a17 100644 --- a/vendor/go.opentelemetry.io/collector/component/config.go +++ b/vendor/go.opentelemetry.io/collector/component/config.go @@ -4,7 +4,9 @@ package component // import "go.opentelemetry.io/collector/component" import ( + "fmt" "reflect" + "regexp" "go.uber.org/multierr" @@ -110,6 +112,45 @@ func callValidateIfPossible(v reflect.Value) error { // Type is the component type as it is used in the config. type Type string +// String returns the string representation of the type. +func (t Type) String() string { + return string(t) +} + +// typeRegexp is used to validate the type of a component. +// A type must start with an ASCII alphabetic character and +// can only contain ASCII alphanumeric characters and '_'. +// This must be kept in sync with the regex in cmd/mdatagen/validate.go. +var typeRegexp = regexp.MustCompile(`^[a-zA-Z][0-9a-zA-Z_]*$`) + +// NewType creates a type. It returns an error if the type is invalid. +// A type must +// - have at least one character, +// - start with an ASCII alphabetic character and +// - can only contain ASCII alphanumeric characters and '_'. +func NewType(ty string) (Type, error) { + if len(ty) == 0 { + return Type(""), fmt.Errorf("id must not be empty") + } + if !typeRegexp.MatchString(ty) { + return Type(""), fmt.Errorf("invalid character(s) in type %q", ty) + } + return Type(ty), nil +} + +// MustNewType creates a type. It panics if the type is invalid. +// A type must +// - have at least one character, +// - start with an ASCII alphabetic character and +// - can only contain ASCII alphanumeric characters and '_'. +func MustNewType(strType string) Type { + ty, err := NewType(strType) + if err != nil { + panic(err) + } + return ty +} + // DataType is a special Type that represents the data types supported by the collector. We currently support // collecting metrics, traces and logs, this can expand in the future. type DataType = Type diff --git a/vendor/go.opentelemetry.io/collector/component/identifiable.go b/vendor/go.opentelemetry.io/collector/component/identifiable.go index 331c348f..d2d65a5e 100644 --- a/vendor/go.opentelemetry.io/collector/component/identifiable.go +++ b/vendor/go.opentelemetry.io/collector/component/identifiable.go @@ -26,11 +26,23 @@ func NewID(typeVal Type) ID { return ID{typeVal: typeVal} } +// MustNewID builds a Type and returns a new ID with the given Type and empty name. +// See MustNewType to check the valid values of typeVal. +func MustNewID(typeVal string) ID { + return ID{typeVal: MustNewType(typeVal)} +} + // NewIDWithName returns a new ID with the given Type and name. func NewIDWithName(typeVal Type, nameVal string) ID { return ID{typeVal: typeVal, nameVal: nameVal} } +// MustNewIDWithName builds a Type and returns a new ID with the given Type and name. +// See MustNewType to check the valid values of typeVal. +func MustNewIDWithName(typeVal string, nameVal string) ID { + return ID{typeVal: MustNewType(typeVal), nameVal: nameVal} +} + // Type returns the type of the component. func (id ID) Type() Type { return id.typeVal @@ -51,34 +63,41 @@ func (id ID) MarshalText() (text []byte, err error) { func (id *ID) UnmarshalText(text []byte) error { idStr := string(text) items := strings.SplitN(idStr, typeAndNameSeparator, 2) + var typeStr, nameStr string if len(items) >= 1 { - id.typeVal = Type(strings.TrimSpace(items[0])) + typeStr = strings.TrimSpace(items[0]) } - if len(items) == 1 && id.typeVal == "" { + if len(items) == 1 && typeStr == "" { return errors.New("id must not be empty") } - if id.typeVal == "" { + if typeStr == "" { return fmt.Errorf("in %q id: the part before %s should not be empty", idStr, typeAndNameSeparator) } if len(items) > 1 { // "name" part is present. - id.nameVal = strings.TrimSpace(items[1]) - if id.nameVal == "" { + nameStr = strings.TrimSpace(items[1]) + if nameStr == "" { return fmt.Errorf("in %q id: the part after %s should not be empty", idStr, typeAndNameSeparator) } } + var err error + if id.typeVal, err = NewType(typeStr); err != nil { + return fmt.Errorf("in %q id: %w", idStr, err) + } + id.nameVal = nameStr + return nil } // String returns the ID string representation as "type[/name]" format. func (id ID) String() string { if id.nameVal == "" { - return string(id.typeVal) + return id.typeVal.String() } - return string(id.typeVal) + typeAndNameSeparator + id.nameVal + return id.typeVal.String() + typeAndNameSeparator + id.nameVal } diff --git a/vendor/go.opentelemetry.io/collector/component/status.go b/vendor/go.opentelemetry.io/collector/component/status.go index 8d0650b0..8cd4d802 100644 --- a/vendor/go.opentelemetry.io/collector/component/status.go +++ b/vendor/go.opentelemetry.io/collector/component/status.go @@ -98,9 +98,6 @@ func NewFatalErrorEvent(err error) *StatusEvent { return ev } -// Deprecated: [v0.92.0] use directly func(*StatusEvent) error. -type StatusFunc = func(*StatusEvent) error - // AggregateStatus will derive a status for the given input using the following rules in order: // 1. If all instances have the same status, there is nothing to aggregate, return it. // 2. If any instance encounters a fatal error, the component is in a Fatal Error state. diff --git a/vendor/go.opentelemetry.io/collector/component/telemetry.go b/vendor/go.opentelemetry.io/collector/component/telemetry.go index f4d02231..572b4bdd 100644 --- a/vendor/go.opentelemetry.io/collector/component/telemetry.go +++ b/vendor/go.opentelemetry.io/collector/component/telemetry.go @@ -35,13 +35,6 @@ type TelemetrySettings struct { // Resource contains the resource attributes for the collector's telemetry. Resource pcommon.Resource - // ReportComponentStatus allows a component to report runtime changes in status. The service - // will automatically report status for a component during startup and shutdown. Components can - // use this method to report status after start and before shutdown. - // Deprecated: [v0.92.0] This function will be removed in a future release. - // Use ReportStatus instead. - ReportComponentStatus func(*StatusEvent) error - // ReportStatus allows a component to report runtime changes in status. The service // will automatically report status for a component during startup and shutdown. Components can // use this method to report status after start and before shutdown. diff --git a/vendor/go.opentelemetry.io/collector/config/confignet/confignet.go b/vendor/go.opentelemetry.io/collector/config/confignet/confignet.go index ad4e17c1..21c85458 100644 --- a/vendor/go.opentelemetry.io/collector/config/confignet/confignet.go +++ b/vendor/go.opentelemetry.io/collector/config/confignet/confignet.go @@ -45,18 +45,6 @@ func (na *NetAddr) Listen(ctx context.Context) (net.Listener, error) { return lc.Listen(ctx, na.Transport, na.Endpoint) } -// DialContext equivalent with net.Dialer's DialContext for this address. -// Deprecated: [v0.93.0] use Dial instead. -func (na *NetAddr) DialContext(ctx context.Context) (net.Conn, error) { - return na.Dial(ctx) -} - -// ListenContext equivalent with net.ListenConfig's Listen for this address. -// Deprecated: [v0.93.0] use Listen instead. -func (na *NetAddr) ListenContext(ctx context.Context) (net.Listener, error) { - return na.Listen(ctx) -} - // TCPAddr represents a TCP endpoint address. type TCPAddr struct { // Endpoint configures the address for this network connection. @@ -81,15 +69,3 @@ func (na *TCPAddr) Listen(ctx context.Context) (net.Listener, error) { lc := net.ListenConfig{} return lc.Listen(ctx, "tcp", na.Endpoint) } - -// DialContext equivalent with net.Dialer's DialContext for this address. -// Deprecated: [v0.93.0] use Dial instead. -func (na *TCPAddr) DialContext(ctx context.Context) (net.Conn, error) { - return na.Dial(ctx) -} - -// ListenContext equivalent with net.ListenConfig's Listen for this address. -// Deprecated: [v0.93.0] use Listen instead. -func (na *TCPAddr) ListenContext(ctx context.Context) (net.Listener, error) { - return na.Listen(ctx) -} diff --git a/vendor/go.opentelemetry.io/collector/config/configtelemetry/configtelemetry.go b/vendor/go.opentelemetry.io/collector/config/configtelemetry/configtelemetry.go index 0ec660bd..b8c0967c 100644 --- a/vendor/go.opentelemetry.io/collector/config/configtelemetry/configtelemetry.go +++ b/vendor/go.opentelemetry.io/collector/config/configtelemetry/configtelemetry.go @@ -4,7 +4,6 @@ package configtelemetry // import "go.opentelemetry.io/collector/config/configtelemetry" import ( - "encoding" "errors" "fmt" "strings" @@ -30,9 +29,6 @@ const ( // that every component should generate. type Level int32 -var _ encoding.TextMarshaler = (*Level)(nil) -var _ encoding.TextUnmarshaler = (*Level)(nil) - func (l Level) String() string { switch l { case LevelNone: diff --git a/vendor/go.opentelemetry.io/collector/confmap/converter.go b/vendor/go.opentelemetry.io/collector/confmap/converter.go index 233d86f5..17316d10 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/converter.go +++ b/vendor/go.opentelemetry.io/collector/confmap/converter.go @@ -7,6 +7,10 @@ import ( "context" ) +// ConverterSettings are the settings to initialize a Converter. +// Any Converter should take this as a parameter in its constructor. +type ConverterSettings struct{} + // Converter is a converter interface for the confmap.Conf that allows distributions // (in the future components as well) to build backwards compatible config converters. type Converter interface { diff --git a/vendor/go.opentelemetry.io/collector/confmap/converter/expandconverter/expand.go b/vendor/go.opentelemetry.io/collector/confmap/converter/expandconverter/expand.go index d2cd5e96..0296b4b2 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/converter/expandconverter/expand.go +++ b/vendor/go.opentelemetry.io/collector/confmap/converter/expandconverter/expand.go @@ -15,7 +15,7 @@ type converter struct{} // New returns a confmap.Converter, that expands all environment variables for a given confmap.Conf. // // Notice: This API is experimental. -func New() confmap.Converter { +func New(_ confmap.ConverterSettings) confmap.Converter { return converter{} } diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider.go index 93735b83..91c2a600 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider.go @@ -8,6 +8,10 @@ import ( "fmt" ) +// ProviderSettings are the settings to initialize a Provider. +// Any Provider should take this as a parameter in its constructor. +type ProviderSettings struct{} + // Provider is an interface that helps to retrieve a config map and watch for any // changes to the config map. Implementations may load the config from a file, // a database or any other source. diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/envprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/envprovider/provider.go index d548a459..941d235a 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/envprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/envprovider/provider.go @@ -17,12 +17,21 @@ const schemeName = "env" type provider struct{} +// NewWithSettings returns a new confmap.Provider that reads the configuration from the given environment variable. +// +// This Provider supports "env" scheme, and can be called with a selector: +// `env:NAME_OF_ENVIRONMENT_VARIABLE` +func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider { + return &provider{} +} + // New returns a new confmap.Provider that reads the configuration from the given environment variable. // // This Provider supports "env" scheme, and can be called with a selector: // `env:NAME_OF_ENVIRONMENT_VARIABLE` +// Deprecated: [v0.94.0] Use NewWithSettings instead. func New() confmap.Provider { - return &provider{} + return NewWithSettings(confmap.ProviderSettings{}) } func (emp *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/fileprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/fileprovider/provider.go index 4d5377e6..5fb5cab7 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/fileprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/fileprovider/provider.go @@ -33,10 +33,30 @@ type provider struct{} // `file:/path/to/file` - absolute path (unix, windows) // `file:c:/path/to/file` - absolute path including drive-letter (windows) // `file:c:\path\to\file` - absolute path including drive-letter (windows) -func New() confmap.Provider { +func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider { return &provider{} } +// New returns a new confmap.Provider that reads the configuration from a file. +// +// This Provider supports "file" scheme, and can be called with a "uri" that follows: +// +// file-uri = "file:" local-path +// local-path = [ drive-letter ] file-path +// drive-letter = ALPHA ":" +// +// The "file-path" can be relative or absolute, and it can be any OS supported format. +// +// Examples: +// `file:path/to/file` - relative path (unix, windows) +// `file:/path/to/file` - absolute path (unix, windows) +// `file:c:/path/to/file` - absolute path including drive-letter (windows) +// `file:c:\path\to\file` - absolute path including drive-letter (windows) +// Deprecated: [v0.94.0] Use NewWithSettings instead. +func New() confmap.Provider { + return NewWithSettings(confmap.ProviderSettings{}) +} + func (fmp *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { if !strings.HasPrefix(uri, schemeName+":") { return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, schemeName) diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/httpprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/httpprovider/provider.go index 458f7d5e..966faa51 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/httpprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/httpprovider/provider.go @@ -8,11 +8,21 @@ import ( "go.opentelemetry.io/collector/confmap/provider/internal/configurablehttpprovider" ) +// NewWithSettings returns a new confmap.Provider that reads the configuration from a http server. +// +// This Provider supports "http" scheme. +// +// One example for HTTP URI is: http://localhost:3333/getConfig +func NewWithSettings(set confmap.ProviderSettings) confmap.Provider { + return configurablehttpprovider.New(configurablehttpprovider.HTTPScheme, set) +} + // New returns a new confmap.Provider that reads the configuration from a http server. // // This Provider supports "http" scheme. // // One example for HTTP URI is: http://localhost:3333/getConfig +// Deprecated: [v0.94.0] Use NewWithSettings instead. func New() confmap.Provider { - return configurablehttpprovider.New(configurablehttpprovider.HTTPScheme) + return NewWithSettings(confmap.ProviderSettings{}) } diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/httpsprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/httpsprovider/provider.go index 1afe0b54..6db2cc9b 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/httpsprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/httpsprovider/provider.go @@ -14,6 +14,17 @@ import ( // // To add extra CA certificates you need to install certificates in the system pool. This procedure is operating system // dependent. E.g.: on Linux please refer to the `update-ca-trust` command. +func NewWithSettings(set confmap.ProviderSettings) confmap.Provider { + return configurablehttpprovider.New(configurablehttpprovider.HTTPSScheme, set) +} + +// New returns a new confmap.Provider that reads the configuration from a https server. +// +// This Provider supports "https" scheme. One example of an HTTPS URI is: https://localhost:3333/getConfig +// +// To add extra CA certificates you need to install certificates in the system pool. This procedure is operating system +// dependent. E.g.: on Linux please refer to the `update-ca-trust` command. +// Deprecated: [v0.94.0] Use NewWithSettings instead. func New() confmap.Provider { - return configurablehttpprovider.New(configurablehttpprovider.HTTPSScheme) + return NewWithSettings(confmap.ProviderSettings{}) } diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/internal/configurablehttpprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/internal/configurablehttpprovider/provider.go index d4e3efcc..c683d3d9 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/internal/configurablehttpprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/internal/configurablehttpprovider/provider.go @@ -38,7 +38,7 @@ type provider struct { // One example for http-uri: http://localhost:3333/getConfig // One example for https-uri: https://localhost:3333/getConfig // This is used by the http and https external implementations. -func New(scheme SchemeType) confmap.Provider { +func New(scheme SchemeType, _ confmap.ProviderSettings) confmap.Provider { return &provider{scheme: scheme} } diff --git a/vendor/go.opentelemetry.io/collector/confmap/provider/yamlprovider/provider.go b/vendor/go.opentelemetry.io/collector/confmap/provider/yamlprovider/provider.go index 8573318e..3e9a1f9e 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/provider/yamlprovider/provider.go +++ b/vendor/go.opentelemetry.io/collector/confmap/provider/yamlprovider/provider.go @@ -16,6 +16,19 @@ const schemeName = "yaml" type provider struct{} +// NewWithSettings returns a new confmap.Provider that allows to provide yaml bytes. +// +// This Provider supports "yaml" scheme, and can be called with a "uri" that follows: +// +// bytes-uri = "yaml:" yaml-bytes +// +// Examples: +// `yaml:processors::batch::timeout: 2s` +// `yaml:processors::batch/foo::timeout: 3s` +func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider { + return &provider{} +} + // New returns a new confmap.Provider that allows to provide yaml bytes. // // This Provider supports "yaml" scheme, and can be called with a "uri" that follows: @@ -25,8 +38,9 @@ type provider struct{} // Examples: // `yaml:processors::batch::timeout: 2s` // `yaml:processors::batch/foo::timeout: 3s` +// Deprecated: [v0.94.0] Use NewWithSettings instead. func New() confmap.Provider { - return &provider{} + return NewWithSettings(confmap.ProviderSettings{}) } func (s *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { diff --git a/vendor/go.opentelemetry.io/collector/confmap/resolver.go b/vendor/go.opentelemetry.io/collector/confmap/resolver.go index 91bf848d..f056d18d 100644 --- a/vendor/go.opentelemetry.io/collector/confmap/resolver.go +++ b/vendor/go.opentelemetry.io/collector/confmap/resolver.go @@ -11,20 +11,12 @@ import ( "strings" "go.uber.org/multierr" - - "go.opentelemetry.io/collector/featuregate" ) // follows drive-letter specification: // https://datatracker.ietf.org/doc/html/draft-kerwin-file-scheme-07.html#section-2.2 var driverLetterRegexp = regexp.MustCompile("^[A-z]:") -var _ = featuregate.GlobalRegistry().MustRegister( - "confmap.expandEnabled", - featuregate.StageStable, - featuregate.WithRegisterToVersion("v0.75.0"), - featuregate.WithRegisterDescription("controls whether expanding embedded external config providers URIs")) - // Resolver resolves a configuration as a Conf. type Resolver struct { uris []location diff --git a/vendor/go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata/generated_status.go b/vendor/go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata/generated_status.go index 72170d1f..5460b8c7 100644 --- a/vendor/go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata/generated_status.go +++ b/vendor/go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata/generated_status.go @@ -9,8 +9,11 @@ import ( "go.opentelemetry.io/collector/component" ) +var ( + Type = component.MustNewType("zpages") +) + const ( - Type = "zpages" ExtensionStability = component.StabilityLevelBeta ) diff --git a/vendor/go.opentelemetry.io/collector/featuregate/registry.go b/vendor/go.opentelemetry.io/collector/featuregate/registry.go index b43a33e4..b2dc2e19 100644 --- a/vendor/go.opentelemetry.io/collector/featuregate/registry.go +++ b/vendor/go.opentelemetry.io/collector/featuregate/registry.go @@ -4,6 +4,7 @@ package featuregate // import "go.opentelemetry.io/collector/featuregate" import ( + "errors" "fmt" "net/url" "regexp" @@ -22,6 +23,11 @@ var ( idRegexp = regexp.MustCompile(`^[0-9a-zA-Z\.]*$`) ) +var ( + // ErrAlreadyRegistered is returned when adding a Gate that is already registered. + ErrAlreadyRegistered = errors.New("gate is already registered") +) + // GlobalRegistry returns the global Registry. func GlobalRegistry() *Registry { return globalRegistry @@ -157,7 +163,7 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga } if _, loaded := r.gates.LoadOrStore(id, g); loaded { - return nil, fmt.Errorf("attempted to add pre-existing gate %q", id) + return nil, fmt.Errorf("failed to register %q: %w", id, ErrAlreadyRegistered) } return g, nil } diff --git a/vendor/go.opentelemetry.io/collector/pdata/pcommon/map.go b/vendor/go.opentelemetry.io/collector/pdata/pcommon/map.go index c41aa917..5bbfab96 100644 --- a/vendor/go.opentelemetry.io/collector/pdata/pcommon/map.go +++ b/vendor/go.opentelemetry.io/collector/pdata/pcommon/map.go @@ -11,6 +11,9 @@ import ( ) // Map stores a map of string keys to elements of Value type. +// +// Must use NewMap function to create new instances. +// Important: zero-initialized instance is not valid for use. type Map internal.Map // NewMap creates a Map with 0 elements. @@ -55,8 +58,8 @@ func (m Map) EnsureCapacity(capacity int) { // It is allowed to modify the returned value using Value.Set* functions. // Such modification will be applied to the value stored in this map. // -// If the key does not exist returns an invalid instance of the KeyValue and false. -// Calling any functions on the returned invalid instance will cause a panic. +// If the key does not exist returns a zero-initialized KeyValue and false. +// Calling any functions on the returned invalid instance may cause a panic. func (m Map) Get(key string) (Value, bool) { for i := range *m.getOrig() { akv := &(*m.getOrig())[i] diff --git a/vendor/go.opentelemetry.io/collector/pdata/pcommon/trace_state.go b/vendor/go.opentelemetry.io/collector/pdata/pcommon/trace_state.go index dd163629..c8f84217 100644 --- a/vendor/go.opentelemetry.io/collector/pdata/pcommon/trace_state.go +++ b/vendor/go.opentelemetry.io/collector/pdata/pcommon/trace_state.go @@ -8,6 +8,9 @@ import ( ) // TraceState represents the trace state from the w3c-trace-context. +// +// Must use NewTraceState function to create new instances. +// Important: zero-initialized instance is not valid for use. type TraceState internal.TraceState func NewTraceState() TraceState { diff --git a/vendor/go.opentelemetry.io/contrib/config/config.go b/vendor/go.opentelemetry.io/contrib/config/config.go index 9c182e0f..9002809f 100644 --- a/vendor/go.opentelemetry.io/contrib/config/config.go +++ b/vendor/go.opentelemetry.io/contrib/config/config.go @@ -8,8 +8,6 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) @@ -119,13 +117,3 @@ func WithOpenTelemetryConfiguration(cfg OpenTelemetryConfiguration) Configuratio // TODO: create SDK from the model: // - https://github.com/open-telemetry/opentelemetry-go-contrib/issues/4371 - -func newResource(res *Resource) (*resource.Resource, error) { - if res == nil { - return resource.Default(), nil - } - return resource.Merge(resource.Default(), - resource.NewWithAttributes(semconv.SchemaURL, - semconv.ServiceName(*res.Attributes.ServiceName), - )) -} diff --git a/vendor/go.opentelemetry.io/contrib/config/resource.go b/vendor/go.opentelemetry.io/contrib/config/resource.go new file mode 100644 index 00000000..6cbc2869 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/config/resource.go @@ -0,0 +1,19 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package config // import "go.opentelemetry.io/contrib/config" + +import ( + "go.opentelemetry.io/otel/sdk/resource" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" +) + +func newResource(res *Resource) (*resource.Resource, error) { + if res == nil || res.Attributes == nil { + return resource.Default(), nil + } + return resource.Merge(resource.Default(), + resource.NewWithAttributes(*res.SchemaUrl, + semconv.ServiceName(*res.Attributes.ServiceName), + )) +} diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index fe670d79..ea1f723e 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -8,6 +8,54 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.23.0] 2024-02-06 + +This release contains the first stable, `v1`, release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +- Experimental exemplar exporting is added to the metric SDK. + See [metric documentation](./sdk/metric/EXPERIMENTAL.md#exemplars) for more information about this feature and how to enable it. (#4871) +- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) + +### Changed + +- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. + Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. + It is up to the user to decide if they want to use the returned `Resource` or not. + It may have desired attributes overwritten or include stale semantic conventions. (#4876) + +### Fixed + +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) +- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) +- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) + +## [1.23.0-rc.1] 2024-01-18 + +This is a release candidate for the v1.23.0 release. +That release is expected to include the `v1` release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ## [1.22.0/0.45.0] 2024-01-17 ### Added @@ -28,7 +76,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) -- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.19.0` version of the OpenTelemetry specification. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) - Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) @@ -2775,7 +2823,9 @@ 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.22.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.0...HEAD +[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 +[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 [1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 [1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 [1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS index 62374000..31d336d9 100644 --- a/vendor/go.opentelemetry.io/otel/CODEOWNERS +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -14,4 +14,4 @@ * @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @MadVikingGod @pellared \ No newline at end of file +CODEOWNERS @MrAlias @MadVikingGod @pellared @dashpole \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index 31857a61..c9f2bac5 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -617,13 +617,13 @@ should be canceled. - [Evan Torrie](https://github.com/evantorrie), Verizon Media - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics -- [David Ashpole](https://github.com/dashpole), Google - [Chester Cheung](https://github.com/hanyuancheung), Tencent - [Damien Mathieu](https://github.com/dmathieu), Elastic - [Anthony Mirabella](https://github.com/Aneurysm9), AWS ### Maintainers +- [David Ashpole](https://github.com/dashpole), Google - [Aaron Clawson](https://github.com/MadVikingGod), LightStep - [Robert Pająk](https://github.com/pellared), Splunk - [Tyler Yahn](https://github.com/MrAlias), Splunk diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go index 7e6765b0..fb6da514 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -427,7 +427,7 @@ func (l *Set) MarshalJSON() ([]byte, error) { return json.Marshal(l.equivalent.iface) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Set. func (l Set) MarshalLog() interface{} { kvs := make(map[string]string) for _, kv := range l.ToSlice() { diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go index b46a38d6..cb41c7d5 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go @@ -104,7 +104,7 @@ func NewUnstarted(client Client) *Exporter { } } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go index 1f514ef9..a3c2690c 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go @@ -28,7 +28,7 @@ The value may additionally a port, a scheme, and a path. The value accepts "http" and "https" scheme. The value should not contain a query string or fragment. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. -The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithGRPCConn] options. OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - setting "true" disables client transport security for the exporter's gRPC connection. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index dddb1f33..f0203cbe 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -20,6 +20,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -32,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -265,6 +267,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go index 17ffeaf6..0fddac75 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -64,14 +64,44 @@ func WithInsecure() Option { return wrappedOption{otlpconfig.WithInsecure()} } -// WithEndpoint sets the target endpoint the exporter will connect to. If -// unset, localhost:4317 will be used as a default. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. // // This option has no effect if WithGRPCConn is used. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } +// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{otlpconfig.WithEndpointURL(u)} +} + // WithReconnectionPeriod set the minimum amount of time between connection // attempts to the target endpoint. // diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go index 854cc38c..cb4f19ad 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/doc.go @@ -26,14 +26,14 @@ The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. The configuration can be overridden by OTEL_EXPORTER_OTLP_TRACES_ENDPOINT -environment variable and by [WithEndpoint], [WithInsecure] options. +environment variable and by [WithEndpoint], [WithEndpointURL], [WithInsecure] options. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (default: "https://localhost:4318/v1/traces") - target URL to which the exporter sends telemetry. The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. -The configuration can be overridden by [WithEndpoint], [WitnInsecure], [WithURLPath] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options. OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - key-value pairs used as headers associated with HTTP requests. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go index 8401bd7f..3b81641a 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go @@ -20,6 +20,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -32,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -265,6 +267,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/options.go index e3ed6494..ea6b767a 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -60,15 +60,44 @@ func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config return w.ApplyHTTPOption(cfg) } -// WithEndpoint allows one to set the address of the collector -// endpoint that the driver will use to send spans. If -// unset, it will instead try to use -// the default endpoint (localhost:4318). Note that the endpoint -// must not contain any URL path. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } +// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{otlpconfig.WithEndpointURL(u)} +} + // WithCompression tells the driver to compress the sent data. func WithCompression(compression Compression) Option { return wrappedOption{otlpconfig.WithCompression(otlpconfig.Compression(compression))} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index 3b3bc359..1d00766c 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ 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.22.0" + return "1.23.0" } diff --git a/vendor/go.opentelemetry.io/otel/exporters/stdout/stdouttrace/trace.go b/vendor/go.opentelemetry.io/otel/exporters/stdout/stdouttrace/trace.go index 21658151..4998d777 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/stdout/stdouttrace/trace.go +++ b/vendor/go.opentelemetry.io/otel/exporters/stdout/stdouttrace/trace.go @@ -107,7 +107,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return nil } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/EXPERIMENTAL.md b/vendor/go.opentelemetry.io/otel/sdk/metric/EXPERIMENTAL.md index d2a5a047..658d2027 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/EXPERIMENTAL.md +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/EXPERIMENTAL.md @@ -40,6 +40,67 @@ Disable the cardinality limit. unset OTEL_GO_X_CARDINALITY_LIMIT ``` +### Exemplars + +A sample of measurements made may be exported directly as a set of exemplars. + +This experimental feature can be enabled by setting the `OTEL_GO_X_EXEMPLAR` environment variable. +The value of must be the case-insensitive string of `"true"` to enable the feature. +All other values are ignored. + +Exemplar filters are a supported. +The exemplar filter applies to all measurements made. +They filter these measurements, only allowing certain measurements to be passed to the underlying exemplar reservoir. + +To change the exemplar filter from the default `"trace_based"` filter set the `OTEL_METRICS_EXEMPLAR_FILTER` environment variable. +The value must be the case-sensitive string defined by the [OpenTelemetry specification]. + +- `"always_on"`: allows all measurements +- `"always_off"`: denies all measurements +- `"trace_based"`: allows only sampled measurements + +All values other than these will result in the default, `"trace_based"`, exemplar filter being used. + +[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/a6ca2fd484c9e76fe1d8e1c79c99f08f4745b5ee/specification/configuration/sdk-environment-variables.md#exemplar + +#### Examples + +Enable exemplars to be exported. + +```console +export OTEL_GO_X_EXEMPLAR=true +``` + +Disable exemplars from being exported. + +```console +unset OTEL_GO_X_EXEMPLAR +``` + +Set the exemplar filter to allow all measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=always_on +``` + +Set the exemplar filter to deny all measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=always_off +``` + +Set the exemplar filter to only allow sampled measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=trace_based +``` + +Revert to the default exemplar filter (`"trace_based"`) + +```console +unset OTEL_METRICS_EXEMPLAR_FILTER +``` + ## Compatibility and Stability Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../VERSIONING.md). diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/cache.go b/vendor/go.opentelemetry.io/otel/sdk/metric/cache.go index de9d6f00..e9c0b38d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/cache.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/cache.go @@ -52,3 +52,43 @@ func (c *cache[K, V]) Lookup(key K, f func() V) V { c.data[key] = val return val } + +// HasKey returns true if Lookup has previously been called with that key +// +// HasKey is safe to call concurrently. +func (c *cache[K, V]) HasKey(key K) bool { + c.Lock() + defer c.Unlock() + _, ok := c.data[key] + return ok +} + +// cacheWithErr is a locking storage used to quickly return already computed values and an error. +// +// The zero value of a cacheWithErr is empty and ready to use. +// +// A cacheWithErr must not be copied after first use. +// +// All methods of a cacheWithErr are safe to call concurrently. +type cacheWithErr[K comparable, V any] struct { + cache[K, valAndErr[V]] +} + +type valAndErr[V any] struct { + val V + err error +} + +// Lookup returns the value stored in the cacheWithErr with the associated key +// if it exists. Otherwise, f is called and its returned value is set in the +// cacheWithErr for key and returned. +// +// Lookup is safe to call concurrently. It will hold the cacheWithErr lock, so f +// should not block excessively. +func (c *cacheWithErr[K, V]) Lookup(key K, f func() (V, error)) (V, error) { + combined := c.cache.Lookup(key, func() valAndErr[V] { + val, err := f() + return valAndErr[V]{val: val, err: err} + }) + return combined.val, combined.err +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go new file mode 100644 index 00000000..77579acd --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go @@ -0,0 +1,96 @@ +// 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/sdk/metric" + +import ( + "os" + "runtime" + + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + "go.opentelemetry.io/otel/sdk/metric/internal/x" +) + +// reservoirFunc returns the appropriately configured exemplar reservoir +// creation func based on the passed InstrumentKind and user defined +// environment variables. +// +// Note: This will only return non-nil values when the experimental exemplar +// feature is enabled and the OTEL_METRICS_EXEMPLAR_FILTER environment variable +// is not set to always_off. +func reservoirFunc[N int64 | float64](agg Aggregation) func() exemplar.Reservoir[N] { + if !x.Exemplars.Enabled() { + return nil + } + + // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/metrics/sdk.md#exemplar-defaults + resF := func() func() exemplar.Reservoir[N] { + // Explicit bucket histogram aggregation with more than 1 bucket will + // use AlignedHistogramBucketExemplarReservoir. + a, ok := agg.(AggregationExplicitBucketHistogram) + if ok && len(a.Boundaries) > 0 { + cp := make([]float64, len(a.Boundaries)) + copy(cp, a.Boundaries) + return func() exemplar.Reservoir[N] { + bounds := cp + return exemplar.Histogram[N](bounds) + } + } + + var n int + if a, ok := agg.(AggregationBase2ExponentialHistogram); ok { + // Base2 Exponential Histogram Aggregation SHOULD use a + // SimpleFixedSizeExemplarReservoir with a reservoir equal to the + // smaller of the maximum number of buckets configured on the + // aggregation or twenty (e.g. min(20, max_buckets)). + n = int(a.MaxSize) + if n > 20 { + n = 20 + } + } else { + // https://github.com/open-telemetry/opentelemetry-specification/blob/e94af89e3d0c01de30127a0f423e912f6cda7bed/specification/metrics/sdk.md#simplefixedsizeexemplarreservoir + // This Exemplar reservoir MAY take a configuration parameter for + // the size of the reservoir. If no size configuration is + // provided, the default size MAY be the number of possible + // concurrent threads (e.g. numer of CPUs) to help reduce + // contention. Otherwise, a default size of 1 SHOULD be used. + n = runtime.NumCPU() + if n < 1 { + // Should never be the case, but be defensive. + n = 1 + } + } + + return func() exemplar.Reservoir[N] { + return exemplar.FixedSize[N](n) + } + } + + // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/configuration/sdk-environment-variables.md#exemplar + const filterEnvKey = "OTEL_METRICS_EXEMPLAR_FILTER" + + switch os.Getenv(filterEnvKey) { + case "always_on": + return resF() + case "always_off": + return exemplar.Drop[N] + case "trace_based": + fallthrough + default: + newR := resF() + return func() exemplar.Reservoir[N] { + return exemplar.SampledFilter(newR()) + } + } +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go index c61f8513..4060a2f7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go @@ -19,6 +19,7 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -44,6 +45,12 @@ type Builder[N int64 | float64] struct { // Filter is the attribute filter the aggregate function will use on the // input of measurements. Filter attribute.Filter + // ReservoirFunc is the factory function used by aggregate functions to + // create new exemplar reservoirs for a new seen attribute set. + // + // If this is not provided a default factory function that returns an + // exemplar.Drop reservoir will be used. + ReservoirFunc func() exemplar.Reservoir[N] // AggregationLimit is the cardinality limit of measurement attributes. Any // measurement for new attributes once the limit has been reached will be // aggregated into a single aggregate for the "otel.metric.overflow" @@ -54,15 +61,27 @@ type Builder[N int64 | float64] struct { AggregationLimit int } -func (b Builder[N]) filter(f Measure[N]) Measure[N] { +func (b Builder[N]) resFunc() func() exemplar.Reservoir[N] { + if b.ReservoirFunc != nil { + return b.ReservoirFunc + } + + return exemplar.Drop[N] +} + +type fltrMeasure[N int64 | float64] func(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) + +func (b Builder[N]) filter(f fltrMeasure[N]) Measure[N] { if b.Filter != nil { fltr := b.Filter // Copy to make it immutable after assignment. return func(ctx context.Context, n N, a attribute.Set) { - fAttr, _ := a.Filter(fltr) - f(ctx, n, fAttr) + fAttr, dropped := a.Filter(fltr) + f(ctx, n, fAttr, dropped) } } - return f + return func(ctx context.Context, n N, a attribute.Set) { + f(ctx, n, a, nil) + } } // LastValue returns a last-value aggregate function input and output. @@ -71,7 +90,7 @@ func (b Builder[N]) filter(f Measure[N]) Measure[N] { func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // Delta temporality is the only temporality that makes semantic sense for // a last-value aggregate. - lv := newLastValue[N](b.AggregationLimit) + lv := newLastValue[N](b.AggregationLimit, b.resFunc()) return b.filter(lv.measure), func(dest *metricdata.Aggregation) int { // Ignore if dest is not a metricdata.Gauge. The chance for memory @@ -87,7 +106,7 @@ func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // PrecomputedSum returns a sum aggregate function input and output. The // arguments passed to the input are expected to be the precomputed sum values. func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newPrecomputedSum[N](monotonic, b.AggregationLimit) + s := newPrecomputedSum[N](monotonic, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -98,7 +117,7 @@ func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregati // Sum returns a sum aggregate function input and output. func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newSum[N](monotonic, b.AggregationLimit) + s := newSum[N](monotonic, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -110,7 +129,7 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newHistogram[N](boundaries, noMinMax, noSum, b.AggregationLimit) + h := newHistogram[N](boundaries, noMinMax, noSum, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta @@ -122,7 +141,7 @@ func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSu // ExponentialBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExponentialBucketHistogram(maxSize, maxScale int32, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum, b.AggregationLimit) + h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go index e9c25980..660b8607 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -40,6 +41,8 @@ const ( // expoHistogramDataPoint is a single data point in an exponential histogram. type expoHistogramDataPoint[N int64 | float64] struct { + res exemplar.Reservoir[N] + count uint64 min N max N @@ -288,13 +291,14 @@ func (b *expoBuckets) downscale(delta int) { // newExponentialHistogram returns an Aggregator that summarizes a set of // measurements as an exponential histogram. Each histogram is scoped by attributes // and the aggregation cycle the measurements were made in. -func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int) *expoHistogram[N] { +func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int, r func() exemplar.Reservoir[N]) *expoHistogram[N] { return &expoHistogram[N]{ noSum: noSum, noMinMax: noMinMax, maxSize: int(maxSize), maxScale: int(maxScale), + newRes: r, limit: newLimiter[*expoHistogramDataPoint[N]](limit), values: make(map[attribute.Set]*expoHistogramDataPoint[N]), @@ -310,6 +314,7 @@ type expoHistogram[N int64 | float64] struct { maxSize int maxScale int + newRes func() exemplar.Reservoir[N] limit limiter[*expoHistogramDataPoint[N]] values map[attribute.Set]*expoHistogramDataPoint[N] valuesMu sync.Mutex @@ -317,22 +322,27 @@ type expoHistogram[N int64 | float64] struct { start time.Time } -func (e *expoHistogram[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (e *expoHistogram[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { // Ignore NaN and infinity. if math.IsInf(float64(value), 0) || math.IsNaN(float64(value)) { return } + t := now() + e.valuesMu.Lock() defer e.valuesMu.Unlock() - attr = e.limit.Attributes(attr, e.values) + attr := e.limit.Attributes(fltrAttr, e.values) v, ok := e.values[attr] if !ok { v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) + v.res = e.newRes() + e.values[attr] = v } v.record(value) + v.res.Offer(ctx, t, value, droppedAttr) } func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { @@ -374,6 +384,8 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + delete(e.values, a) i++ } @@ -422,6 +434,8 @@ func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + i++ // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go index 5d886360..a9a4706b 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go @@ -21,10 +21,13 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) type buckets[N int64 | float64] struct { + res exemplar.Reservoir[N] + counts []uint64 count uint64 total N @@ -54,12 +57,13 @@ type histValues[N int64 | float64] struct { noSum bool bounds []float64 + newRes func() exemplar.Reservoir[N] limit limiter[*buckets[N]] values map[attribute.Set]*buckets[N] valuesMu sync.Mutex } -func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) *histValues[N] { +func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int, r func() exemplar.Reservoir[N]) *histValues[N] { // The responsibility of keeping all buckets correctly associated with the // passed boundaries is ultimately this type's responsibility. Make a copy // here so we can always guarantee this. Or, in the case of failure, have @@ -70,6 +74,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) * return &histValues[N]{ noSum: noSum, bounds: b, + newRes: r, limit: newLimiter[*buckets[N]](limit), values: make(map[attribute.Set]*buckets[N]), } @@ -77,7 +82,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) * // Aggregate records the measurement value, scoped by attr, and aggregates it // into a histogram. -func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (s *histValues[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { // This search will return an index in the range [0, len(s.bounds)], where // it will return len(s.bounds) if value is greater than the last element // of s.bounds. This aligns with the buckets in that the length of buckets @@ -85,10 +90,12 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // (s.bounds[len(s.bounds)-1], +∞). idx := sort.SearchFloat64s(s.bounds, float64(value)) + t := now() + s.valuesMu.Lock() defer s.valuesMu.Unlock() - attr = s.limit.Attributes(attr, s.values) + attr := s.limit.Attributes(fltrAttr, s.values) b, ok := s.values[attr] if !ok { // N+1 buckets. For example: @@ -99,6 +106,8 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // // buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞) b = newBuckets[N](len(s.bounds) + 1) + b.res = s.newRes() + // Ensure min and max are recorded values (not zero), for new buckets. b.min, b.max = value, value s.values[attr] = b @@ -107,13 +116,14 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) if !s.noSum { b.sum(value) } + b.res.Offer(ctx, t, value, droppedAttr) } // newHistogram returns an Aggregator that summarizes a set of measurements as // an histogram. -func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int) *histogram[N] { +func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int, r func() exemplar.Reservoir[N]) *histogram[N] { return &histogram[N]{ - histValues: newHistValues[N](boundaries, noSum, limit), + histValues: newHistValues[N](boundaries, noSum, limit, r), noMinMax: noMinMax, start: now(), } @@ -164,6 +174,8 @@ func (s *histogram[N]) delta(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + // Unused attribute sets do not report. delete(s.values, a) i++ @@ -220,6 +232,9 @@ func (s *histogram[N]) cumulative(dest *metricdata.Aggregation) int { hDPts[i].Min = metricdata.NewExtrema(b.min) hDPts[i].Max = metricdata.NewExtrema(b.max) } + + b.res.Collect(&hDPts[i].Exemplars) + i++ // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go index b79e80a0..5699e728 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go @@ -20,6 +20,7 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -27,10 +28,12 @@ import ( type datapoint[N int64 | float64] struct { timestamp time.Time value N + res exemplar.Reservoir[N] } -func newLastValue[N int64 | float64](limit int) *lastValue[N] { +func newLastValue[N int64 | float64](limit int, r func() exemplar.Reservoir[N]) *lastValue[N] { return &lastValue[N]{ + newRes: r, limit: newLimiter[datapoint[N]](limit), values: make(map[attribute.Set]datapoint[N]), } @@ -40,16 +43,28 @@ func newLastValue[N int64 | float64](limit int) *lastValue[N] { type lastValue[N int64 | float64] struct { sync.Mutex + newRes func() exemplar.Reservoir[N] limit limiter[datapoint[N]] values map[attribute.Set]datapoint[N] } -func (s *lastValue[N]) measure(ctx context.Context, value N, attr attribute.Set) { - d := datapoint[N]{timestamp: now(), value: value} +func (s *lastValue[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { + t := now() + s.Lock() - attr = s.limit.Attributes(attr, s.values) + defer s.Unlock() + + attr := s.limit.Attributes(fltrAttr, s.values) + d, ok := s.values[attr] + if !ok { + d.res = s.newRes() + } + + d.timestamp = t + d.value = value + d.res.Offer(ctx, t, value, droppedAttr) + s.values[attr] = d - s.Unlock() } func (s *lastValue[N]) computeAggregation(dest *[]metricdata.DataPoint[N]) { @@ -66,6 +81,7 @@ func (s *lastValue[N]) computeAggregation(dest *[]metricdata.DataPoint[N]) { // ignored. (*dest)[i].Time = v.timestamp (*dest)[i].Value = v.value + v.res.Collect(&(*dest)[i].Exemplars) // Do not report stale values. delete(s.values, a) i++ diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go index a0d26e1d..02de2483 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go @@ -20,36 +20,55 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +type sumValue[N int64 | float64] struct { + n N + res exemplar.Reservoir[N] +} + // valueMap is the storage for sums. type valueMap[N int64 | float64] struct { sync.Mutex - limit limiter[N] - values map[attribute.Set]N + newRes func() exemplar.Reservoir[N] + limit limiter[sumValue[N]] + values map[attribute.Set]sumValue[N] } -func newValueMap[N int64 | float64](limit int) *valueMap[N] { +func newValueMap[N int64 | float64](limit int, r func() exemplar.Reservoir[N]) *valueMap[N] { return &valueMap[N]{ - limit: newLimiter[N](limit), - values: make(map[attribute.Set]N), + newRes: r, + limit: newLimiter[sumValue[N]](limit), + values: make(map[attribute.Set]sumValue[N]), } } -func (s *valueMap[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (s *valueMap[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { + t := now() + s.Lock() - attr = s.limit.Attributes(attr, s.values) - s.values[attr] += value - s.Unlock() + defer s.Unlock() + + attr := s.limit.Attributes(fltrAttr, s.values) + v, ok := s.values[attr] + if !ok { + v.res = s.newRes() + } + + v.n += value + v.res.Offer(ctx, t, value, droppedAttr) + + s.values[attr] = v } // newSum returns an aggregator that summarizes a set of measurements as their // arithmetic sum. Each sum is scoped by attributes and the aggregation cycle // the measurements were made in. -func newSum[N int64 | float64](monotonic bool, limit int) *sum[N] { +func newSum[N int64 | float64](monotonic bool, limit int, r func() exemplar.Reservoir[N]) *sum[N] { return &sum[N]{ - valueMap: newValueMap[N](limit), + valueMap: newValueMap[N](limit, r), monotonic: monotonic, start: now(), } @@ -79,11 +98,12 @@ func (s *sum[N]) delta(dest *metricdata.Aggregation) int { dPts := reset(sData.DataPoints, n, n) var i int - for attr, value := range s.values { + for attr, val := range s.values { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = val.n + val.res.Collect(&dPts[i].Exemplars) // Do not report stale values. delete(s.values, attr) i++ @@ -117,7 +137,8 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = value.n + value.res.Collect(&dPts[i].Exemplars) // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute // sets that become "stale" need to be forgotten so this will not @@ -134,9 +155,9 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { // newPrecomputedSum returns an aggregator that summarizes a set of // observatrions as their arithmetic sum. Each sum is scoped by attributes and // the aggregation cycle the measurements were made in. -func newPrecomputedSum[N int64 | float64](monotonic bool, limit int) *precomputedSum[N] { +func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func() exemplar.Reservoir[N]) *precomputedSum[N] { return &precomputedSum[N]{ - valueMap: newValueMap[N](limit), + valueMap: newValueMap[N](limit, r), monotonic: monotonic, start: now(), } @@ -170,14 +191,15 @@ func (s *precomputedSum[N]) delta(dest *metricdata.Aggregation) int { var i int for attr, value := range s.values { - delta := value - s.reported[attr] + delta := value.n - s.reported[attr] dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t dPts[i].Value = delta + value.res.Collect(&dPts[i].Exemplars) - newReported[attr] = value + newReported[attr] = value.n // Unused attribute sets do not report. delete(s.values, attr) i++ @@ -209,11 +231,12 @@ func (s *precomputedSum[N]) cumulative(dest *metricdata.Aggregation) int { dPts := reset(sData.DataPoints, n, n) var i int - for attr, value := range s.values { + for attr, val := range s.values { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = val.n + val.res.Collect(&dPts[i].Exemplars) // Unused attribute sets do not report. delete(s.values, attr) diff --git a/vendor/go.opencensus.io/metric/metricexport/doc.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/doc.go similarity index 67% rename from vendor/go.opencensus.io/metric/metricexport/doc.go rename to vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/doc.go index df632a79..3caeb542 100644 --- a/vendor/go.opencensus.io/metric/metricexport/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/doc.go @@ -1,4 +1,4 @@ -// Copyright 2018, OpenCensus Authors +// 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. @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package metricexport contains support for exporting metric data. -// -// This is an EXPERIMENTAL package, and may change in arbitrary ways without -// notice. -package metricexport // import "go.opencensus.io/metric/metricexport" +// Package exemplar provides an implementation of the OpenTelemetry exemplar +// reservoir to be used in metric collection pipelines. +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/drop.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/drop.go new file mode 100644 index 00000000..39bf37b9 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/drop.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. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Drop returns a [Reservoir] that drops all measurements it is offered. +func Drop[N int64 | float64]() Reservoir[N] { return &dropRes[N]{} } + +type dropRes[N int64 | float64] struct{} + +// Offer does nothing, all measurements offered will be dropped. +func (r *dropRes[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) {} + +// Collect resets dest. No exemplars will ever be returned. +func (r *dropRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { + *dest = (*dest)[:0] +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/filter.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/filter.go new file mode 100644 index 00000000..4f5946fb --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/filter.go @@ -0,0 +1,40 @@ +// 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 exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" +) + +// SampledFilter returns a [Reservoir] wrapping r that will only offer measurements +// to r if the passed context associated with the measurement contains a sampled +// [go.opentelemetry.io/otel/trace.SpanContext]. +func SampledFilter[N int64 | float64](r Reservoir[N]) Reservoir[N] { + return filtered[N]{Reservoir: r} +} + +type filtered[N int64 | float64] struct { + Reservoir[N] +} + +func (f filtered[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + if trace.SpanContextFromContext(ctx).IsSampled() { + f.Reservoir.Offer(ctx, t, n, a) + } +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/hist.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/hist.go new file mode 100644 index 00000000..6f4fe552 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/hist.go @@ -0,0 +1,47 @@ +// 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 exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "sort" + "time" + + "go.opentelemetry.io/otel/attribute" +) + +// Histogram returns a [Reservoir] that samples the last measurement that falls +// within a histogram bucket. The histogram bucket upper-boundaries are define +// by bounds. +// +// The passed bounds will be sorted by this function. +func Histogram[N int64 | float64](bounds []float64) Reservoir[N] { + sort.Float64s(bounds) + return &histRes[N]{ + bounds: bounds, + storage: newStorage[N](len(bounds) + 1), + } +} + +type histRes[N int64 | float64] struct { + *storage[N] + + // bounds are bucket bounds in ascending order. + bounds []float64 +} + +func (r *histRes[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + r.store[sort.SearchFloat64s(r.bounds, float64(n))] = newMeasurement(ctx, t, n, a) +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/rand.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/rand.go new file mode 100644 index 00000000..7f9fda5b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/rand.go @@ -0,0 +1,195 @@ +// 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 exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "math" + "math/rand" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// rng is used to make sampling decisions. +// +// Do not use crypto/rand. There is no reason for the decrease in performance +// given this is not a security sensitive decision. +var rng = rand.New(rand.NewSource(time.Now().UnixNano())) + +// random returns, as a float64, a uniform pseudo-random number in the open +// interval (0.0,1.0). +func random() float64 { + // TODO: This does not return a uniform number. rng.Float64 returns a + // uniformly random int in [0,2^53) that is divided by 2^53. Meaning it + // returns multiples of 2^-53, and not all floating point numbers between 0 + // and 1 (i.e. for values less than 2^-4 the 4 last bits of the significand + // are always going to be 0). + // + // An alternative algorithm should be considered that will actually return + // a uniform number in the interval (0,1). For example, since the default + // rand source provides a uniform distribution for Int63, this can be + // converted following the prototypical code of Mersenne Twister 64 (Takuji + // Nishimura and Makoto Matsumoto: + // http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/VERSIONS/C-LANG/mt19937-64.c) + // + // (float64(rng.Int63()>>11) + 0.5) * (1.0 / 4503599627370496.0) + // + // There are likely many other methods to explore here as well. + + f := rng.Float64() + for f == 0 { + f = rng.Float64() + } + return f +} + +// FixedSize returns a [Reservoir] that samples at most k exemplars. If there +// are k or less measurements made, the Reservoir will sample each one. If +// there are more than k, the Reservoir will then randomly sample all +// additional measurement with a decreasing probability. +func FixedSize[N int64 | float64](k int) Reservoir[N] { + r := &randRes[N]{storage: newStorage[N](k)} + r.reset() + return r +} + +type randRes[N int64 | float64] struct { + *storage[N] + + // count is the number of measurement seen. + count int64 + // next is the next count that will store a measurement at a random index + // once the reservoir has been filled. + next int64 + // w is the largest random number in a distribution that is used to compute + // the next next. + w float64 +} + +func (r *randRes[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + // The following algorithm is "Algorithm L" from Li, Kim-Hung (4 December + // 1994). "Reservoir-Sampling Algorithms of Time Complexity + // O(n(1+log(N/n)))". ACM Transactions on Mathematical Software. 20 (4): + // 481–493 (https://dl.acm.org/doi/10.1145/198429.198435). + // + // A high-level overview of "Algorithm L": + // 0) Pre-calculate the random count greater than the storage size when + // an exemplar will be replaced. + // 1) Accept all measurements offered until the configured storage size is + // reached. + // 2) Loop: + // a) When the pre-calculate count is reached, replace a random + // existing exemplar with the offered measurement. + // b) Calculate the next random count greater than the existing one + // which will replace another exemplars + // + // The way a "replacement" count is computed is by looking at `n` number of + // independent random numbers each corresponding to an offered measurement. + // Of these numbers the smallest `k` (the same size as the storage + // capacity) of them are kept as a subset. The maximum value in this + // subset, called `w` is used to weight another random number generation + // for the next count that will be considered. + // + // By weighting the next count computation like described, it is able to + // perform a uniformly-weighted sampling algorithm based on the number of + // samples the reservoir has seen so far. The sampling will "slow down" as + // more and more samples are offered so as to reduce a bias towards those + // offered just prior to the end of the collection. + // + // This algorithm is preferred because of its balance of simplicity and + // performance. It will compute three random numbers (the bulk of + // computation time) for each item that becomes part of the reservoir, but + // it does not spend any time on items that do not. In particular it has an + // asymptotic runtime of O(k(1 + log(n/k)) where n is the number of + // measurements offered and k is the reservoir size. + // + // See https://en.wikipedia.org/wiki/Reservoir_sampling for an overview of + // this and other reservoir sampling algorithms. See + // https://github.com/MrAlias/reservoir-sampling for a performance + // comparison of reservoir sampling algorithms. + + if int(r.count) < cap(r.store) { + r.store[r.count] = newMeasurement(ctx, t, n, a) + } else { + if r.count == r.next { + // Overwrite a random existing measurement with the one offered. + idx := int(rng.Int63n(int64(cap(r.store)))) + r.store[idx] = newMeasurement(ctx, t, n, a) + r.advance() + } + } + r.count++ +} + +// reset resets r to the initial state. +func (r *randRes[N]) reset() { + // This resets the number of exemplars known. + r.count = 0 + // Random index inserts should only happen after the storage is full. + r.next = int64(cap(r.store)) + + // Initial random number in the series used to generate r.next. + // + // This is set before r.advance to reset or initialize the random number + // series. Without doing so it would always be 0 or never restart a new + // random number series. + // + // This maps the uniform random number in (0,1) to a geometric distribution + // over the same interval. The mean of the distribution is inversely + // proportional to the storage capacity. + r.w = math.Exp(math.Log(random()) / float64(cap(r.store))) + + r.advance() +} + +// advance updates the count at which the offered measurement will overwrite an +// existing exemplar. +func (r *randRes[N]) advance() { + // Calculate the next value in the random number series. + // + // The current value of r.w is based on the max of a distribution of random + // numbers (i.e. `w = max(u_1,u_2,...,u_k)` for `k` equal to the capacity + // of the storage and each `u` in the interval (0,w)). To calculate the + // next r.w we use the fact that when the next exemplar is selected to be + // included in the storage an existing one will be dropped, and the + // corresponding random number in the set used to calculate r.w will also + // be replaced. The replacement random number will also be within (0,w), + // therefore the next r.w will be based on the same distribution (i.e. + // `max(u_1,u_2,...,u_k)`). Therefore, we can sample the next r.w by + // computing the next random number `u` and take r.w as `w * u^(1/k)`. + r.w *= math.Exp(math.Log(random()) / float64(cap(r.store))) + // Use the new random number in the series to calculate the count of the + // next measurement that will be stored. + // + // Given 0 < r.w < 1, each iteration will result in subsequent r.w being + // smaller. This translates here into the next next being selected against + // a distribution with a higher mean (i.e. the expected value will increase + // and replacements become less likely) + // + // Important to note, the new r.next will always be at least 1 more than + // the last r.next. + r.next += int64(math.Log(random())/math.Log(1-r.w)) + 1 +} + +func (r *randRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { + r.storage.Collect(dest) + // Call reset here even though it will reset r.count and restart the random + // number series. This will persist any old exemplars as long as no new + // measurements are offered, but it will also prioritize those new + // measurements that are made over the older collection cycle ones. + r.reset() +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/reservoir.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/reservoir.go new file mode 100644 index 00000000..7d5276a3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/reservoir.go @@ -0,0 +1,44 @@ +// 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 exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Reservoir holds the sampled exemplar of measurements made. +type Reservoir[N int64 | float64] interface { + // Offer accepts the parameters associated with a measurement. The + // parameters will be stored as an exemplar if the Reservoir decides to + // sample the measurement. + // + // The passed ctx needs to contain any baggage or span that were active + // when the measurement was made. This information may be used by the + // Reservoir in making a sampling decision. + // + // The time t is the time when the measurement was made. The val and attr + // parameters are the value and dropped (filtered) attributes of the + // measurement respectively. + Offer(ctx context.Context, t time.Time, val N, attr []attribute.KeyValue) + + // Collect returns all the held exemplars. + // + // The Reservoir state is preserved after this call. + Collect(dest *[]metricdata.Exemplar[N]) +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/storage.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/storage.go new file mode 100644 index 00000000..e2c2b90a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/storage.go @@ -0,0 +1,107 @@ +// 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 exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/trace" +) + +// storage is an exemplar storage for [Reservoir] implementations. +type storage[N int64 | float64] struct { + // store are the measurements sampled. + // + // This does not use []metricdata.Exemplar because it potentially would + // require an allocation for trace and span IDs in the hot path of Offer. + store []measurement[N] +} + +func newStorage[N int64 | float64](n int) *storage[N] { + return &storage[N]{store: make([]measurement[N], n)} +} + +// Collect returns all the held exemplars. +// +// The Reservoir state is preserved after this call. +func (r *storage[N]) Collect(dest *[]metricdata.Exemplar[N]) { + *dest = reset(*dest, len(r.store), len(r.store)) + var n int + for _, m := range r.store { + if !m.valid { + continue + } + + m.Exemplar(&(*dest)[n]) + n++ + } + *dest = (*dest)[:n] +} + +// measurement is a measurement made by a telemetry system. +type measurement[N int64 | float64] struct { + // FilteredAttributes are the attributes dropped during the measurement. + FilteredAttributes []attribute.KeyValue + // Time is the time when the measurement was made. + Time time.Time + // Value is the value of the measurement. + Value N + // SpanContext is the SpanContext active when a measurement was made. + SpanContext trace.SpanContext + + valid bool +} + +// newMeasurement returns a new non-empty Measurement. +func newMeasurement[N int64 | float64](ctx context.Context, ts time.Time, v N, droppedAttr []attribute.KeyValue) measurement[N] { + return measurement[N]{ + FilteredAttributes: droppedAttr, + Time: ts, + Value: v, + SpanContext: trace.SpanContextFromContext(ctx), + valid: true, + } +} + +// Exemplar returns m as a [metricdata.Exemplar]. +func (m measurement[N]) Exemplar(dest *metricdata.Exemplar[N]) { + dest.FilteredAttributes = m.FilteredAttributes + dest.Time = m.Time + dest.Value = m.Value + + if m.SpanContext.HasTraceID() { + traceID := m.SpanContext.TraceID() + dest.TraceID = traceID[:] + } else { + dest.TraceID = dest.TraceID[:0] + } + + if m.SpanContext.HasSpanID() { + spanID := m.SpanContext.SpanID() + dest.SpanID = spanID[:] + } else { + dest.SpanID = dest.SpanID[:0] + } +} + +func reset[T any](s []T, length, capacity int) []T { + if cap(s) < capacity { + return make([]T, length, capacity) + } + return s[:length] +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go b/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go index 76f1e70a..88710563 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go @@ -41,6 +41,11 @@ type meter struct { scope instrumentation.Scope pipes pipelines + int64Insts *cacheWithErr[instID, *int64Inst] + float64Insts *cacheWithErr[instID, *float64Inst] + int64ObservableInsts *cacheWithErr[instID, int64Observable] + float64ObservableInsts *cacheWithErr[instID, float64Observable] + int64Resolver resolver[int64] float64Resolver resolver[float64] } @@ -50,11 +55,20 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { // meter is asked to create are logged to the user. var viewCache cache[string, instID] + var int64Insts cacheWithErr[instID, *int64Inst] + var float64Insts cacheWithErr[instID, *float64Inst] + var int64ObservableInsts cacheWithErr[instID, int64Observable] + var float64ObservableInsts cacheWithErr[instID, float64Observable] + return &meter{ - scope: s, - pipes: p, - int64Resolver: newResolver[int64](p, &viewCache), - float64Resolver: newResolver[float64](p, &viewCache), + scope: s, + pipes: p, + int64Insts: &int64Insts, + float64Insts: &float64Insts, + int64ObservableInsts: &int64ObservableInsts, + float64ObservableInsts: &float64ObservableInsts, + int64Resolver: newResolver[int64](p, &viewCache), + float64Resolver: newResolver[float64](p, &viewCache), } } @@ -108,32 +122,48 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti // int64ObservableInstrument returns a new observable identified by the Instrument. // It registers callbacks for each reader's pipeline. func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int64Callback) (int64Observable, error) { - inst := newInt64Observable(m, id.Kind, id.Name, id.Description, id.Unit) - for _, insert := range m.int64Resolver.inserters { - // Connect the measure functions for instruments in this pipeline with the - // callbacks for this pipeline. - in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) - if err != nil { - return inst, err - } - // Drop aggregation - if len(in) == 0 { - inst.dropAggregation = true - continue - } - inst.appendMeasures(in) - for _, cback := range callbacks { - inst := int64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + key := instID{ + Name: id.Name, + Description: id.Description, + Unit: id.Unit, + Kind: id.Kind, + } + if m.int64ObservableInsts.HasKey(key) && len(callbacks) > 0 { + warnRepeatedObservableCallbacks(id) + } + return m.int64ObservableInsts.Lookup(key, func() (int64Observable, error) { + inst := newInt64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.int64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + inst.dropAggregation = true + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := int64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } } - } - return inst, validateInstrumentName(id.Name) + return inst, validateInstrumentName(id.Name) + }) } // 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. // Only the measurements recorded during the collection cycle are exported. +// +// If Int64ObservableCounter is invoked repeatedly with the same Name, +// Description, and Unit, only the first set of callbacks provided are used. +// Use meter.RegisterCallback and Registration.Unregister to manage callbacks +// if instrumentation can be created multiple times with different callbacks. func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { cfg := metric.NewInt64ObservableCounterConfig(options...) id := Instrument{ @@ -225,32 +255,48 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram // float64ObservableInstrument returns a new observable identified by the Instrument. // It registers callbacks for each reader's pipeline. func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Float64Callback) (float64Observable, error) { - inst := newFloat64Observable(m, id.Kind, id.Name, id.Description, id.Unit) - for _, insert := range m.float64Resolver.inserters { - // Connect the measure functions for instruments in this pipeline with the - // callbacks for this pipeline. - in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) - if err != nil { - return inst, err - } - // Drop aggregation - if len(in) == 0 { - inst.dropAggregation = true - continue - } - inst.appendMeasures(in) - for _, cback := range callbacks { - inst := float64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + key := instID{ + Name: id.Name, + Description: id.Description, + Unit: id.Unit, + Kind: id.Kind, + } + if m.int64ObservableInsts.HasKey(key) && len(callbacks) > 0 { + warnRepeatedObservableCallbacks(id) + } + return m.float64ObservableInsts.Lookup(key, func() (float64Observable, error) { + inst := newFloat64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.float64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + inst.dropAggregation = true + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := float64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } } - } - return inst, validateInstrumentName(id.Name) + return inst, validateInstrumentName(id.Name) + }) } // 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. // Only the measurements recorded during the collection cycle are exported. +// +// If Float64ObservableCounter is invoked repeatedly with the same Name, +// Description, and Unit, only the first set of callbacks provided are used. +// Use meter.RegisterCallback and Registration.Unregister to manage callbacks +// if instrumentation can be created multiple times with different callbacks. func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { cfg := metric.NewFloat64ObservableCounterConfig(options...) id := Instrument{ @@ -324,6 +370,16 @@ func isAlphanumeric(c rune) bool { return isAlpha(c) || ('0' <= c && c <= '9') } +func warnRepeatedObservableCallbacks(id Instrument) { + inst := fmt.Sprintf( + "Instrument{Name: %q, Description: %q, Kind: %q, Unit: %q}", + id.Name, id.Description, "InstrumentKind"+id.Kind.String(), id.Unit, + ) + global.Warn("Repeated observable instrument creation with callbacks. Ignoring new callbacks. Use meter.RegisterCallback and Registration.Unregister to manage callbacks.", + "instrument", inst, + ) +} + // RegisterCallback registers f to be called each collection cycle so it will // make observations for insts during those cycles. // @@ -529,14 +585,28 @@ func (p int64InstProvider) histogramAggs(name string, cfg metric.Int64HistogramC // lookup returns the resolved instrumentImpl. func (p int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { - aggs, err := p.aggs(kind, name, desc, u) - return &int64Inst{measures: aggs}, err + return p.meter.int64Insts.Lookup(instID{ + Name: name, + Description: desc, + Unit: u, + Kind: kind, + }, func() (*int64Inst, error) { + aggs, err := p.aggs(kind, name, desc, u) + return &int64Inst{measures: aggs}, err + }) } // lookupHistogram returns the resolved instrumentImpl. func (p int64InstProvider) lookupHistogram(name string, cfg metric.Int64HistogramConfig) (*int64Inst, error) { - aggs, err := p.histogramAggs(name, cfg) - return &int64Inst{measures: aggs}, err + return p.meter.int64Insts.Lookup(instID{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + }, func() (*int64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &int64Inst{measures: aggs}, err + }) } // float64InstProvider provides float64 OpenTelemetry instruments. @@ -573,14 +643,28 @@ func (p float64InstProvider) histogramAggs(name string, cfg metric.Float64Histog // lookup returns the resolved instrumentImpl. func (p float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { - aggs, err := p.aggs(kind, name, desc, u) - return &float64Inst{measures: aggs}, err + return p.meter.float64Insts.Lookup(instID{ + Name: name, + Description: desc, + Unit: u, + Kind: kind, + }, func() (*float64Inst, error) { + aggs, err := p.aggs(kind, name, desc, u) + return &float64Inst{measures: aggs}, err + }) } // lookupHistogram returns the resolved instrumentImpl. func (p float64InstProvider) lookupHistogram(name string, cfg metric.Float64HistogramConfig) (*float64Inst, error) { - aggs, err := p.histogramAggs(name, cfg) - return &float64Inst{measures: aggs}, err + return p.meter.float64Insts.Lookup(instID{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + }, func() (*float64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &float64Inst{measures: aggs}, err + }) } type int64Observer struct { diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go b/vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go index 995d42b3..32c17934 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go @@ -15,6 +15,7 @@ package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" import ( + "encoding/json" "time" "go.opentelemetry.io/otel/attribute" @@ -211,6 +212,19 @@ type Extrema[N int64 | float64] struct { valid bool } +// MarshalText converts the Extrema value to text. +func (e Extrema[N]) MarshalText() ([]byte, error) { + if !e.valid { + return json.Marshal(nil) + } + return json.Marshal(e.value) +} + +// MarshalJSON converts the Extrema value to JSON number. +func (e *Extrema[N]) MarshalJSON() ([]byte, error) { + return e.MarshalText() +} + // NewExtrema returns an Extrema set to v. func NewExtrema[N int64 | float64](v N) Extrema[N] { return Extrema[N]{value: v, valid: true} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go b/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go index 47d9fe07..da39ab96 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go @@ -359,7 +359,8 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum normID := id.normalize() cv := i.aggregators.Lookup(normID, func() aggVal[N] { b := aggregate.Builder[N]{ - Temporality: i.pipeline.reader.temporality(kind), + Temporality: i.pipeline.reader.temporality(kind), + ReservoirFunc: reservoirFunc[N](stream.Aggregation), } b.Filter = stream.AttributeFilter // A value less than or equal to zero will disable the aggregation diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go index d30a7d1c..4f916d71 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.22.0" + return "1.23.0" } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go index 4279013b..aed756c5 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go @@ -41,8 +41,20 @@ type Detector interface { // must never be done outside of a new major release. } -// Detect calls all input detectors sequentially and merges each result with the previous one. -// It returns the merged error too. +// Detect returns a new [Resource] merged from all the Resources each of the +// detectors produces. Each of the detectors are called sequentially, in the +// order they are passed, merging the produced resource into the previous. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if that error is returned from a detector. It may also +// return a merge-conflicting Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from different detectors results +// in a schema URL conflict. It is up to the caller to determine if this +// returned Resource should be used or not. +// +// If one of the detectors returns an error that is not [ErrPartialResource], +// the resource produced by the detector will not be merged and the returned +// error will wrap that detector's error. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { r := new(Resource) return r, detect(ctx, r, detectors) @@ -50,6 +62,10 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { // detect runs all detectors using ctx and merges the result into res. This // assumes res is allocated and not nil, it will panic otherwise. +// +// If the detectors or merging resources produces any errors (i.e. +// [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of +// these errors will be returned. Otherwise, nil is returned. func detect(ctx context.Context, res *Resource, detectors []Detector) error { var ( r *Resource @@ -78,6 +94,11 @@ func detect(ctx context.Context, res *Resource, detectors []Detector) error { if len(errs) == 0 { return nil } + if errors.Is(errs, ErrSchemaURLConflict) { + // If there has been a merge conflict, ensure the resource has no + // schema URL. + res.schemaURL = "" + } return errs } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go index c881b289..c1b47193 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go @@ -29,7 +29,7 @@ type containerIDProvider func() (string, error) var ( containerID containerIDProvider = getContainerIDFromCGroup - cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`) + cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`) ) type cgroupContainerIDDetector struct{} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go index 176ff106..cb1ee0a9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go @@ -17,6 +17,7 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" + "fmt" "sync" "go.opentelemetry.io/otel" @@ -40,9 +41,20 @@ var ( defaultResourceOnce sync.Once ) -var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflicting Schema URL") +// ErrSchemaURLConflict is an error returned when two Resources are merged +// together that contain different, non-empty, schema URLs. +var ErrSchemaURLConflict = errors.New("conflicting Schema URL") -// New returns a Resource combined from the user-provided detectors. +// New returns a [Resource] built using opts. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if options that provide a [Detector] are used and that +// error is returned from one or more of the Detectors. It may also return a +// merge-conflict Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from the opts results in a +// schema URL conflict (see [Resource.Merge] for more information). It is up to +// the caller to determine if this returned Resource should be used or not +// based on these errors. func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg := config{} for _, opt := range opts { @@ -98,7 +110,7 @@ func (r *Resource) String() string { return r.attrs.Encoded(attribute.DefaultEncoder()) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Resource. func (r *Resource) MarshalLog() interface{} { return struct { Attributes attribute.Set @@ -146,16 +158,29 @@ func (r *Resource) Equal(eq *Resource) bool { return r.Equivalent() == eq.Equivalent() } -// Merge creates a new resource by combining resource a and b. +// Merge creates a new [Resource] by merging a and b. +// +// If there are common keys between a and b, then the value from b will +// overwrite the value from a, even if b's value is empty. // -// If there are common keys between resource a and b, then the value -// from resource b will overwrite the value from resource a, even -// if resource b's value is empty. +// The SchemaURL of the resources will be merged according to the +// [OpenTelemetry specification rules]: // -// The SchemaURL of the resources will be merged according to the spec rules: -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge -// If the resources have different non-empty schemaURL an empty resource and an error -// will be returned. +// - If a's schema URL is empty then the returned Resource's schema URL will +// be set to the schema URL of b, +// - Else if b's schema URL is empty then the returned Resource's schema URL +// will be set to the schema URL of a, +// - Else if the schema URLs of a and b are the same then that will be the +// schema URL of the returned Resource, +// - Else this is a merging error. If the resources have different, +// non-empty, schema URLs an error containing [ErrSchemaURLConflict] will +// be returned with the merged Resource. The merged Resource will have an +// empty schema URL. It may be the case that some unintended attributes +// have been overwritten or old semantic conventions persisted in the +// returned Resource. It is up to the caller to determine if this returned +// Resource should be used or not. +// +// [OpenTelemetry specification rules]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge func Merge(a, b *Resource) (*Resource, error) { if a == nil && b == nil { return Empty(), nil @@ -167,19 +192,6 @@ func Merge(a, b *Resource) (*Resource, error) { return a, nil } - // Merge the schema URL. - var schemaURL string - switch true { - case a.schemaURL == "": - schemaURL = b.schemaURL - case b.schemaURL == "": - schemaURL = a.schemaURL - case a.schemaURL == b.schemaURL: - schemaURL = a.schemaURL - default: - return Empty(), errMergeConflictSchemaURL - } - // Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key() // Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...) mi := attribute.NewMergeIterator(b.Set(), a.Set()) @@ -187,8 +199,23 @@ func Merge(a, b *Resource) (*Resource, error) { for mi.Next() { combine = append(combine, mi.Attribute()) } - merged := NewWithAttributes(schemaURL, combine...) - return merged, nil + + switch { + case a.schemaURL == "": + return NewWithAttributes(b.schemaURL, combine...), nil + case b.schemaURL == "": + return NewWithAttributes(a.schemaURL, combine...), nil + case a.schemaURL == b.schemaURL: + return NewWithAttributes(a.schemaURL, combine...), nil + } + // Return the merged resource with an appropriate error. It is up to + // the user to decide if the returned resource can be used or not. + return NewSchemaless(combine...), fmt.Errorf( + "%w: %s and %s", + ErrSchemaURLConflict, + a.schemaURL, + b.schemaURL, + ) } // Empty returns an instance of Resource with no attributes. It is 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 c9c7effb..fca26f2e 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 @@ -406,7 +406,7 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) return false } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (bsp *batchSpanProcessor) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go index 7d46c4b4..b1ac6084 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go @@ -55,7 +55,7 @@ type tracerProviderConfig struct { resource *resource.Resource } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Provider. func (cfg tracerProviderConfig) MarshalLog() interface{} { return struct { SpanProcessors []SpanProcessor diff --git a/vendor/go.opentelemetry.io/otel/sdk/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go index 17b16cc7..c340d269 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.22.0" + return "1.23.0" } diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index c7aba1c3..38ba951e 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.22.0" + return "1.23.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index a9cfb80a..028393f0 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -14,19 +14,25 @@ module-sets: stable-v1: - version: v1.22.0 + version: v1.23.0 modules: - go.opentelemetry.io/otel + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/dice - go.opentelemetry.io/otel/example/namedtracer + - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - 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/stdout/stdoutmetric - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - go.opentelemetry.io/otel/exporters/zipkin - go.opentelemetry.io/otel/metric @@ -34,16 +40,10 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.45.0 + version: v0.45.1 modules: - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric experimental-schema: version: v0.0.7 modules: diff --git a/vendor/go.opentelemetry.io/proto/otlp/metrics/v1/metrics.pb.go b/vendor/go.opentelemetry.io/proto/otlp/metrics/v1/metrics.pb.go index dfa59a67..1ef2656e 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/metrics/v1/metrics.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/metrics/v1/metrics.pb.go @@ -279,6 +279,9 @@ type ResourceMetrics struct { Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // A list of metrics that originate from a resource. ScopeMetrics []*ScopeMetrics `protobuf:"bytes,2,rep,name=scope_metrics,json=scopeMetrics,proto3" json:"scope_metrics,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_metrics" field which have their own schema_url field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` @@ -349,6 +352,9 @@ type ScopeMetrics struct { Scope *v11.InstrumentationScope `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` // A list of metrics that originate from an instrumentation library. Metrics []*Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the metric data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all metrics in the "metrics" field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` } @@ -496,7 +502,7 @@ type Metric struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // name of the metric, including its DNS name prefix. It must be unique. + // name of the metric. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // description of the metric, which can be used in documentation. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` diff --git a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go index 51a49981..71090883 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go @@ -36,6 +36,69 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// SpanFlags represents constants used to interpret the +// Span.flags field, which is protobuf 'fixed32' type and is to +// be used as bit-fields. Each non-zero value defined in this enum is +// a bit-mask. To extract the bit-field, for example, use an +// expression like: +// +// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) +// +// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. +// +// Note that Span flags were introduced in version 1.1 of the +// OpenTelemetry protocol. Older Span producers do not set this +// field, consequently consumers should not rely on the absence of a +// particular flag bit to indicate the presence of a particular feature. +type SpanFlags int32 + +const ( + // The zero value for the enum. Should not be used for comparisons. + // Instead use bitwise "and" with the appropriate mask as shown above. + SpanFlags_SPAN_FLAGS_DO_NOT_USE SpanFlags = 0 + // Bits 0-7 are used for trace flags. + SpanFlags_SPAN_FLAGS_TRACE_FLAGS_MASK SpanFlags = 255 +) + +// Enum value maps for SpanFlags. +var ( + SpanFlags_name = map[int32]string{ + 0: "SPAN_FLAGS_DO_NOT_USE", + 255: "SPAN_FLAGS_TRACE_FLAGS_MASK", + } + SpanFlags_value = map[string]int32{ + "SPAN_FLAGS_DO_NOT_USE": 0, + "SPAN_FLAGS_TRACE_FLAGS_MASK": 255, + } +) + +func (x SpanFlags) Enum() *SpanFlags { + p := new(SpanFlags) + *p = x + return p +} + +func (x SpanFlags) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpanFlags) Descriptor() protoreflect.EnumDescriptor { + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0].Descriptor() +} + +func (SpanFlags) Type() protoreflect.EnumType { + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0] +} + +func (x SpanFlags) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpanFlags.Descriptor instead. +func (SpanFlags) EnumDescriptor() ([]byte, []int) { + return file_opentelemetry_proto_trace_v1_trace_proto_rawDescGZIP(), []int{0} +} + // SpanKind is the type of span. Can be used to specify additional relationships between spans // in addition to a parent/child relationship. type Span_SpanKind int32 @@ -94,11 +157,11 @@ func (x Span_SpanKind) String() string { } func (Span_SpanKind) Descriptor() protoreflect.EnumDescriptor { - return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0].Descriptor() + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1].Descriptor() } func (Span_SpanKind) Type() protoreflect.EnumType { - return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0] + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1] } func (x Span_SpanKind) Number() protoreflect.EnumNumber { @@ -149,11 +212,11 @@ func (x Status_StatusCode) String() string { } func (Status_StatusCode) Descriptor() protoreflect.EnumDescriptor { - return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1].Descriptor() + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[2].Descriptor() } func (Status_StatusCode) Type() protoreflect.EnumType { - return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1] + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[2] } func (x Status_StatusCode) Number() protoreflect.EnumNumber { @@ -238,6 +301,9 @@ type ResourceSpans struct { Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // A list of ScopeSpans that originate from a resource. ScopeSpans []*ScopeSpans `protobuf:"bytes,2,rep,name=scope_spans,json=scopeSpans,proto3" json:"scope_spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_spans" field which have their own schema_url field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` @@ -308,6 +374,9 @@ type ScopeSpans struct { Scope *v11.InstrumentationScope `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` // A list of Spans that originate from an instrumentation scope. Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the span data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all spans and span events in the "spans" field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` } @@ -394,6 +463,21 @@ type Span struct { // The `span_id` of this span's parent span. If this is a root span, then this // field must be empty. The ID is an 8-byte array. ParentSpanId []byte `protobuf:"bytes,4,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` + // Flags, a bit field. 8 least significant bits are the trace + // flags as defined in W3C Trace Context specification. Readers + // MUST not assume that 24 most significant bits will be zero. + // To read the 8-bit W3C trace flag, use `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // When creating span messages, if the message is logically forwarded from another source + // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + // be copied as-is. If creating from a source that does not have an equivalent flags field + // (such as a runtime representation of an OpenTelemetry span), the high 24 bits MUST + // be set to zero. + // + // [Optional]. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + Flags uint32 `protobuf:"fixed32,16,opt,name=flags,proto3" json:"flags,omitempty"` // A description of the span's operation. // // For example, the name can be a qualified method name or a file name @@ -517,6 +601,13 @@ func (x *Span) GetParentSpanId() []byte { return nil } +func (x *Span) GetFlags() uint32 { + if x != nil { + return x.Flags + } + return 0 +} + func (x *Span) GetName() string { if x != nil { return x.Name @@ -757,6 +848,15 @@ type Span_Link struct { // dropped_attributes_count is the number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + // Flags, a bit field. 8 least significant bits are the trace + // flags as defined in W3C Trace Context specification. Readers + // MUST not assume that 24 most significant bits will be zero. + // When creating new spans, the most-significant 24-bits MUST be + // zero. To read the 8-bit W3C trace flag (use flags & + // SPAN_FLAGS_TRACE_FLAGS_MASK). [Optional]. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + Flags uint32 `protobuf:"fixed32,6,opt,name=flags,proto3" json:"flags,omitempty"` } func (x *Span_Link) Reset() { @@ -826,6 +926,13 @@ func (x *Span_Link) GetDroppedAttributesCount() uint32 { return 0 } +func (x *Span_Link) GetFlags() uint32 { + if x != nil { + return x.Flags + } + return 0 +} + var File_opentelemetry_proto_trace_v1_trace_proto protoreflect.FileDescriptor var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ @@ -869,7 +976,7 @@ var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x55, 0x72, 0x6c, 0x22, 0x9c, 0x0a, 0x0a, 0x04, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x19, 0x0a, + 0x61, 0x55, 0x72, 0x6c, 0x22, 0xc8, 0x0a, 0x0a, 0x04, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, @@ -877,101 +984,108 @@ var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x53, - 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x2f, 0x0a, - 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, - 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x06, 0x52, 0x11, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x2b, - 0x0a, 0x12, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, - 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x54, - 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x47, 0x0a, 0x0a, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, - 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, - 0x61, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x12, 0x30, 0x0a, 0x14, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, - 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, - 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x3c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, - 0xc4, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x69, 0x6d, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x06, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0xde, 0x01, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, - 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, - 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, - 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, - 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, - 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x08, 0x53, 0x70, 0x61, 0x6e, - 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, - 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x49, 0x4e, 0x54, - 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, - 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, - 0x54, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, - 0x5f, 0x50, 0x52, 0x4f, 0x44, 0x55, 0x43, 0x45, 0x52, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x53, - 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x55, 0x4d, 0x45, - 0x52, 0x10, 0x05, 0x22, 0xbd, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, - 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x4e, 0x0a, - 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, - 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, - 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x4a, 0x04, 0x08, - 0x01, 0x10, 0x02, 0x42, 0x77, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, + 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, + 0x69, 0x6e, 0x64, 0x12, 0x2f, 0x0a, 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x06, 0x52, 0x11, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, + 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x2b, 0x0a, 0x12, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, + 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, + 0x6f, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, + 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, + 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, + 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, + 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, + 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, + 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x72, 0x6f, 0x70, 0x70, + 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x4c, 0x69, 0x6e, + 0x6b, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1c, - 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0xc4, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x24, 0x0a, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, + 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, + 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0xf4, 0x01, 0x0a, + 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x72, 0x61, + 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x66, 0x6c, + 0x61, 0x67, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x08, 0x53, 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, + 0x12, 0x19, 0x0a, 0x15, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, + 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, + 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, + 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, + 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, + 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x50, 0x52, 0x4f, + 0x44, 0x55, 0x43, 0x45, 0x52, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, + 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x55, 0x4d, 0x45, 0x52, 0x10, 0x05, 0x22, + 0xbd, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x4e, 0x0a, 0x0a, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x12, + 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4f, 0x4b, + 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, + 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x2a, + 0x48, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x15, + 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x44, 0x4f, 0x5f, 0x4e, 0x4f, + 0x54, 0x5f, 0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1b, 0x53, 0x50, 0x41, 0x4e, 0x5f, + 0x46, 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x47, + 0x53, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x10, 0xff, 0x01, 0x42, 0x77, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x72, + 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x6f, 0x2e, 0x6f, + 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x65, + 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1c, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, + 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x2e, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -986,36 +1100,37 @@ func file_opentelemetry_proto_trace_v1_trace_proto_rawDescGZIP() []byte { return file_opentelemetry_proto_trace_v1_trace_proto_rawDescData } -var file_opentelemetry_proto_trace_v1_trace_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_opentelemetry_proto_trace_v1_trace_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_opentelemetry_proto_trace_v1_trace_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_opentelemetry_proto_trace_v1_trace_proto_goTypes = []interface{}{ - (Span_SpanKind)(0), // 0: opentelemetry.proto.trace.v1.Span.SpanKind - (Status_StatusCode)(0), // 1: opentelemetry.proto.trace.v1.Status.StatusCode - (*TracesData)(nil), // 2: opentelemetry.proto.trace.v1.TracesData - (*ResourceSpans)(nil), // 3: opentelemetry.proto.trace.v1.ResourceSpans - (*ScopeSpans)(nil), // 4: opentelemetry.proto.trace.v1.ScopeSpans - (*Span)(nil), // 5: opentelemetry.proto.trace.v1.Span - (*Status)(nil), // 6: opentelemetry.proto.trace.v1.Status - (*Span_Event)(nil), // 7: opentelemetry.proto.trace.v1.Span.Event - (*Span_Link)(nil), // 8: opentelemetry.proto.trace.v1.Span.Link - (*v1.Resource)(nil), // 9: opentelemetry.proto.resource.v1.Resource - (*v11.InstrumentationScope)(nil), // 10: opentelemetry.proto.common.v1.InstrumentationScope - (*v11.KeyValue)(nil), // 11: opentelemetry.proto.common.v1.KeyValue + (SpanFlags)(0), // 0: opentelemetry.proto.trace.v1.SpanFlags + (Span_SpanKind)(0), // 1: opentelemetry.proto.trace.v1.Span.SpanKind + (Status_StatusCode)(0), // 2: opentelemetry.proto.trace.v1.Status.StatusCode + (*TracesData)(nil), // 3: opentelemetry.proto.trace.v1.TracesData + (*ResourceSpans)(nil), // 4: opentelemetry.proto.trace.v1.ResourceSpans + (*ScopeSpans)(nil), // 5: opentelemetry.proto.trace.v1.ScopeSpans + (*Span)(nil), // 6: opentelemetry.proto.trace.v1.Span + (*Status)(nil), // 7: opentelemetry.proto.trace.v1.Status + (*Span_Event)(nil), // 8: opentelemetry.proto.trace.v1.Span.Event + (*Span_Link)(nil), // 9: opentelemetry.proto.trace.v1.Span.Link + (*v1.Resource)(nil), // 10: opentelemetry.proto.resource.v1.Resource + (*v11.InstrumentationScope)(nil), // 11: opentelemetry.proto.common.v1.InstrumentationScope + (*v11.KeyValue)(nil), // 12: opentelemetry.proto.common.v1.KeyValue } var file_opentelemetry_proto_trace_v1_trace_proto_depIdxs = []int32{ - 3, // 0: opentelemetry.proto.trace.v1.TracesData.resource_spans:type_name -> opentelemetry.proto.trace.v1.ResourceSpans - 9, // 1: opentelemetry.proto.trace.v1.ResourceSpans.resource:type_name -> opentelemetry.proto.resource.v1.Resource - 4, // 2: opentelemetry.proto.trace.v1.ResourceSpans.scope_spans:type_name -> opentelemetry.proto.trace.v1.ScopeSpans - 10, // 3: opentelemetry.proto.trace.v1.ScopeSpans.scope:type_name -> opentelemetry.proto.common.v1.InstrumentationScope - 5, // 4: opentelemetry.proto.trace.v1.ScopeSpans.spans:type_name -> opentelemetry.proto.trace.v1.Span - 0, // 5: opentelemetry.proto.trace.v1.Span.kind:type_name -> opentelemetry.proto.trace.v1.Span.SpanKind - 11, // 6: opentelemetry.proto.trace.v1.Span.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue - 7, // 7: opentelemetry.proto.trace.v1.Span.events:type_name -> opentelemetry.proto.trace.v1.Span.Event - 8, // 8: opentelemetry.proto.trace.v1.Span.links:type_name -> opentelemetry.proto.trace.v1.Span.Link - 6, // 9: opentelemetry.proto.trace.v1.Span.status:type_name -> opentelemetry.proto.trace.v1.Status - 1, // 10: opentelemetry.proto.trace.v1.Status.code:type_name -> opentelemetry.proto.trace.v1.Status.StatusCode - 11, // 11: opentelemetry.proto.trace.v1.Span.Event.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue - 11, // 12: opentelemetry.proto.trace.v1.Span.Link.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 4, // 0: opentelemetry.proto.trace.v1.TracesData.resource_spans:type_name -> opentelemetry.proto.trace.v1.ResourceSpans + 10, // 1: opentelemetry.proto.trace.v1.ResourceSpans.resource:type_name -> opentelemetry.proto.resource.v1.Resource + 5, // 2: opentelemetry.proto.trace.v1.ResourceSpans.scope_spans:type_name -> opentelemetry.proto.trace.v1.ScopeSpans + 11, // 3: opentelemetry.proto.trace.v1.ScopeSpans.scope:type_name -> opentelemetry.proto.common.v1.InstrumentationScope + 6, // 4: opentelemetry.proto.trace.v1.ScopeSpans.spans:type_name -> opentelemetry.proto.trace.v1.Span + 1, // 5: opentelemetry.proto.trace.v1.Span.kind:type_name -> opentelemetry.proto.trace.v1.Span.SpanKind + 12, // 6: opentelemetry.proto.trace.v1.Span.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 8, // 7: opentelemetry.proto.trace.v1.Span.events:type_name -> opentelemetry.proto.trace.v1.Span.Event + 9, // 8: opentelemetry.proto.trace.v1.Span.links:type_name -> opentelemetry.proto.trace.v1.Span.Link + 7, // 9: opentelemetry.proto.trace.v1.Span.status:type_name -> opentelemetry.proto.trace.v1.Status + 2, // 10: opentelemetry.proto.trace.v1.Status.code:type_name -> opentelemetry.proto.trace.v1.Status.StatusCode + 12, // 11: opentelemetry.proto.trace.v1.Span.Event.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 12, // 12: opentelemetry.proto.trace.v1.Span.Link.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue 13, // [13:13] is the sub-list for method output_type 13, // [13:13] is the sub-list for method input_type 13, // [13:13] is the sub-list for extension type_name @@ -1119,7 +1234,7 @@ func file_opentelemetry_proto_trace_v1_trace_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_opentelemetry_proto_trace_v1_trace_proto_rawDesc, - NumEnums: 2, + NumEnums: 3, NumMessages: 7, NumExtensions: 0, NumServices: 0, diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 59548011..e9e97d45 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -430,7 +430,7 @@ type ClientHeader struct { MethodName string `protobuf:"bytes,2,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` // A single process may be used to run multiple virtual // servers with different identities. - // The authority is the name of such a server identitiy. + // The authority is the name of such a server identity. // It is typically a portion of the URI in the form of // or : . Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index e6f2625b..f6e815e6 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -1860,27 +1860,15 @@ func (cc *ClientConn) determineAuthority() error { } endpoint := cc.parsedTarget.Endpoint() - target := cc.target - switch { - case authorityFromDialOption != "": + if authorityFromDialOption != "" { cc.authority = authorityFromDialOption - case authorityFromCreds != "": + } else if authorityFromCreds != "" { cc.authority = authorityFromCreds - case strings.HasPrefix(target, "unix:") || strings.HasPrefix(target, "unix-abstract:"): - // TODO: remove when the unix resolver implements optional interface to - // return channel authority. - cc.authority = "localhost" - case strings.HasPrefix(endpoint, ":"): + } else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok { + cc.authority = auth.OverrideAuthority(cc.parsedTarget) + } else if strings.HasPrefix(endpoint, ":") { cc.authority = "localhost" + endpoint - default: - // TODO: Define an optional interface on the resolver builder to return - // the channel authority given the user's dial target. For resolvers - // which don't implement this interface, we will use the endpoint from - // "scheme://authority/endpoint" as the default authority. - // Escape the endpoint to handle use cases where the endpoint - // might not be a valid authority by default. - // For example an endpoint which has multiple paths like - // 'a/b/c', which is not a valid authority by default. + } else { cc.authority = encodeAuthority(endpoint) } channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority) diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 2549fe8e..6c7ea6a5 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -57,7 +57,7 @@ var ( // GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo // stored in the passed in attributes. This is set by // credentials/xds/xds.go. - GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *xds.HandshakeInfo + GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *unsafe.Pointer // GetServerCredentials returns the transport credentials configured on a // gRPC server. An xDS-enabled server needs to know what type of credentials // is configured on the underlying gRPC server. This is set by server.go. @@ -68,11 +68,6 @@ var ( // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. CanonicalString any // func (codes.Code) string - // DrainServerTransports initiates a graceful close of existing connections - // on a gRPC server accepted on the provided listener address. An - // xDS-enabled server invokes this method on a grpc.Server when a particular - // listener moves to "not-serving" mode. - DrainServerTransports any // func(*grpc.Server, string) // IsRegisteredMethod returns whether the passed in method is registered as // a method on the server. IsRegisteredMethod any // func(*grpc.Server, string) bool @@ -188,6 +183,19 @@ var ( ExitIdleModeForTesting any // func(*grpc.ClientConn) error ChannelzTurnOffForTesting func() + + // TriggerXDSResourceNameNotFoundForTesting triggers the resource-not-found + // error for a given resource type and name. This is usually triggered when + // the associated watch timer fires. For testing purposes, having this + // function makes events more predictable than relying on timer events. + TriggerXDSResourceNameNotFoundForTesting any // func(func(xdsresource.Type, string), string, string) error + + // TriggerXDSResourceNotFoundClient invokes the testing xDS Client singleton + // to invoke resource not found for a resource type name and resource name. + TriggerXDSResourceNameNotFoundClient any // func(string, string) error + + // FromOutgoingContextRaw returns the un-merged, intermediary contents of metadata.rawMD. + FromOutgoingContextRaw any // func(context.Context) (metadata.MD, [][]string, bool) ) // HealthChecker defines the signature of the client-side LB channel health checking function. diff --git a/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go b/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go index 16091168..27cd81af 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go +++ b/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go @@ -61,6 +61,10 @@ func (b *builder) Scheme() string { return b.scheme } +func (b *builder) OverrideAuthority(resolver.Target) string { + return "localhost" +} + type nopResolver struct { } diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go similarity index 96% rename from vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go rename to vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go index aeffd3e1..4f347edd 100644 --- a/vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go @@ -1,4 +1,4 @@ -//go:build !unix +//go:build !unix && !windows /* * Copyright 2023 gRPC authors. diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go new file mode 100644 index 00000000..fd7d43a8 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go @@ -0,0 +1,54 @@ +//go:build windows + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +import ( + "net" + "syscall" + "time" + + "golang.org/x/sys/windows" +) + +// NetDialerWithTCPKeepalive returns a net.Dialer that enables TCP keepalives on +// the underlying connection with OS default values for keepalive parameters. +// +// TODO: Once https://github.com/golang/go/issues/62254 lands, and the +// appropriate Go version becomes less than our least supported Go version, we +// should look into using the new API to make things more straightforward. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{ + // Setting a negative value here prevents the Go stdlib from overriding + // the values of TCP keepalive time and interval. It also prevents the + // Go stdlib from enabling TCP keepalives by default. + KeepAlive: time.Duration(-1), + // This method is called after the underlying network socket is created, + // but before dialing the socket (or calling its connect() method). The + // combination of unconditionally enabling TCP keepalives here, and + // disabling the overriding of TCP keepalive parameters by setting the + // KeepAlive field to a negative value above, results in OS defaults for + // the TCP keealive interval and time parameters. + Control: func(_, _ string, c syscall.RawConn) error { + return c.Control(func(fd uintptr) { + windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_KEEPALIVE, 1) + }) + }, + } +} diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 59f67655..c33ac596 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -59,6 +59,8 @@ import ( // atomically. var clientConnectionCounter uint64 +var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) + // http2Client implements the ClientTransport interface with HTTP2. type http2Client struct { lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. @@ -568,7 +570,7 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) } - if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok { var k string for k, vv := range md { // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. @@ -1323,10 +1325,8 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { for streamID, stream := range t.activeStreams { if streamID > id && streamID <= upperLimit { // The stream was unprocessed by the server. - if streamID > id && streamID <= upperLimit { - atomic.StoreUint32(&stream.unprocessed, 1) - streamsToClose = append(streamsToClose, stream) - } + atomic.StoreUint32(&stream.unprocessed, 1) + streamsToClose = append(streamsToClose, stream) } } t.mu.Unlock() diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 680c9eba..f6bac0e8 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -960,7 +960,12 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { } } if err := t.writeHeaderLocked(s); err != nil { - return status.Convert(err).Err() + switch e := err.(type) { + case ConnectionError: + return status.Error(codes.Unavailable, e.Desc) + default: + return status.Convert(err).Err() + } } return nil } diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index 49446825..1e9485fd 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -25,8 +25,14 @@ import ( "context" "fmt" "strings" + + "google.golang.org/grpc/internal" ) +func init() { + internal.FromOutgoingContextRaw = fromOutgoingContextRaw +} + // DecodeKeyValue returns k, v, nil. // // Deprecated: use k and v directly instead. @@ -238,16 +244,13 @@ func copyOf(v []string) []string { return vals } -// FromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD. +// fromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD. // // Remember to perform strings.ToLower on the keys, for both the returned MD (MD // is a map, there's no guarantee it's created using our helper functions) and // the extra kv pairs (AppendToOutgoingContext doesn't turn them into // lowercase). -// -// This is intended for gRPC-internal use ONLY. Users should use -// FromOutgoingContext instead. -func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { +func fromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) if !ok { return nil, nil, false diff --git a/vendor/google.golang.org/grpc/reflection/README.md b/vendor/google.golang.org/grpc/reflection/README.md index 04b6371a..9ace83cc 100644 --- a/vendor/google.golang.org/grpc/reflection/README.md +++ b/vendor/google.golang.org/grpc/reflection/README.md @@ -2,7 +2,7 @@ Package reflection implements server reflection service. -The service implemented is defined in: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. +The service implemented is defined in: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1/reflection.proto. To register server reflection on a gRPC server: ```go diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection.go b/vendor/google.golang.org/grpc/reflection/serverreflection.go index 76dae09d..c3b40839 100644 --- a/vendor/google.golang.org/grpc/reflection/serverreflection.go +++ b/vendor/google.golang.org/grpc/reflection/serverreflection.go @@ -176,11 +176,20 @@ type serverReflectionServer struct { // wire format ([]byte). The fileDescriptors will include fd and all the // transitive dependencies of fd with names not in sentFileDescriptors. func (s *serverReflectionServer) fileDescWithDependencies(fd protoreflect.FileDescriptor, sentFileDescriptors map[string]bool) ([][]byte, error) { + if fd.IsPlaceholder() { + // If the given root file is a placeholder, treat it + // as missing instead of serializing it. + return nil, protoregistry.NotFound + } var r [][]byte queue := []protoreflect.FileDescriptor{fd} for len(queue) > 0 { currentfd := queue[0] queue = queue[1:] + if currentfd.IsPlaceholder() { + // Skip any missing files in the dependency graph. + continue + } if sent := sentFileDescriptors[currentfd.Path()]; len(r) == 0 || !sent { sentFileDescriptors[currentfd.Path()] = true fdProto := protodesc.ToFileDescriptorProto(currentfd) diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index bd1c7d01..adf89dd9 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -314,3 +314,13 @@ type Resolver interface { // Close closes the resolver. Close() } + +// AuthorityOverrider is implemented by Builders that wish to override the +// default authority for the ClientConn. +// By default, the authority used is target.Endpoint(). +type AuthorityOverrider interface { + // OverrideAuthority returns the authority to use for a ClientConn with the + // given target. The implementation must generate it without blocking, + // typically in line, and must keep it unchanged. + OverrideAuthority(Target) string +} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index b7723aa0..a4b6bc68 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -640,14 +640,18 @@ func encode(c baseCodec, msg any) ([]byte, error) { return b, nil } -// compress returns the input bytes compressed by compressor or cp. If both -// compressors are nil, returns nil. +// compress returns the input bytes compressed by compressor or cp. +// If both compressors are nil, or if the message has zero length, returns nil, +// indicating no compression was done. // // TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { if compressor == nil && cp == nil { return nil, nil } + if len(in) == 0 { + return nil, nil + } wrapErr := func(err error) error { return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 682fa183..e89c5ac6 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -74,9 +74,6 @@ func init() { return srv.isRegisteredMethod(method) } internal.ServerFromContext = serverFromContext - internal.DrainServerTransports = func(srv *Server, addr string) { - srv.drainServerTransports(addr) - } internal.AddGlobalServerOptions = func(opt ...ServerOption) { globalServerOptions = append(globalServerOptions, opt...) } @@ -139,7 +136,8 @@ type Server struct { quit *grpcsync.Event done *grpcsync.Event channelzRemoveOnce sync.Once - serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop + serveWG sync.WaitGroup // counts active Serve goroutines for Stop/GracefulStop + handlersWG sync.WaitGroup // counts active method handler goroutines channelzID *channelz.Identifier czData *channelzData @@ -176,6 +174,7 @@ type serverOptions struct { headerTableSize *uint32 numServerWorkers uint32 recvBufferPool SharedBufferPool + waitForHandlers bool } var defaultServerOptions = serverOptions{ @@ -573,6 +572,21 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption { }) } +// WaitForHandlers cause Stop to wait until all outstanding method handlers have +// exited before returning. If false, Stop will return as soon as all +// connections have closed, but method handlers may still be running. By +// default, Stop does not wait for method handlers to return. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func WaitForHandlers(w bool) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.waitForHandlers = w + }) +} + // RecvBufferPool returns a ServerOption that configures the server // to use the provided shared buffer pool for parsing incoming messages. Depending // on the application's workload, this could result in reduced memory allocation. @@ -932,6 +946,12 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) { return } + if cc, ok := rawConn.(interface { + PassServerTransport(transport.ServerTransport) + }); ok { + cc.PassServerTransport(st) + } + if !s.addConn(lisAddr, st) { return } @@ -941,15 +961,6 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) { }() } -func (s *Server) drainServerTransports(addr string) { - s.mu.Lock() - conns := s.conns[addr] - for st := range conns { - st.Drain("") - } - s.mu.Unlock() -} - // newHTTP2Transport sets up a http/2 transport (using the // gRPC http2 server transport in transport/http2_server.go). func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { @@ -1010,9 +1021,11 @@ func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport, streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams) st.HandleStreams(ctx, func(stream *transport.Stream) { + s.handlersWG.Add(1) streamQuota.acquire() f := func() { defer streamQuota.release() + defer s.handlersWG.Done() s.handleStream(st, stream) } @@ -1911,6 +1924,10 @@ func (s *Server) stop(graceful bool) { s.serverWorkerChannelClose() } + if graceful || s.opts.waitForHandlers { + s.handlersWG.Wait() + } + if s.events != nil { s.events.Finish() s.events = nil diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index b14b2fbe..d621f52b 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -48,6 +48,8 @@ import ( "google.golang.org/grpc/status" ) +var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) + // StreamHandler defines the handler called by gRPC server to complete the // execution of a streaming RPC. // @@ -184,7 +186,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth // when the RPC completes. opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...) - if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok { // validate md if err := imetadata.Validate(md); err != nil { return nil, status.Error(codes.Internal, err.Error()) diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index dc2cea59..1ad1ba2a 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.60.1" +const Version = "1.61.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index 896dc38f..5da38a40 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -88,7 +88,7 @@ not git grep -l 'x/net/context' -- "*.go" git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^interop/stress\|grpcrand\|^benchmark\|wrr_test' # - Do not use "interface{}"; use "any" instead. -git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc' +git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc\|grpc_testing_not_regenerate' # - Do not call grpclog directly. Use grpclog.Component instead. git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' @@ -127,7 +127,7 @@ staticcheck -go 1.19 -checks 'all' ./... > "${SC_OUT}" || true grep -v "(ST1000)" "${SC_OUT}" | grep -v "(SA1019)" | grep -v "(ST1003)" | not grep -v "(ST1019)\|\(other import of\)" # Exclude underscore checks for generated code. -grep "(ST1003)" "${SC_OUT}" | not grep -v '\(.pb.go:\)\|\(code_string_test.go:\)' +grep "(ST1003)" "${SC_OUT}" | not grep -v '\(.pb.go:\)\|\(code_string_test.go:\)\|\(grpc_testing_not_regenerate\)' # Error for duplicate imports not including grpc protos. grep "(ST1019)\|\(other import of\)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused @@ -152,6 +152,7 @@ grep "(SA1019)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused XXXXX Protobuf related deprecation errors: "github.com/golang/protobuf .pb.go: +grpc_testing_not_regenerate : ptypes. proto.RegisterType XXXXX gRPC internal usage deprecation errors: @@ -184,9 +185,6 @@ GetSafeRegexMatch GetSuffixMatch GetTlsCertificateCertificateProviderInstance GetValidationContextCertificateProviderInstance -XXXXX TODO: Remove the below deprecation usages: -CloseNotifier -Roots.Subjects XXXXX PleaseIgnoreUnused' echo SUCCESS diff --git a/vendor/modules.txt b/vendor/modules.txt index 34994fc5..6a2eac1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,7 +6,6 @@ cloud.google.com/go/compute/internal cloud.google.com/go/compute/metadata # contrib.go.opencensus.io/exporter/prometheus v0.4.2 ## explicit; go 1.13 -contrib.go.opencensus.io/exporter/prometheus # github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azcore @@ -166,7 +165,7 @@ github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1 # github.com/cespare/xxhash/v2 v2.2.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 +# github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 ## explicit; go 1.11 github.com/cncf/xds/go/udpa/annotations github.com/cncf/xds/go/xds/annotations/v3 @@ -293,6 +292,9 @@ github.com/go-openapi/swag # github.com/go-resty/resty/v2 v2.7.0 ## explicit; go 1.11 github.com/go-resty/resty/v2 +# github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 +## explicit; go 1.18 +github.com/go-viper/mapstructure/v2 # github.com/go-zookeeper/zk v1.0.3 ## explicit; go 1.13 github.com/go-zookeeper/zk @@ -617,7 +619,7 @@ github.com/knadh/koanf/maps # github.com/knadh/koanf/providers/confmap v0.1.0 ## explicit; go 1.18 github.com/knadh/koanf/providers/confmap -# github.com/knadh/koanf/v2 v2.0.1 +# github.com/knadh/koanf/v2 v2.0.2 ## explicit; go 1.18 github.com/knadh/koanf/v2 # github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b @@ -1091,9 +1093,6 @@ github.com/prometheus/prometheus/util/strutil github.com/prometheus/prometheus/util/treecache # github.com/prometheus/statsd_exporter v0.22.7 ## explicit; go 1.17 -github.com/prometheus/statsd_exporter/pkg/level -github.com/prometheus/statsd_exporter/pkg/mapper -github.com/prometheus/statsd_exporter/pkg/mapper/fsm # github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 ## explicit github.com/rcrowley/go-metrics @@ -1124,7 +1123,7 @@ github.com/scaleway/scaleway-sdk-go/logger github.com/scaleway/scaleway-sdk-go/namegenerator github.com/scaleway/scaleway-sdk-go/scw github.com/scaleway/scaleway-sdk-go/validation -# github.com/shirou/gopsutil/v3 v3.23.12 +# github.com/shirou/gopsutil/v3 v3.24.1 ## explicit; go 1.15 github.com/shirou/gopsutil/v3/common github.com/shirou/gopsutil/v3/cpu @@ -1215,7 +1214,6 @@ go.opencensus.io/internal go.opencensus.io/internal/tagencoding go.opencensus.io/metric go.opencensus.io/metric/metricdata -go.opencensus.io/metric/metricexport go.opencensus.io/metric/metricproducer go.opencensus.io/plugin/ochttp go.opencensus.io/plugin/ochttp/propagation/b3 @@ -1229,7 +1227,7 @@ go.opencensus.io/trace go.opencensus.io/trace/internal go.opencensus.io/trace/propagation go.opencensus.io/trace/tracestate -# go.opentelemetry.io/collector v0.93.0 +# go.opentelemetry.io/collector v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/client go.opentelemetry.io/collector/internal/cgroups @@ -1239,7 +1237,7 @@ go.opentelemetry.io/collector/internal/memorylimiter go.opentelemetry.io/collector/internal/obsreportconfig go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics go.opentelemetry.io/collector/internal/sharedcomponent -# go.opentelemetry.io/collector/component v0.93.0 +# go.opentelemetry.io/collector/component v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/component go.opentelemetry.io/collector/component/componenttest @@ -1255,7 +1253,7 @@ go.opentelemetry.io/collector/config/configgrpc # go.opentelemetry.io/collector/config/confighttp v0.93.0 ## explicit; go 1.20 go.opentelemetry.io/collector/config/confighttp -# go.opentelemetry.io/collector/config/confignet v0.93.0 +# go.opentelemetry.io/collector/config/confignet v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/config/confignet # go.opentelemetry.io/collector/config/configopaque v0.93.0 @@ -1264,7 +1262,7 @@ go.opentelemetry.io/collector/config/configopaque # go.opentelemetry.io/collector/config/configretry v0.93.0 ## explicit; go 1.20 go.opentelemetry.io/collector/config/configretry -# go.opentelemetry.io/collector/config/configtelemetry v0.93.0 +# go.opentelemetry.io/collector/config/configtelemetry v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/config/configtelemetry # go.opentelemetry.io/collector/config/configtls v0.93.0 @@ -1273,7 +1271,7 @@ go.opentelemetry.io/collector/config/configtls # go.opentelemetry.io/collector/config/internal v0.93.0 ## explicit; go 1.20 go.opentelemetry.io/collector/config/internal -# go.opentelemetry.io/collector/confmap v0.93.0 +# go.opentelemetry.io/collector/confmap v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/confmap go.opentelemetry.io/collector/confmap/converter/expandconverter @@ -1288,7 +1286,7 @@ go.opentelemetry.io/collector/confmap/provider/yamlprovider # go.opentelemetry.io/collector/connector v0.93.0 ## explicit; go 1.20 go.opentelemetry.io/collector/connector -# go.opentelemetry.io/collector/consumer v0.93.0 +# go.opentelemetry.io/collector/consumer v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/consumer go.opentelemetry.io/collector/consumer/consumererror @@ -1316,7 +1314,7 @@ go.opentelemetry.io/collector/exporter/otlpexporter/internal/metadata ## explicit; go 1.20 go.opentelemetry.io/collector/exporter/otlphttpexporter go.opentelemetry.io/collector/exporter/otlphttpexporter/internal/metadata -# go.opentelemetry.io/collector/extension v0.93.0 +# go.opentelemetry.io/collector/extension v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/extension go.opentelemetry.io/collector/extension/experimental/storage @@ -1327,11 +1325,11 @@ go.opentelemetry.io/collector/extension/auth ## explicit; go 1.20 go.opentelemetry.io/collector/extension/ballastextension go.opentelemetry.io/collector/extension/ballastextension/internal/metadata -# go.opentelemetry.io/collector/extension/zpagesextension v0.93.0 +# go.opentelemetry.io/collector/extension/zpagesextension v0.94.1 ## explicit; go 1.20 go.opentelemetry.io/collector/extension/zpagesextension go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata -# go.opentelemetry.io/collector/featuregate v1.0.1 +# go.opentelemetry.io/collector/featuregate v1.1.0 ## explicit; go 1.20 go.opentelemetry.io/collector/featuregate # go.opentelemetry.io/collector/otelcol v0.93.0 @@ -1339,7 +1337,7 @@ go.opentelemetry.io/collector/featuregate go.opentelemetry.io/collector/otelcol go.opentelemetry.io/collector/otelcol/internal/configunmarshaler go.opentelemetry.io/collector/otelcol/internal/grpclog -# go.opentelemetry.io/collector/pdata v1.0.1 +# go.opentelemetry.io/collector/pdata v1.1.0 ## explicit; go 1.20 go.opentelemetry.io/collector/pdata/internal go.opentelemetry.io/collector/pdata/internal/data @@ -1405,7 +1403,7 @@ go.opentelemetry.io/collector/service/internal/status go.opentelemetry.io/collector/service/internal/zpages go.opentelemetry.io/collector/service/pipelines go.opentelemetry.io/collector/service/telemetry -# go.opentelemetry.io/contrib/config v0.2.0 +# go.opentelemetry.io/contrib/config v0.3.0 ## explicit; go 1.20 go.opentelemetry.io/contrib/config # go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 @@ -1423,7 +1421,7 @@ go.opentelemetry.io/contrib/propagators/b3 ## explicit; go 1.20 go.opentelemetry.io/contrib/zpages go.opentelemetry.io/contrib/zpages/internal -# go.opentelemetry.io/otel v1.22.0 +# go.opentelemetry.io/otel v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute @@ -1460,39 +1458,39 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envco go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/otlp/otlptrace go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry -# go.opentelemetry.io/otel/exporters/prometheus v0.45.0 +# go.opentelemetry.io/otel/exporters/prometheus v0.45.1 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/prometheus # go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric -# go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 +# go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/exporters/stdout/stdouttrace -# go.opentelemetry.io/otel/metric v1.22.0 +# go.opentelemetry.io/otel/metric v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded go.opentelemetry.io/otel/metric/noop -# go.opentelemetry.io/otel/sdk v1.22.0 +# go.opentelemetry.io/otel/sdk v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/instrumentation @@ -1501,19 +1499,20 @@ go.opentelemetry.io/otel/sdk/internal/env go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace go.opentelemetry.io/otel/sdk/trace/tracetest -# go.opentelemetry.io/otel/sdk/metric v1.22.0 +# go.opentelemetry.io/otel/sdk/metric v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/sdk/metric go.opentelemetry.io/otel/sdk/metric/internal go.opentelemetry.io/otel/sdk/metric/internal/aggregate +go.opentelemetry.io/otel/sdk/metric/internal/exemplar go.opentelemetry.io/otel/sdk/metric/internal/x go.opentelemetry.io/otel/sdk/metric/metricdata -# go.opentelemetry.io/otel/trace v1.22.0 +# go.opentelemetry.io/otel/trace v1.23.0 ## explicit; go 1.20 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/noop -# go.opentelemetry.io/proto/otlp v1.0.0 +# go.opentelemetry.io/proto/otlp v1.1.0 ## explicit; go 1.17 go.opentelemetry.io/proto/otlp/collector/metrics/v1 go.opentelemetry.io/proto/otlp/collector/trace/v1 @@ -1720,7 +1719,7 @@ google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.60.1 +# google.golang.org/grpc v1.61.0 ## explicit; go 1.19 google.golang.org/grpc google.golang.org/grpc/attributes