diff --git a/go.mod b/go.mod index 7663cfcdacf..7d465399f7b 100644 --- a/go.mod +++ b/go.mod @@ -200,7 +200,7 @@ require ( github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/ncw/swift v1.0.53 // indirect github.com/oklog/run v1.1.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.73.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.81.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect @@ -224,8 +224,8 @@ require ( go.etcd.io/etcd/client/v3 v3.5.4 // indirect go.mongodb.org/mongo-driver v1.11.3 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/collector/featuregate v0.73.0 // indirect - go.opentelemetry.io/collector/semconv v0.73.0 // indirect + go.opentelemetry.io/collector/featuregate v1.0.0-rcv0013 // indirect + go.opentelemetry.io/collector/semconv v0.81.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.uber.org/zap v1.21.0 // indirect @@ -270,3 +270,6 @@ replace github.com/munnerz/goautoneg => github.com/charleskorn/goautoneg v0.0.0- // Replace opentracing-contrib/go-stdlib with a fork until https://github.com/opentracing-contrib/go-stdlib/pull/68 is merged. replace github.com/opentracing-contrib/go-stdlib => github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 + +// Replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite with a fork until https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/24288 is merged. +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite => github.com/charleskorn/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.0.0-20230717033559-beffb82bb827 diff --git a/go.sum b/go.sum index 394d40ccb96..51bf179a6e3 100644 --- a/go.sum +++ b/go.sum @@ -504,6 +504,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charleskorn/goautoneg v0.0.0-20230303030534-7248a2f4c9cc h1:r9yn26N6K60wfQPMwxNeD8U2djqObFYh6o9LXfeMecg= github.com/charleskorn/goautoneg v0.0.0-20230303030534-7248a2f4c9cc/go.mod h1:S666TGglI7cVCVpErP7i+7iFlS330LD8vZDcFk9IdCg= +github.com/charleskorn/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.0.0-20230717033559-beffb82bb827 h1:/eFbe8NJWZD9NIaOA8RJ4gjxw7tME7V7t+B3ufyH7iE= +github.com/charleskorn/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.0.0-20230717033559-beffb82bb827/go.mod h1:FLUCs/7YJX0pauUBlj+5cy2h0ckjVMno2YyXsO/j89k= github.com/chromedp/cdproto v0.0.0-20210526005521-9e51b9051fd0/go.mod h1:At5TxYYdxkbQL0TSefRjhLE3Q0lgvqKKMSFUglJ7i1U= github.com/chromedp/cdproto v0.0.0-20210706234513-2bc298e8be7f/go.mod h1:At5TxYYdxkbQL0TSefRjhLE3Q0lgvqKKMSFUglJ7i1U= github.com/chromedp/cdproto v0.0.0-20220629234738-4cfc9cdeeb92 h1:0kiAQSLWZDt4wsmcICou3C6in/OJ58FCqvXcB8Ax1Dk= @@ -1098,12 +1100,10 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.24.0 h1:+0glovB9Jd6z3VR+ScSwQqXVTIfJcGA9UBM8yzQxhqg= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.73.0 h1:nUavTvhdE9+Gq11XvZIYIRpw0+njQqjUeDPq2FL1q7M= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.73.0 h1:1WpzAuX9TOKBUWZjJv/iDNcU59jKKc6/Ev+l03u4syU= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.73.0 h1:hmBMbcwJdbnxjPiabzo9ks1bseCzUGPGxQhklg2o9vc= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.73.0/go.mod h1:i1JP3T6TJRJNk/i1D2bHPF481FUvM4McFC+j0C1sj6I= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.73.0 h1:nkUfL6+7gOyl9wrfRBGfjrHi3Th5IG5GG7I32vmTbQ4= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.73.0/go.mod h1:Mx1IT+/6c8pyBilGzwepTGgzuW6Dl0Pk2vKkVHOavpY= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.81.0 h1:EIbmD7EzonXaKDyq2MrCpfpar1VEKjVFJ50rzfTsWpc= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.81.0 h1:sPjCHuqjn5UYDJOai4FulMCfLP+7AbspjHfv0jAtmD0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.81.0 h1:syUuhc/z2yIsTmL9jt2gmXkYUM/jgsQZoH6NAE6i54Q= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.81.0/go.mod h1:LRzHoUpI8xZN5KXulEglZnbkYBHyiqHgQXGudIqpTtk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc= @@ -1306,12 +1306,12 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= 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/featuregate v0.73.0 h1:hpHKXmRiJqMLefIzXwIuqDo9df2HcI/66IAKLo+g7nc= -go.opentelemetry.io/collector/featuregate v0.73.0/go.mod h1:oIrO4ysPfThwkYKoNlgpHjDU/TgS9kIv2OI74pDUkp4= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0013 h1:tiTUG9X/gEDN1oDYQOBVUFYQfhUG2CvgW9VhBc2uk1U= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0013/go.mod h1:0mE3mDLmUrOXVoNsuvj+7dV14h/9HFl/Fy9YTLoLObo= go.opentelemetry.io/collector/pdata v1.0.0-rcv0013 h1:4sONXE9hAX+4Di8m0bQ/KaoH3Mi+OPt04cXkZ7A8W3k= go.opentelemetry.io/collector/pdata v1.0.0-rcv0013/go.mod h1:x09G/4KjEcDKNuWCjC5ZtnuDE0XEqiRwI+yrHSVjIy8= -go.opentelemetry.io/collector/semconv v0.73.0 h1:gF4f6z1q8YfWzzo/gPKysjFmmM4Pv4nC2bWrTPxTPaE= -go.opentelemetry.io/collector/semconv v0.73.0/go.mod h1:xt8oDOiwa1jy24tGUo8+SzpphI7ZredS2WM/0m8rtTA= +go.opentelemetry.io/collector/semconv v0.81.0 h1:lCYNNo3powDvFIaTPP2jDKIrBiV1T92NK4QgL/aHYXw= +go.opentelemetry.io/collector/semconv v0.81.0/go.mod h1:TlYPtzvsXyHOgr5eATi43qEMqwSmIziivJB2uctKswo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1:XiYsayHc36K3EByOO6nbAXnAWbrUxdjUROCEeeROOH8= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/README.md b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/README.md index 07ffee9b1d2..7c29facac63 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/README.md +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/README.md @@ -1,7 +1,8 @@ # Prometheus Normalization -[OpenTelemetry's metric semantic convention](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md) is not compatible with [Prometheus' own metrics naming convention](https://prometheus.io/docs/practices/naming/). This module provides centralized functions to convert OpenTelemetry metrics to Prometheus-compliant metrics. These functions are used by the exporters for Prometheus: +[OpenTelemetry's metric semantic convention](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md) is not compatible with [Prometheus' own metrics naming convention](https://prometheus.io/docs/practices/naming/). This module provides centralized functions to convert OpenTelemetry metrics to Prometheus-compliant metrics. These functions are used by the following components for Prometheus: +* [prometheusreceiver](../../../receiver/prometheusreceiver/) * [prometheusexporter](../../../exporter/prometheusexporter/) * [prometheusremotewriteexporter](../../../exporter/prometheusremotewriteexporter/) @@ -11,25 +12,26 @@ > **Warning** > -> This feature must be enabled with [feature gate](https://github.com/open-telemetry/opentelemetry-collector/tree/main/featuregate) `pkg.translator.prometheus.NormalizeName`. It is disabled by default (alpha stage). +> This feature can be enabled with [feature gate](https://github.com/open-telemetry/opentelemetry-collector/tree/main/featuregate) `pkg.translator.prometheus.NormalizeName`. It is disabled by default (alpha stage). > > ```shell-session > $ otelcol --config=config.yaml --feature-gates=pkg.translator.prometheus.NormalizeName > ``` -List of transformations performed on OpenTelemetry metrics names: - -| Case | Transformation | Example | -| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| Unsupported characters and extraneous underscores | Replace unsupported characters with underscores (`_`). Drop redundant, leading and trailing underscores. | `(lambda).function.executions(#)` ==> `lambda_function_executions` | -| Standard unit | Convert the unit from [Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html) to Prometheus standard and append | `system.filesystem.usage` with unit `By` ==> `system_filesystem_usage_bytes` | -| Non-standard unit (unit is surrounded with `{}`) | Drop the unit | `system.network.dropped` with unit `{packets}` ==> `system_network_dropped` | -| Non-standard unit (unit is **not** surrounded with `{}`) | Append the unit, if not already present, after sanitization (all non-alphanumeric chars are dropped) | `system.network.dropped` with unit `packets` ==> `system_network_dropped_packets` | -| Percentages (unit is `1`) | Append `_ratio` (for gauges only) | `system.memory.utilization` with unit `1` ==> `system_memory_utilization_ratio` | -| Percentages (unit is `%`) | Replace `%` with `percent` `_percent` | `storage.filesystem.utilization` with unit `%` ==> `storage_filesystem_utilization_percent` | -| Rates (unit contains `/`) | Replace `/` with `per` | `astro.light.speed` with unit `m/s` ==> `astro_light_speed_meters_per_second` | -| Dollars (unit is `$`) | Replace `$` with `dollars` | `crypto.dogecoin.value` with unit `$` ==> `crypto.dogecoin.value_dollars` | -| Counter | Append `_total` | `system.processes.created` ==> `system_processes_created_total` | +#### List of transformations to convert OpenTelemetry metrics to Prometheus metrics + +| Case | Transformation | Example | +|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| +| Unsupported characters and extraneous underscores | Replace unsupported characters with underscores (`_`). Drop redundant, leading and trailing underscores. | `(lambda).function.executions(#)` → `lambda_function_executions` | +| Standard unit | Convert the unit from [Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html) to Prometheus standard and append | `system.filesystem.usage` with unit `By` → `system_filesystem_usage_bytes` | +| Non-standard unit (unit is surrounded with `{}`) | Drop the unit | `system.network.dropped` with unit `{packets}` → `system_network_dropped` | +| Non-standard unit (unit is **not** surrounded with `{}`) | Append the unit, if not already present, after sanitization (all non-alphanumeric chars are dropped) | `system.network.dropped` with unit `packets` → `system_network_dropped_packets` | +| Percentages (unit is `1`) | Append `_ratio` (for gauges only) | `system.memory.utilization` with unit `1` → `system_memory_utilization_ratio` | +| Percentages (unit is `%`) | Replace `%` with `percent` `_percent` | `storage.filesystem.utilization` with unit `%` → `storage_filesystem_utilization_percent` | +| Rates (unit contains `/`) | Replace `/` with `per` | `astro.light.speed` with unit `m/s` → `astro_light_speed_meters_per_second` | +| Dollars (unit is `$`) | Replace `$` with `dollars` | `crypto.dogecoin.value` with unit `$` → `crypto_dogecoin_value_dollars` | +| Counter | Append `_total` | `system.processes.created` → `system_processes_created_total` | + List of standard OpenTelemetry units that will be translated to [Prometheus standard base units](https://prometheus.io/docs/practices/naming/#base-units): | OpenTelemetry Unit | Corresponding Prometheus Unit | @@ -73,6 +75,13 @@ List of standard OpenTelemetry units that will be translated to [Prometheus stan > **Note** > Prometheus also recommends using base units (no kilobytes, or milliseconds, for example) but these functions will not attempt to convert non-base units to base units. +#### List of transformations performed to convert Prometheus metrics to OpenTelemetry metrics + +| Case | Transformation | Example | +|------------------------------------|------------------------------------------------------------------------|---------------------------------------------------------------------------------| +| UNIT defined in OpenMetrics format | Drop the unit suffix and set it in the OpenTelemetry metric unit field | `system_network_dropped_packets` → `system_network_dropped` with `packets` unit | +| Counter | Drop `_total` suffix | `system_processes_created_total`→ `system_processes_created` | + ### Simple normalization If feature `pkg.translator.prometheus.NormalizeName` is not enabled, a simple sanitization of the OpenTelemetry metric name is performed to ensure it follows Prometheus naming conventions: diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_label.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_label.go index 0af636d64b6..af0960e8623 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_label.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_label.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheus // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus" diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_name.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_name.go index 523819ab536..7c4811e1715 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_name.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus/normalize_name.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheus // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus" diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/helper.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/helper.go index 8b56f50c5fc..68ad2a66500 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/helper.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/helper.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheusremotewrite // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite" diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/histograms.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/histograms.go index 942329a8f31..293d318a3c5 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/histograms.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/histograms.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheusremotewrite // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite" diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/metrics_to_prw.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/metrics_to_prw.go index 81160fa17e8..205e279020f 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/metrics_to_prw.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/metrics_to_prw.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheusremotewrite // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite" diff --git a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/number_data_points.go b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/number_data_points.go index e57ac75581d..d50ed652651 100644 --- a/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/number_data_points.go +++ b/vendor/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/number_data_points.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package prometheusremotewrite // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite" diff --git a/vendor/go.opentelemetry.io/collector/featuregate/README.md b/vendor/go.opentelemetry.io/collector/featuregate/README.md index 8c3710baa8a..d3e3c802d63 100644 --- a/vendor/go.opentelemetry.io/collector/featuregate/README.md +++ b/vendor/go.opentelemetry.io/collector/featuregate/README.md @@ -18,10 +18,11 @@ Once a `Gate` has been marked as `Stable`, it must have a `RemovalVersion` set. ```go var myFeatureGate = featuregate.GlobalRegistry().MustRegister( "namespaced.uniqueIdentifier", - featuregate.Stable, + featuregate.Stable, + featuregate.WithRegisterFromVersion("v0.65.0") featuregate.WithRegisterDescription("A brief description of what the gate controls"), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector/issues/6167"), - featuregate.WithRegisterRemovalVersion("v0.70.0")) + featuregate.WithRegisterToVersion("v0.70.0")) ``` The status of the gate may later be checked by interrogating the global @@ -60,11 +61,17 @@ modeled after the [system used by Kubernetes](https://kubernetes.io/docs/referen through a `Gate`. 2. A `beta` stage where the feature has been well tested and is enabled by default but can be disabled through a `Gate`. -3. A generally available stage where the feature is permanently enabled and - the `Gate` is no longer operative. +3. A generally available or `stable` stage where the feature is permanently enabled. At this stage + the gate should no longer be explicitly used. Disabling the gate will produce an error and + explicitly enabling will produce a warning log. +4. A `stable` feature gate will be removed in the version specified by its `ToVersion` value. Features that prove unworkable in the `alpha` stage may be discontinued -without proceeding to the `beta` stage. Features that make it to the `beta` -stage will not be dropped and will eventually reach general availability -where the `Gate` that allowed them to be disabled during the `beta` stage -will be removed. +without proceeding to the `beta` stage. Instead, they will proceed to the +`deprecated` stage, which will feature is permanently disabled. A feature gate will +be removed once it has been `deprecated` for at least 2 releases of the collector. + +Features that make it to the `beta` stage are intended to reach general availability but may still be discontinued. +If, after wider use, it is determined that the gate should be discontinued it will be reverted to the `alpha` stage +for 2 releases and then proceed to the `deprecated` stage. If instead it is ready for general availability it will +proceed to the `stable` stage. diff --git a/vendor/go.opentelemetry.io/collector/featuregate/flag.go b/vendor/go.opentelemetry.io/collector/featuregate/flag.go new file mode 100644 index 00000000000..3ff105d3e69 --- /dev/null +++ b/vendor/go.opentelemetry.io/collector/featuregate/flag.go @@ -0,0 +1,55 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package featuregate // import "go.opentelemetry.io/collector/featuregate" + +import ( + "flag" + "strings" + + "go.uber.org/multierr" +) + +// NewFlag returns a flag.Value that directly applies feature gate statuses to a Registry. +func NewFlag(reg *Registry) flag.Value { + return &flagValue{reg: reg} +} + +// flagValue implements the flag.Value interface and directly applies feature gate statuses to a Registry. +type flagValue struct { + reg *Registry +} + +func (f *flagValue) String() string { + var ids []string + f.reg.VisitAll(func(g *Gate) { + id := g.ID() + if !g.IsEnabled() { + id = "-" + id + } + ids = append(ids, id) + }) + return strings.Join(ids, ",") +} + +func (f *flagValue) Set(s string) error { + if s == "" { + return nil + } + + var errs error + ids := strings.Split(s, ",") + for i := range ids { + id := ids[i] + val := true + switch id[0] { + case '-': + id = id[1:] + val = false + case '+': + id = id[1:] + } + errs = multierr.Append(errs, f.reg.Set(id, val)) + } + return errs +} diff --git a/vendor/go.opentelemetry.io/collector/featuregate/flags.go b/vendor/go.opentelemetry.io/collector/featuregate/flags.go deleted file mode 100644 index a1c9ec4306b..00000000000 --- a/vendor/go.opentelemetry.io/collector/featuregate/flags.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package featuregate // import "go.opentelemetry.io/collector/featuregate" - -import ( - "flag" - "sort" - "strings" -) - -var _ flag.Value = (*FlagValue)(nil) - -// FlagValue implements the flag.Value interface and provides a mechanism for applying feature -// gate statuses to a Registry -type FlagValue map[string]bool - -// String returns a string representing the FlagValue -func (f FlagValue) String() string { - var t []string - for k, v := range f { - if v { - t = append(t, k) - } else { - t = append(t, "-"+k) - } - } - - // Sort the list of identifiers for consistent results - sort.Strings(t) - return strings.Join(t, ",") -} - -// Set applies the FlagValue encoded in the input string -func (f FlagValue) Set(s string) error { - if s == "" { - return nil - } - - ss := strings.Split(s, ",") - for _, v := range ss { - var id string - var val bool - switch v[0] { - case '-': - id = v[1:] - val = false - case '+': - id = v[1:] - val = true - default: - id = v - val = true - } - - if _, exists := f[id]; exists { - // If the status has already been set, ignore it - // This allows CLI flags, which are processed first - // to take precedence over config settings - continue - } - f[id] = val - } - - return nil -} diff --git a/vendor/go.opentelemetry.io/collector/featuregate/gate.go b/vendor/go.opentelemetry.io/collector/featuregate/gate.go index 6428de07d5c..2b6cae31e85 100644 --- a/vendor/go.opentelemetry.io/collector/featuregate/gate.go +++ b/vendor/go.opentelemetry.io/collector/featuregate/gate.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package featuregate // import "go.opentelemetry.io/collector/featuregate" @@ -19,12 +8,13 @@ import "sync/atomic" // Gate is an immutable object that is owned by the Registry and represents an individual feature that // may be enabled or disabled based on the lifecycle state of the feature and CLI flags specified by the user. type Gate struct { - id string - description string - referenceURL string - removalVersion string - stage Stage - enabled *atomic.Bool + id string + description string + referenceURL string + fromVersion string + toVersion string + stage Stage + enabled *atomic.Bool } // ID returns the id of the Gate. @@ -52,7 +42,12 @@ func (g *Gate) ReferenceURL() string { return g.referenceURL } -// RemovalVersion returns the removal version information for Gate's in StageStable. -func (g *Gate) RemovalVersion() string { - return g.removalVersion +// FromVersion returns the version information when the Gate's was added. +func (g *Gate) FromVersion() string { + return g.fromVersion +} + +// ToVersion returns the version information when Gate's in StageStable. +func (g *Gate) ToVersion() string { + return g.toVersion } diff --git a/vendor/go.opentelemetry.io/collector/featuregate/registry.go b/vendor/go.opentelemetry.io/collector/featuregate/registry.go index 8670f2d565e..ed6cf532e32 100644 --- a/vendor/go.opentelemetry.io/collector/featuregate/registry.go +++ b/vendor/go.opentelemetry.io/collector/featuregate/registry.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package featuregate // import "go.opentelemetry.io/collector/featuregate" @@ -62,11 +51,20 @@ func WithRegisterReferenceURL(url string) RegisterOption { }) } -// WithRegisterRemovalVersion is used when the Gate is considered StageStable, -// to inform users that referencing the gate is no longer needed. -func WithRegisterRemovalVersion(version string) RegisterOption { +// WithRegisterFromVersion is used to set the Gate "FromVersion". +// The "FromVersion" contains the Collector release when a feature is introduced. +func WithRegisterFromVersion(fromVersion string) RegisterOption { return registerOptionFunc(func(g *Gate) { - g.removalVersion = version + g.fromVersion = fromVersion + }) +} + +// WithRegisterToVersion is used to set the Gate "ToVersion". +// The "ToVersion", if not empty, contains the last Collector release in which you can still use a feature gate. +// If the feature stage is either "Deprecated" or "Stable", the "ToVersion" is the Collector release when the feature is removed. +func WithRegisterToVersion(toVersion string) RegisterOption { + return registerOptionFunc(func(g *Gate) { + g.toVersion = toVersion }) } @@ -89,7 +87,7 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga opt.apply(g) } switch g.stage { - case StageAlpha: + case StageAlpha, StageDeprecated: g.enabled = &atomic.Bool{} case StageBeta, StageStable: enabled := &atomic.Bool{} @@ -98,8 +96,8 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga default: return nil, fmt.Errorf("unknown stage value %q for gate %q", stage, id) } - if g.stage == StageStable && g.removalVersion == "" { - return nil, fmt.Errorf("no removal version set for stable gate %q", id) + if (g.stage == StageStable || g.stage == StageDeprecated) && g.toVersion == "" { + return nil, fmt.Errorf("no removal version set for %v gate %q", g.stage.String(), id) } if _, loaded := r.gates.LoadOrStore(id, g); loaded { return nil, fmt.Errorf("attempted to add pre-existing gate %q", id) @@ -111,13 +109,24 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga func (r *Registry) Set(id string, enabled bool) error { v, ok := r.gates.Load(id) if !ok { - return fmt.Errorf("no such feature gate -%v", id) + return fmt.Errorf("no such feature gate %q", id) } g := v.(*Gate) - if g.stage == StageStable { - return fmt.Errorf("feature gate %s is stable, can not be modified", id) + + switch g.stage { + case StageStable: + if !enabled { + return fmt.Errorf("feature gate %q is stable, can not be disabled", id) + } + fmt.Printf("Feature gate %q is stable and already enabled. It will be removed in version %v and continued use of the gate after version %v will result in an error.\n", id, g.toVersion, g.toVersion) + case StageDeprecated: + if enabled { + return fmt.Errorf("feature gate %q is deprecated, can not be enabled", id) + } + fmt.Printf("Feature gate %q is deprecated and already disabled. It will be removed in version %v and continued use of the gate after version %v will result in an error.\n", id, g.toVersion, g.toVersion) + default: + g.enabled.Store(enabled) } - g.enabled.Store(enabled) return nil } diff --git a/vendor/go.opentelemetry.io/collector/featuregate/stage.go b/vendor/go.opentelemetry.io/collector/featuregate/stage.go index 3508562ec05..f2be1b248d3 100644 --- a/vendor/go.opentelemetry.io/collector/featuregate/stage.go +++ b/vendor/go.opentelemetry.io/collector/featuregate/stage.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package featuregate // import "go.opentelemetry.io/collector/featuregate" @@ -23,16 +12,21 @@ const ( // // The Gate will be disabled by default. StageAlpha Stage = iota - // StageBeta is used when the feature flag is well tested and is enabled by default, + // StageBeta is used when the feature gate is well tested and is enabled by default, // but can be disabled by a Gate. // // The Gate will be enabled by default. StageBeta // StageStable is used when feature is permanently enabled and can not be disabled by a Gate. - // This value is used to provide feedback to the user that the gate will be removed in the next version. + // This value is used to provide feedback to the user that the gate will be removed in the next versions. // - // The Gate will be enabled by default and will return an error if modified. + // The Gate will be enabled by default and will return an error if disabled. StageStable + // StageDeprecated is used when feature is permanently disabled and can not be enabled by a Gate. + // This value is used to provide feedback to the user that the gate will be removed in the next versions. + // + // The Gate will be disabled by default and will return an error if modified. + StageDeprecated ) func (s Stage) String() string { @@ -43,6 +37,8 @@ func (s Stage) String() string { return "Beta" case StageStable: return "Stable" + case StageDeprecated: + return "Deprecated" } return "Unknown" } diff --git a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_resource.go b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_resource.go index ff15abb3702..1a9bc437647 100644 --- a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_resource.go +++ b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_resource.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. diff --git a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_trace.go b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_trace.go index 241cbfcb89f..7418019848c 100644 --- a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_trace.go +++ b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/generated_trace.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. diff --git a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/nonstandard.go b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/nonstandard.go index 5812cfafb3c..cea103bdf04 100644 --- a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/nonstandard.go +++ b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/nonstandard.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package semconv // import "go.opentelemetry.io/collector/semconv/v1.6.1" diff --git a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/schema.go b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/schema.go index 530fe151b79..589a94a053a 100644 --- a/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/schema.go +++ b/vendor/go.opentelemetry.io/collector/semconv/v1.6.1/schema.go @@ -1,16 +1,5 @@ // 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. +// SPDX-License-Identifier: Apache-2.0 package semconv // import "go.opentelemetry.io/collector/semconv/v1.6.1" diff --git a/vendor/modules.txt b/vendor/modules.txt index 1f2ba6c227d..cbb760b95b9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -773,10 +773,10 @@ github.com/oklog/run # github.com/oklog/ulid v1.3.1 ## explicit github.com/oklog/ulid -# github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.73.0 +# github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.81.0 ## explicit; go 1.19 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus -# github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.73.0 +# github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.73.0 => github.com/charleskorn/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.0.0-20230717033559-beffb82bb827 ## explicit; go 1.19 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite # github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e @@ -1090,7 +1090,7 @@ go.opencensus.io/trace go.opencensus.io/trace/internal go.opencensus.io/trace/propagation go.opencensus.io/trace/tracestate -# go.opentelemetry.io/collector/featuregate v0.73.0 +# go.opentelemetry.io/collector/featuregate v1.0.0-rcv0013 ## explicit; go 1.19 go.opentelemetry.io/collector/featuregate # go.opentelemetry.io/collector/pdata v1.0.0-rcv0013 @@ -1110,7 +1110,7 @@ go.opentelemetry.io/collector/pdata/internal/otlp go.opentelemetry.io/collector/pdata/pcommon go.opentelemetry.io/collector/pdata/pmetric go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp -# go.opentelemetry.io/collector/semconv v0.73.0 +# go.opentelemetry.io/collector/semconv v0.81.0 ## explicit; go 1.19 go.opentelemetry.io/collector/semconv/v1.6.1 # go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 @@ -1481,3 +1481,4 @@ sigs.k8s.io/yaml # github.com/grafana/regexp => github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6 # github.com/munnerz/goautoneg => github.com/charleskorn/goautoneg v0.0.0-20230303030534-7248a2f4c9cc # github.com/opentracing-contrib/go-stdlib => github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 +# github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite => github.com/charleskorn/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.0.0-20230717033559-beffb82bb827