Skip to content

Commit 050a339

Browse files
authored
Merge branch 'main' into codeboten/mark-semconv-deprecated
2 parents 46031c5 + f846829 commit 050a339

29 files changed

+1321
-144
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: service
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add item count metrics defined in Pipeline Component Telemetry RFC
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12812]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
See [Pipeline Component Telemetry RFC](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/component-universal-telemetry.md) for more details:
20+
- `otelcol.receiver.produced.items`
21+
- `otelcol.processor.consumed.items`
22+
- `otelcol.processor.produced.items`
23+
- `otelcol.connector.consumed.items`
24+
- `otelcol.connector.produced.items`
25+
- `otelcol.exporter.consumed.items`
26+
27+
# Optional: The change log or logs in which this entry should be included.
28+
# e.g. '[user]' or '[user, api]'
29+
# Include 'user' if the change is relevant to end users.
30+
# Include 'api' if there is a change to a library API.
31+
# Default: '[user]'
32+
change_logs: []

cmd/mdatagen/internal/metric.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ type Metric struct {
5959

6060
// Attributes is the list of attributes that the metric emits.
6161
Attributes []AttributeName `mapstructure:"attributes"`
62+
63+
// Override the default prefix for the metric name.
64+
Prefix string `mapstructure:"prefix"`
6265
}
6366

