You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[connector/spanmetrics] Discard counter span metric exemplars after flushing (#32210)
**Description:**
Discard counter span metric exemplars after flushing to avoid unbounded
memory growth when exemplars are enabled.
This is needed because #28671 added exemplars to counter span metrics,
but they are not removed after each flush interval like they are for
histogram span metrics.
Note: this may change behaviour if using the undocumented
`exemplars.max_per_data_point` configuration option, since exemplars
would no longer be accumulated up until that count. However, i'm unclear
on the value of that feature since there's no mechanism to replace old
exemplars with newer ones once the maximum is reached. Maybe a follow-up
enhancement is only discarding exemplars once the maximum is reached, or
using a circular buffer to replace them. That could be useful for
pull-based exporters like `prometheusexporter`, as retaining exemplars
for longer would decrease the chance of them getting discarded before
being scraped.
**Link to tracking Issue:**
Closes#31683
**Testing:**
- Unit tests
- Running the collector and setting a breakpoint to verify the exemplars
are being cleared in-between flushes. Before the change I could see the
exemplar count continually growing
**Documentation:** <Describe the documentation added.>
Updated the documentation to mention that exemplars are added to all
span metrics. Also mentioned when they are discarded
Copy file name to clipboardExpand all lines: connector/spanmetricsconnector/README.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -114,8 +114,8 @@ The following settings can be optionally configured:
114
114
-`namespace`: Defines the namespace of the generated metrics. If `namespace` provided, generated metric name will be added `namespace.` prefix.
115
115
-`metrics_flush_interval` (default: `60s`): Defines the flush interval of the generated metrics.
116
116
-`metrics_expiration` (default: `0`): Defines the expiration time as `time.Duration`, after which, if no new spans are received, metrics will no longer be exported. Setting to `0` means the metrics will never expire (default behavior).
117
-
-`exemplars`: Use to configure how to attach exemplars to histograms
118
-
-`enabled` (default: `false`): enabling will add spans as Exemplars.
117
+
-`exemplars`: Use to configure how to attach exemplars to metrics.
118
+
-`enabled` (default: `false`): enabling will add spans as Exemplars to all metrics. Exemplars are only kept for one flush interval.
119
119
-`events`: Use to configure the events metric.
120
120
-`enabled`: (default: `false`): enabling will add the events metric.
121
121
-`dimensions`: (mandatory if `enabled`) the list of the span's event attributes to add as dimensions to the events metric, which will be included _on top of_ the common and configured `dimensions` for span and resource attributes.
0 commit comments