Skip to content

Commit c92884b

Browse files
authored
Merge branch 'main' into 3474
2 parents c69a21f + 5dab4b2 commit c92884b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.chloggen/fix-allocator-metric.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: target allocator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "change metric `opentelemetry_allocator_targets_remaining` type from counter to gauge"
9+
10+
# One or more tracking issues related to the change
11+
issues: [3578]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

cmd/otel-allocator/allocation/strategy.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
Name: "opentelemetry_allocator_time_to_allocate",
4848
Help: "The time it takes to allocate",
4949
}, []string{"method", "strategy"})
50-
targetsRemaining = promauto.NewCounter(prometheus.CounterOpts{
50+
TargetsRemaining = promauto.NewGauge(prometheus.GaugeOpts{
5151
Name: "opentelemetry_allocator_targets_remaining",
5252
Help: "Number of targets kept after filtering.",
5353
})
@@ -80,7 +80,7 @@ func WithFallbackStrategy(fallbackStrategy string) AllocationOption {
8080
}
8181

8282
func RecordTargetsKept(targets map[string]*target.Item) {
83-
targetsRemaining.Add(float64(len(targets)))
83+
TargetsRemaining.Set(float64(len(targets)))
8484
}
8585

8686
func New(name string, log logr.Logger, opts ...AllocationOption) (Allocator, error) {

0 commit comments

Comments
 (0)