From a85ace8a22854ea4efa9882667f370fd689f666b Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 22 Jul 2024 06:36:45 -0700 Subject: [PATCH 1/6] [chore] fix typo (#10680) --- service/internal/graph/graph_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index d3a0984527a..6c1ffc0aab7 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -2084,7 +2084,7 @@ func TestGraphBuildErrors(t *testing.T) { } } -// This includes all tests from the previous implmentation, plus a new one +// This includes all tests from the previous implementation, plus a new one // relevant only to the new graph-based implementation. func TestGraphFailToStartAndShutdown(t *testing.T) { errReceiverFactory := newErrReceiverFactory() From d628b963a59b6aadf52730a1652bcb396e6686f2 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 22 Jul 2024 06:43:57 -0700 Subject: [PATCH 2/6] [chore] adding minimal test for attributes (#10666) This isn't as good as emitting telemetry w/ the service but at least it ensures resource attributes are set. Follow up to https://github.com/open-telemetry/opentelemetry-collector/pull/10490 and https://github.com/open-telemetry/opentelemetry-collector/pull/10645 Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- service/telemetry/tracer.go | 10 ++++-- service/telemetry/tracer_test.go | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 service/telemetry/tracer_test.go diff --git a/service/telemetry/tracer.go b/service/telemetry/tracer.go index 65f49606514..4434af2fc74 100644 --- a/service/telemetry/tracer.go +++ b/service/telemetry/tracer.go @@ -25,8 +25,7 @@ var ( errUnsupportedPropagator = errors.New("unsupported trace propagator") ) -// New creates a new Telemetry from Config. -func newTracerProvider(ctx context.Context, set Settings, cfg Config) (trace.TracerProvider, error) { +func attributes(set Settings, cfg Config) map[string]interface{} { attrs := map[string]interface{}{ string(semconv.ServiceNameKey): set.BuildInfo.Command, string(semconv.ServiceVersionKey): set.BuildInfo.Version, @@ -41,10 +40,15 @@ func newTracerProvider(ctx context.Context, set Settings, cfg Config) (trace.Tra delete(attrs, k) } } + return attrs +} + +// New creates a new Telemetry from Config. +func newTracerProvider(ctx context.Context, set Settings, cfg Config) (trace.TracerProvider, error) { sch := semconv.SchemaURL res := config.Resource{ SchemaUrl: &sch, - Attributes: attrs, + Attributes: attributes(set, cfg), } sdk, err := config.NewSDK( diff --git a/service/telemetry/tracer_test.go b/service/telemetry/tracer_test.go new file mode 100644 index 00000000000..6a86d284b58 --- /dev/null +++ b/service/telemetry/tracer_test.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/collector/service/telemetry" + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/service/telemetry/internal" +) + +func TestAttributes(t *testing.T) { + tests := []struct { + name string + cfg Config + buildInfo component.BuildInfo + wantAttributes map[string]interface{} + }{ + { + name: "no build info and no resource config", + cfg: Config{}, + wantAttributes: map[string]interface{}{"service.name": "", "service.version": ""}, + }, + { + name: "build info and no resource config", + cfg: Config{}, + buildInfo: component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"}, + wantAttributes: map[string]interface{}{"service.name": "otelcoltest", "service.version": "0.0.0-test"}, + }, + { + name: "no build info and resource config", + cfg: Config{Resource: map[string]*string{"service.name": ptr("resource.name"), "service.version": ptr("resource.version"), "test": ptr("test")}}, + wantAttributes: map[string]interface{}{"service.name": "resource.name", "service.version": "resource.version", "test": "test"}, + }, + { + name: "build info and resource config", + buildInfo: component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"}, + cfg: Config{Resource: map[string]*string{"service.name": ptr("resource.name"), "service.version": ptr("resource.version"), "test": ptr("test")}}, + wantAttributes: map[string]interface{}{"service.name": "resource.name", "service.version": "resource.version", "test": "test"}, + }, + { + name: "deleting a nil value", + buildInfo: component.BuildInfo{Command: "otelcoltest", Version: "0.0.0-test"}, + cfg: Config{Resource: map[string]*string{"service.name": nil, "service.version": ptr("resource.version"), "test": ptr("test")}}, + wantAttributes: map[string]interface{}{"service.version": "resource.version", "test": "test"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + attrs := attributes(internal.Settings{BuildInfo: tt.buildInfo}, tt.cfg) + require.Equal(t, tt.wantAttributes, attrs) + }) + } +} + +func ptr[T any](v T) *T { + return &v +} From a09ec9308de796d108111404f2b4900d1a89ef05 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 22 Jul 2024 07:48:40 -0700 Subject: [PATCH 3/6] [receiverhelper] Update metric units (#10657) #### Description `1` isn't an informative unit for metrics, this should clarify their units. #### Link to tracking issue Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/10650 --- .chloggen/receiverhelper_metric_units.yaml | 25 +++++++++++++++++++ receiver/receiverhelper/documentation.md | 12 ++++----- .../internal/metadata/generated_telemetry.go | 12 ++++----- receiver/receiverhelper/metadata.yaml | 12 ++++----- 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 .chloggen/receiverhelper_metric_units.yaml diff --git a/.chloggen/receiverhelper_metric_units.yaml b/.chloggen/receiverhelper_metric_units.yaml new file mode 100644 index 00000000000..3f06210459e --- /dev/null +++ b/.chloggen/receiverhelper_metric_units.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: receiverhelper + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Update units for internal telemetry + +# One or more tracking issues or pull requests related to the change +issues: [10650] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/receiver/receiverhelper/documentation.md b/receiver/receiverhelper/documentation.md index d3990dfe998..55e8657e6e0 100644 --- a/receiver/receiverhelper/documentation.md +++ b/receiver/receiverhelper/documentation.md @@ -12,7 +12,7 @@ Number of log records successfully pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_receiver_accepted_metric_points @@ -20,7 +20,7 @@ Number of metric points successfully pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_receiver_accepted_spans @@ -28,7 +28,7 @@ Number of spans successfully pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | ### otelcol_receiver_refused_log_records @@ -36,7 +36,7 @@ Number of log records that could not be pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_receiver_refused_metric_points @@ -44,7 +44,7 @@ Number of metric points that could not be pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_receiver_refused_spans @@ -52,4 +52,4 @@ Number of spans that could not be pushed into the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry.go b/receiver/receiverhelper/internal/metadata/generated_telemetry.go index bb2ed6c7d1b..8e0b5a8455a 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry.go @@ -60,37 +60,37 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ReceiverAcceptedLogRecords, err = builder.meter.Int64Counter( "otelcol_receiver_accepted_log_records", metric.WithDescription("Number of log records successfully pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ReceiverAcceptedMetricPoints, err = builder.meter.Int64Counter( "otelcol_receiver_accepted_metric_points", metric.WithDescription("Number of metric points successfully pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ReceiverAcceptedSpans, err = builder.meter.Int64Counter( "otelcol_receiver_accepted_spans", metric.WithDescription("Number of spans successfully pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) builder.ReceiverRefusedLogRecords, err = builder.meter.Int64Counter( "otelcol_receiver_refused_log_records", metric.WithDescription("Number of log records that could not be pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ReceiverRefusedMetricPoints, err = builder.meter.Int64Counter( "otelcol_receiver_refused_metric_points", metric.WithDescription("Number of metric points that could not be pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ReceiverRefusedSpans, err = builder.meter.Int64Counter( "otelcol_receiver_refused_spans", metric.WithDescription("Number of spans that could not be pushed into the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) return &builder, errs diff --git a/receiver/receiverhelper/metadata.yaml b/receiver/receiverhelper/metadata.yaml index db8dec36922..373b6838262 100644 --- a/receiver/receiverhelper/metadata.yaml +++ b/receiver/receiverhelper/metadata.yaml @@ -12,7 +12,7 @@ telemetry: receiver_accepted_spans: enabled: true description: Number of spans successfully pushed into the pipeline. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -20,7 +20,7 @@ telemetry: receiver_refused_spans: enabled: true description: Number of spans that could not be pushed into the pipeline. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -28,7 +28,7 @@ telemetry: receiver_accepted_metric_points: enabled: true description: Number of metric points successfully pushed into the pipeline. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -36,7 +36,7 @@ telemetry: receiver_refused_metric_points: enabled: true description: Number of metric points that could not be pushed into the pipeline. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -44,7 +44,7 @@ telemetry: receiver_accepted_log_records: enabled: true description: Number of log records successfully pushed into the pipeline. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true @@ -52,7 +52,7 @@ telemetry: receiver_refused_log_records: enabled: true description: Number of log records that could not be pushed into the pipeline. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true \ No newline at end of file From f085ac42b7076c051e1909805b626ecbd39ab4c0 Mon Sep 17 00:00:00 2001 From: Ankit Patel <8731662+ankitpatel96@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:06:50 -0400 Subject: [PATCH 4/6] [chore] Improve docs for server-like receivers in kubernetes and docker (#10562) Improves the docs on how to setup networking in common environments now that the collector binds to localhost by default. #### Link to tracking issue Fixes #10548 #### Testing Tested the Kubernetes setup on a cluster --- docs/security-best-practices.md | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/docs/security-best-practices.md b/docs/security-best-practices.md index 8c57d09ebc9..a4bd7fdcb14 100644 --- a/docs/security-best-practices.md +++ b/docs/security-best-practices.md @@ -153,6 +153,109 @@ To change the default endpoint to be `localhost`-bound in all components, enable If `localhost` resolves to a different IP due to your DNS settings then explicitly use the loopback IP instead: `127.0.0.1` for IPv4 or `::1` for IPv6. In IPv6 setups, ensure your system supports both IPv4 and IPv6 loopback addresses to avoid issues. +Using `localhost` may not work in environments like Docker, Kubernetes, and other environments that have non-standard networking setups. We've documented a few working example setups for the OTLP receiver gRPC endpoint below, but other receivers and other Collector components may need similar configuration. + +#### Docker +You can run the Collector in Docker by binding to the correct address. An OTLP exporter in Docker might look something like this: + +Collector config file + +`config.yaml`: +```yaml +receivers: + otlp: + protocols: + grpc: + endpoint: my-hostname:4317 # the same hostname from your docker run command +``` +Docker run command: +`docker run --hostname my-hostname --name container-name -p 127.0.0.1:4567:4317 otel/opentelemetry-collector:0.104.0` + +The key here is using the `--hostname` argument - that allows the collector to bind to the `my-hostname` address. +You could access it from outside that Docker network (for example on a regular program running on the host) by connecting to `127.0.0.1:4567`. + +#### Docker Compose +Similarly to plain Docker, you can run the Collector in Docker by binding to the correct address. + +`compose.yaml`: +```yaml +services: + otel-collector: + image: otel/opentelemetry-collector-contrib:0.104.0 + ports: + - "4567:4317" +``` + +Collector config file: + +`config.yaml`: +```yaml +receivers: + otlp: + protocols: + grpc: + endpoint: otel-collector:4317 # Using the service name from your Docker compose file +``` + +You can connect to this Collector from another Docker container running in the same network by connecting to `otel-collector:4317`. You could access it from outside that Docker network (for example on a regular program running on the host) by connecting to `127.0.0.1:4567`. + +#### Kubernetes +If you run the Collector as a `Daemonset`, you can use a configuration like below: +```yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: collector +spec: + selector: + matchLabels: + name: collector + template: + metadata: + labels: + name: collector + spec: + containers: + - name: collector + image: otel/opentelemetry-collector:0.104.0 + ports: + - containerPort: 4317 + hostPort: 4317 + protocol: TCP + name: otlp-grpc + - containerPort: 4318 + hostPort: 4318 + protocol: TCP + name: otlp-http + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + +``` +In this example, we use the [Kubernetes Downward API](https://kubernetes.io/docs/concepts/workloads/pods/downward-api/) to get your own Pod IP, then bind to that network interface. Then, we use the `hostPort` option to ensure that the Collector is exposed on the host. The Collector's config should look something like: + +```yaml +receivers: + otlp: + protocols: + grpc: + endpoint: ${env:MY_POD_IP}:4317 + http: + endpoint: ${env:MY_POD_IP}:4318 +``` + +You can send OTLP data to this Collector from any Pod on the Node by accessing `${MY_HOST_IP}:4317` to send OTLP over gRPC and `${MY_HOST_IP}:4318` to send OTLP over HTTP, where `MY_HOST_IP` is the Node's IP address. You can get this IP from the Downwards API: + +```yaml +env: + - name: MY_HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP +``` + ## Processors Processors sit between receivers and exporters. They are responsible for From 63157855b856e9632275c6b1f617e65bf226b4a5 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 22 Jul 2024 09:36:27 -0700 Subject: [PATCH 5/6] [scraperhelper] Update metric units (#10656) #### Description `1` isn't an informative unit for metrics, this clarifies the unit. #### Link to tracking issue Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/10649 --- .chloggen/scraperhelper_metric_units.yaml | 25 +++++++++++++++++++ receiver/scraperhelper/documentation.md | 4 +-- .../internal/metadata/generated_telemetry.go | 4 +-- receiver/scraperhelper/metadata.yaml | 4 +-- 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 .chloggen/scraperhelper_metric_units.yaml diff --git a/.chloggen/scraperhelper_metric_units.yaml b/.chloggen/scraperhelper_metric_units.yaml new file mode 100644 index 00000000000..3e754f6a991 --- /dev/null +++ b/.chloggen/scraperhelper_metric_units.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: scraperhelper + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Update units for internal telemetry + +# One or more tracking issues or pull requests related to the change +issues: [10649] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/receiver/scraperhelper/documentation.md b/receiver/scraperhelper/documentation.md index a582be9c5f1..56ad47a5105 100644 --- a/receiver/scraperhelper/documentation.md +++ b/receiver/scraperhelper/documentation.md @@ -12,7 +12,7 @@ Number of metric points that were unable to be scraped. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_scraper_scraped_metric_points @@ -20,4 +20,4 @@ Number of metric points successfully scraped. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry.go b/receiver/scraperhelper/internal/metadata/generated_telemetry.go index a366c7436fb..98cf15f4123 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry.go @@ -56,13 +56,13 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ScraperErroredMetricPoints, err = builder.meter.Int64Counter( "otelcol_scraper_errored_metric_points", metric.WithDescription("Number of metric points that were unable to be scraped."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ScraperScrapedMetricPoints, err = builder.meter.Int64Counter( "otelcol_scraper_scraped_metric_points", metric.WithDescription("Number of metric points successfully scraped."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) return &builder, errs diff --git a/receiver/scraperhelper/metadata.yaml b/receiver/scraperhelper/metadata.yaml index 8cf497fcd2c..b5a2e34efcb 100644 --- a/receiver/scraperhelper/metadata.yaml +++ b/receiver/scraperhelper/metadata.yaml @@ -12,7 +12,7 @@ telemetry: scraper_scraped_metric_points: enabled: true description: Number of metric points successfully scraped. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -20,7 +20,7 @@ telemetry: scraper_errored_metric_points: enabled: true description: Number of metric points that were unable to be scraped. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true \ No newline at end of file From 9ef6356835b5dfb784f47f4455854136af3bac85 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:55:31 -0700 Subject: [PATCH 6/6] [processorhelper] update units for metrics (#10647) This updates units for processhelper's internal telemetry. Related #10556 Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/10651 For this PR i updated `metadata.yaml` and ran `make gogenerate`, then `make -C processor test` --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- ...odeboten_update-units-processorhelper.yaml | 25 +++++++++++++++++++ processor/processorhelper/documentation.md | 24 +++++++++--------- .../internal/metadata/generated_telemetry.go | 24 +++++++++--------- processor/processorhelper/metadata.yaml | 24 +++++++++--------- 4 files changed, 61 insertions(+), 36 deletions(-) create mode 100644 .chloggen/codeboten_update-units-processorhelper.yaml diff --git a/.chloggen/codeboten_update-units-processorhelper.yaml b/.chloggen/codeboten_update-units-processorhelper.yaml new file mode 100644 index 00000000000..c352ec40509 --- /dev/null +++ b/.chloggen/codeboten_update-units-processorhelper.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: processorhelper + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: update units for internal telemetry + +# One or more tracking issues or pull requests related to the change +issues: [10647] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/processor/processorhelper/documentation.md b/processor/processorhelper/documentation.md index 8ba4455fd1d..6091e8385a9 100644 --- a/processor/processorhelper/documentation.md +++ b/processor/processorhelper/documentation.md @@ -12,7 +12,7 @@ Number of log records successfully pushed into the next component in the pipelin | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_processor_accepted_metric_points @@ -20,7 +20,7 @@ Number of metric points successfully pushed into the next component in the pipel | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_processor_accepted_spans @@ -28,7 +28,7 @@ Number of spans successfully pushed into the next component in the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | ### otelcol_processor_dropped_log_records @@ -36,7 +36,7 @@ Number of log records that were dropped. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_processor_dropped_metric_points @@ -44,7 +44,7 @@ Number of metric points that were dropped. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_processor_dropped_spans @@ -52,7 +52,7 @@ Number of spans that were dropped. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | ### otelcol_processor_inserted_log_records @@ -60,7 +60,7 @@ Number of log records that were inserted. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_processor_inserted_metric_points @@ -68,7 +68,7 @@ Number of metric points that were inserted. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_processor_inserted_spans @@ -76,7 +76,7 @@ Number of spans that were inserted. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | ### otelcol_processor_refused_log_records @@ -84,7 +84,7 @@ Number of log records that were rejected by the next component in the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {records} | Sum | Int | true | ### otelcol_processor_refused_metric_points @@ -92,7 +92,7 @@ Number of metric points that were rejected by the next component in the pipeline | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {datapoints} | Sum | Int | true | ### otelcol_processor_refused_spans @@ -100,4 +100,4 @@ Number of spans that were rejected by the next component in the pipeline. | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {spans} | Sum | Int | true | diff --git a/processor/processorhelper/internal/metadata/generated_telemetry.go b/processor/processorhelper/internal/metadata/generated_telemetry.go index 337413c2db7..6c145bb65cd 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry.go @@ -66,73 +66,73 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorAcceptedLogRecords, err = builder.meter.Int64Counter( "otelcol_processor_accepted_log_records", metric.WithDescription("Number of log records successfully pushed into the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ProcessorAcceptedMetricPoints, err = builder.meter.Int64Counter( "otelcol_processor_accepted_metric_points", metric.WithDescription("Number of metric points successfully pushed into the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ProcessorAcceptedSpans, err = builder.meter.Int64Counter( "otelcol_processor_accepted_spans", metric.WithDescription("Number of spans successfully pushed into the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) builder.ProcessorDroppedLogRecords, err = builder.meter.Int64Counter( "otelcol_processor_dropped_log_records", metric.WithDescription("Number of log records that were dropped."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ProcessorDroppedMetricPoints, err = builder.meter.Int64Counter( "otelcol_processor_dropped_metric_points", metric.WithDescription("Number of metric points that were dropped."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ProcessorDroppedSpans, err = builder.meter.Int64Counter( "otelcol_processor_dropped_spans", metric.WithDescription("Number of spans that were dropped."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) builder.ProcessorInsertedLogRecords, err = builder.meter.Int64Counter( "otelcol_processor_inserted_log_records", metric.WithDescription("Number of log records that were inserted."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ProcessorInsertedMetricPoints, err = builder.meter.Int64Counter( "otelcol_processor_inserted_metric_points", metric.WithDescription("Number of metric points that were inserted."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ProcessorInsertedSpans, err = builder.meter.Int64Counter( "otelcol_processor_inserted_spans", metric.WithDescription("Number of spans that were inserted."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) builder.ProcessorRefusedLogRecords, err = builder.meter.Int64Counter( "otelcol_processor_refused_log_records", metric.WithDescription("Number of log records that were rejected by the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{records}"), ) errs = errors.Join(errs, err) builder.ProcessorRefusedMetricPoints, err = builder.meter.Int64Counter( "otelcol_processor_refused_metric_points", metric.WithDescription("Number of metric points that were rejected by the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{datapoints}"), ) errs = errors.Join(errs, err) builder.ProcessorRefusedSpans, err = builder.meter.Int64Counter( "otelcol_processor_refused_spans", metric.WithDescription("Number of spans that were rejected by the next component in the pipeline."), - metric.WithUnit("1"), + metric.WithUnit("{spans}"), ) errs = errors.Join(errs, err) return &builder, errs diff --git a/processor/processorhelper/metadata.yaml b/processor/processorhelper/metadata.yaml index a1baa27827d..95acaf640b8 100644 --- a/processor/processorhelper/metadata.yaml +++ b/processor/processorhelper/metadata.yaml @@ -12,7 +12,7 @@ telemetry: processor_accepted_spans: enabled: true description: Number of spans successfully pushed into the next component in the pipeline. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -20,7 +20,7 @@ telemetry: processor_refused_spans: enabled: true description: Number of spans that were rejected by the next component in the pipeline. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -28,7 +28,7 @@ telemetry: processor_dropped_spans: enabled: true description: Number of spans that were dropped. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -36,7 +36,7 @@ telemetry: processor_inserted_spans: enabled: true description: Number of spans that were inserted. - unit: "1" + unit: "{spans}" sum: value_type: int monotonic: true @@ -44,7 +44,7 @@ telemetry: processor_accepted_metric_points: enabled: true description: Number of metric points successfully pushed into the next component in the pipeline. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -52,7 +52,7 @@ telemetry: processor_refused_metric_points: enabled: true description: Number of metric points that were rejected by the next component in the pipeline. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -60,7 +60,7 @@ telemetry: processor_dropped_metric_points: enabled: true description: Number of metric points that were dropped. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -68,7 +68,7 @@ telemetry: processor_inserted_metric_points: enabled: true description: Number of metric points that were inserted. - unit: "1" + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -76,7 +76,7 @@ telemetry: processor_accepted_log_records: enabled: true description: Number of log records successfully pushed into the next component in the pipeline. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true @@ -84,7 +84,7 @@ telemetry: processor_refused_log_records: enabled: true description: Number of log records that were rejected by the next component in the pipeline. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true @@ -92,7 +92,7 @@ telemetry: processor_dropped_log_records: enabled: true description: Number of log records that were dropped. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true @@ -100,7 +100,7 @@ telemetry: processor_inserted_log_records: enabled: true description: Number of log records that were inserted. - unit: "1" + unit: "{records}" sum: value_type: int monotonic: true