Commit aef9425
authored
[receiver/prometheusreceiver] fix stalness tracking (#43925)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
In the dependency upgrade #43890 there was the PR
prometheus/prometheus#16429 which changed the
provisions for staleness tracking. Now the code only does the tracking
if the series was successfully appended in storage. This is indicated by
a non zero storage reference returned by the appender.
Since we used to return 0 in all cases, the staleness tracking is now
broken.
Solution is to return a fake reference of 1, just to indicate success.
Alternative solution would be to make a unique reference for each series
label set, but that incurs an overhead which we can avoid.
Performance impact: probably small as the cache should be stable over
time - unless targets churn a lot between receiver instances.
Resource utilization: +1 hashmap with series identifier (name+labels)
pointing to cache entries. Size related to number of series. `addRef`
here:
https://github.com/prometheus/prometheus/blob/c8f1de18a7870e5dc99ed50119c194691c41e41c/scrape/scrape.go#L1089
<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes #43893
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Un-skip related tests.
---------
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>1 parent fb43d28 commit aef9425
File tree
6 files changed
+40
-6
lines changed- .chloggen
- exporter/prometheusexporter
- receiver/prometheusreceiver
- internal
6 files changed
+40
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| |||
350 | 355 | | |
351 | 356 | | |
352 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
353 | 361 | | |
354 | 362 | | |
355 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
356 | 366 | | |
357 | 367 | | |
358 | 368 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
533 | 532 | | |
534 | 533 | | |
535 | 534 | | |
| |||
0 commit comments