6467
type Stability struct {

cmd/mdatagen/internal/templates/documentation.md.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{{- $metricName := . }}
3939
{{- $metric := $metricName | telemetryInfo -}}
4040

41-
### otelcol_{{ $metricName }}
41+
### {{ if $metric.Prefix -}}{{ $metric.Prefix }}{{- else -}}otelcol_{{- end -}}{{ $metricName }}
4242

4343
{{ $metric.Description }}{{ $metric.Stability }}
4444

cmd/mdatagen/internal/templates/telemetry.go.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...Teleme
136136

137137
{{- range $name, $metric := .Telemetry.Metrics }}
138138
builder.{{ $name.Render }}, err = builder.meter.{{ $metric.Data.Instrument }}(
139+
{{ if $metric.Prefix -}}
140+
"{{ $metric.Prefix }}{{ $name }}",
141+
{{ else -}}
139142
"otelcol_{{ $name }}",
143+
{{ end -}}
140144
metric.WithDescription("{{ $metric.Description }}{{ $metric.Stability }}"),
141145
metric.WithUnit("{{ $metric.Unit }}"),
142146
{{ if eq $metric.Data.Type "Histogram" -}}

cmd/mdatagen/internal/templates/telemetrytest.go.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ return set
3232

3333
func AssertEqual{{ $name.Render }}(t *testing.T, tt *componenttest.Telemetry, dps []metricdata.{{- if eq $metric.Data.Type "Histogram" }} {{$metric.Data.Type}} {{- end }}DataPoint[{{ $metric.Data.BasicType }}], opts ...metricdatatest.Option) {
3434
want := metricdata.Metrics{
35+
{{ if $metric.Prefix -}}
36+
Name: "{{ $metric.Prefix }}{{ $name }}",
37+
{{ else -}}
3538
Name: "otelcol_{{ $name }}",
39+
{{ end -}}
3640
Description: "{{ $metric.Description }}{{ $metric.Stability }}",
3741
Unit: "{{ $metric.Unit }}",
3842
Data: metricdata.{{ $metric.Data.Type }}[{{ $metric.Data.BasicType }}]{
@@ -45,7 +49,11 @@ func AssertEqual{{ $name.Render }}(t *testing.T, tt *componenttest.Telemetry, dp
4549
DataPoints: dps,
4650
},
4751
}
52+
{{ if $metric.Prefix -}}
53+
got, err := tt.GetMetric("{{ $metric.Prefix }}{{ $name }}")
54+
{{ else -}}
4855
got, err := tt.GetMetric("otelcol_{{ $name }}")
56+
{{ end -}}
4957
require.NoError(t, err)
5058
metricdatatest.AssertEqual(t, want, got, opts...)
5159
}

docs/component-stability.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ components apply to stable when it comes to configuration changes.
8989

9090
#### Testing requirements
9191

92-
Stable components MUST have a test coverage that exceeds the highest between 80% coverage and the
93-
repository-wide minimum. The unit test suite SHOULD cover all configuration options. The coverage
94-
MUST be shown as part of the component documentation.
95-
96-
Stable components SHOULD provide at least one example configuration that works for each stable
97-
signal, and have at least one lifecycle test that tests the component's initialization with a valid
98-
configuration. Said configuration should also be shown in the component documentation.
92+
Stable components MUST have a comprehensive test suite. In particular they MUST have:
93+
1. A **test coverage** that exceeds the highest between 80% coverage and the repository-wide
94+
minimum. The unit test suite SHOULD cover all configuration options. The coverage MUST be shown as
95+
part of the component documentation.
96+
2. At least one **lifecycle test** that tests the component's initialization with a valid
97+
configuration and ensures proper context propagation if applicable.
98+
3. At least one **benchmark test** for each stable signal. The component's documentation MUST
99+
include a link to the latest run of benchmark results.
99100

100101
#### Documentation requirements
101102

@@ -108,6 +109,9 @@ Stable components should have a complete set of documentation, including:
108109
what they provide.
109110
- Compatibility guarantees with external dependencies including the versions it is compatible with
110111
and under what conditions.
112+
- Guidance related to the component's usage in production environments, including how to scale a deployment of this component properly if it needs special considerations.
113+
- If stateful, how to configure the component to use persistent storage and how to gracefully
114+
shutdown and restart the component.
111115
- Warnings about known limitations and ways to misuse the component.
112116

113117
Receivers that produce a fixed set of telemetry should document the telemetry they produce,
@@ -300,6 +304,7 @@ To graduate any signal from alpha to beta on a component:
300304

301305
To graduate any signal from beta to stable on a component:
302306
1. The component MUST have at least three active code owners.
307+
2. The component benchmark results MUST have been updated within the last 30 days and published in the component's README.
303308
3. Within the 60 days prior to the graduation request, the code owners MUST have reviewed and
304309
replied to at least 80% of the issues and pull requests opened against the component. This
305310
excludes general PRs or issues that are not specific to the component itself (e.g. repo-wide API

service/documentation.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@
66

77
The following telemetry is emitted by this component.
88

9+
### otelcol.connector.consumed.items
10+
11+
Number of items passed to the connector.
12+
13+
| Unit | Metric Type | Value Type | Monotonic |
14+
| ---- | ----------- | ---------- | --------- |
15+
| {item} | Sum | Int | true |
16+
17+
### otelcol.connector.produced.items
18+
19+
Number of items emitted from the connector.
20+
21+
| Unit | Metric Type | Value Type | Monotonic |
22+
| ---- | ----------- | ---------- | --------- |
23+
| {item} | Sum | Int | true |
24+
25+
### otelcol.exporter.consumed.items
26+
27+
Number of items passed to the exporter.
28+
29+
| Unit | Metric Type | Value Type | Monotonic |
30+
| ---- | ----------- | ---------- | --------- |
31+
| {item} | Sum | Int | true |
32+
933
### otelcol_process_cpu_seconds
1034

1135
Total CPU user and system time in seconds [alpha]
@@ -53,3 +77,27 @@ Uptime of the process [alpha]
5377
| Unit | Metric Type | Value Type | Monotonic |
5478
| ---- | ----------- | ---------- | --------- |
5579
| s | Sum | Double | true |
80+
81+
### otelcol.processor.consumed.items
82+
83+
Number of items passed to the processor.
84+
85+
| Unit | Metric Type | Value Type | Monotonic |
86+
| ---- | ----------- | ---------- | --------- |
87+
| {item} | Sum | Int | true |
88+
89+
### otelcol.processor.produced.items
90+
91+
Number of items emitted from the processor.
92+
93+
| Unit | Metric Type | Value Type | Monotonic |
94+
| ---- | ----------- | ---------- | --------- |
95+
| {item} | Sum | Int | true |
96+
97+
### otelcol.receiver.produced.items
98+
99+
Number of items emitted from the receiver.
100+
101+
| Unit | Metric Type | Value Type | Monotonic |
102+
| ---- | ----------- | ---------- | --------- |
103+
| {item} | Sum | Int | true |

0 commit comments

Comments
 (0)