Skip to content

Commit 1bb0469

Browse files
[service] Move batchprocessor metrics to normal level and update level guidelines (#12525)
#### Description This PR: - requires "level: normal" before outputting batch processor metrics (in addition to one specific metric which was already restricted to "level: detailed") - clarifies wording in the telemetry level guidelines and documentation, and adds said guidelines to the requirements for stable components. Some rationale for these changes can be found in the tracking issue and [this comment](#7890 (comment)). #### Link to tracking issue Resolves #7890 #### To be discussed Should we add a feature gate for this, in case a user relies on "level: basic" outputting batch processor metrics? This feels like a niche use case, so considering the "alpha" stability level of these metrics, I don't think it's really necessary. Considering batch processor metrics had already been switched to "normal" once (#9767), but were turned back to basic at some later point (not sure when), we might also want to add tests to avoid further regressions (especially as the handling of telemetry levels is bound to change further with #11754). --------- Co-authored-by: Dmitrii Anoshin <[email protected]>
1 parent a8b2be1 commit 1bb0469

File tree

5 files changed

+57
-22
lines changed

5 files changed

+57
-22
lines changed

.chloggen/telemetry-level-update.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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: breaking
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: Batch processor telemetry is no longer emitted at "basic" verbosity level
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [7890]
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+
According to the guidelines, basic-level telemetry should be reserved for core Collector APIs.
20+
Components such as the batch processor should emit telemetry starting from the "normal" level
21+
(which is also the default level).
22+
23+
Migration: If your Collector telemetry was set to `level: basic` and you want to keep seeing
24+
batch processor-related metrics, consider switching to `level: normal` instead.
25+
26+
27+
28+
# Optional: The change log or logs in which this entry should be included.
29+
# e.g. '[user]' or '[user, api]'
30+
# Include 'user' if the change is relevant to end users.
31+
# Include 'api' if there is a change to a library API.
32+
# Default: '[user]'
33+
change_logs: [user]

config/configtelemetry/configtelemetry.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
)
1111

1212
const (
13-
// LevelNone indicates that no telemetry data should be collected.
13+
// LevelNone indicates that no telemetry should be collected.
1414
LevelNone Level = iota - 1
15-
// LevelBasic is the recommended and covers the basics of the service telemetry.
15+
// LevelBasic indicates that only core Collector telemetry should be collected.
1616
LevelBasic
17-
// LevelNormal adds some other indicators on top of basic.
17+
// LevelNormal indicates that all low-overhead telemetry should be collected.
1818
LevelNormal
19-
// LevelDetailed adds dimensions and views to the previous levels.
19+
// LevelDetailed indicates that all available telemetry should be collected.
2020
LevelDetailed
2121

2222
levelNoneStr = "None"

config/configtelemetry/doc.go

+11-16
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,28 @@
1515
//
1616
// 2. configtelemetry.Basic
1717
//
18-
// Telemetry associated with this level provides essential coverage of the collector telemetry.
19-
// It should only be used for internal collector telemetry generated by the collector core API. Components outside of
20-
// the core API MUST NOT record additional telemetry at this level.
18+
// Telemetry associated with this level provides essential coverage of the Collector telemetry.
19+
// It should only be used for telemetry generated by the core Collector API.
20+
// Components outside of the core API MUST NOT record telemetry at this level.
2121
//
2222
// 3. configtelemetry.Normal
2323
//
24-
// Telemetry associated with this level provides complete coverage of the collector telemetry.
24+
// Telemetry associated with this level provides intermediate coverage of the Collector telemetry.
2525
// It should be the default for component authors.
2626
//
27-
// Component authors using this telemetry level can use this guidance:
28-
//
29-
// - The signals associated with this level must control cardinality.
30-
// It is acceptable at this level for cardinality to scale linearly with the monitored resources.
31-
//
32-
// - The signals associated with this level must represent a controlled data volume. Examples follow:
27+
// Normal-level telemetry should have limited cardinality and data volume, though it is acceptable
28+
// for them to scale linearly with the monitored resources.
29+
// For example, there may be a limit of 5 attribute sets or 5 spans generated per request.
3330
//
34-
// a. A max cardinality (total possible combinations of dimension values) for a given metric of at most 100.
35-
//
36-
// b. At most 5 spans actively recording simultaneously per active request.
31+
// Normal-level telemetry should also have a low computational cost: it should not contain values
32+
// requiring significant additional computation compared to the normal flow of processing.
3733
//
3834
// This is the default level recommended when running the Collector.
3935
//
4036
// 4. configtelemetry.Detailed
4137
//
4238
// Telemetry associated with this level provides complete coverage of the collector telemetry.
4339
//
44-
// The signals associated with this level may exhibit high cardinality and/or high dimensionality.
45-
//
46-
// There is no limit on data volume.
40+
// The signals associated with this level may exhibit high cardinality, high data volume, or high
41+
// computational cost.
4742
package configtelemetry // import "go.opentelemetry.io/collector/config/configtelemetry"

docs/component-stability.md

+3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ If data can be dropped/created/held at multiple distinct points in a component's
214214
scraping, validation, processing, etc.), it is recommended to define additional attributes to help
215215
diagnose the specific source of the discrepancy, or to define different signals for each.
216216

217+
The breakdown of emitted telemetry per telemetry level (basic / normal / detailed) should follow
218+
the guidelines in [the Go package documentation for `configtelemetry`](/config/configtelemetry/doc.go).
219+
217220
### Deprecated
218221

219222
The component is planned to be removed in a future version and no further support will be provided. Note that new issues will likely not be worked on. When a component enters "deprecated" mode, it is expected to exist for at least two minor releases. See the component's readme file for more details on when a component will cease to exist.

service/service.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,12 @@ func configureViews(level configtelemetry.Level) []config.View {
509509
}
510510

511511
// Batch processor metrics
512-
if level < configtelemetry.LevelDetailed {
513-
scope := ptr("go.opentelemetry.io/collector/processor/batchprocessor")
512+
scope := ptr("go.opentelemetry.io/collector/processor/batchprocessor")
513+
if level < configtelemetry.LevelNormal {
514+
views = append(views, dropViewOption(&config.ViewSelector{
515+
MeterName: scope,
516+
}))
517+
} else if level < configtelemetry.LevelDetailed {
514518
views = append(views, dropViewOption(&config.ViewSelector{
515519
MeterName: scope,
516520
InstrumentName: ptr("otelcol_processor_batch_batch_send_size_bytes"),

0 commit comments

Comments
 (0)