Skip to content

Commit ab9988c

Browse files
committed
add collectorTargetReloadInterval (apply review)
1 parent 30c2c04 commit ab9988c

13 files changed

+120
-2
lines changed
Lines changed: 16 additions & 0 deletions
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: enhancement
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: Add CollectorTargetReloadInterval option to configure the interval at which the Prometheus receiver reloads targets from the target allocator
9+
10+
# One or more tracking issues related to the change
11+
issues: [4095]
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:

apis/v1beta1/opentelemetrycollector_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ type TargetAllocatorEmbedded struct {
227227
// +kubebuilder:default:="30s"
228228
// +kubebuilder:validation:Format:=duration
229229
CollectorNotReadyGracePeriod *metav1.Duration `json:"collectorNotReadyGracePeriod,omitempty"`
230+
// CollectorTargetReloadInterval defines the interval at which the Prometheus receiver will reload targets from the target allocator.
231+
// The default is 30s.
232+
//
233+
// +optional
234+
// +kubebuilder:default:="30s"
235+
// +kubebuilder:validation:Format:=duration
236+
CollectorTargetReloadInterval *metav1.Duration `json:"collectorTargetReloadInterval,omitempty"`
230237
}
231238

232239
// Probe defines the OpenTelemetry's pod probe config.

apis/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-07-15T11:00:03Z"
102+
createdAt: "2025-08-01T17:09:57Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,6 +7719,10 @@ spec:
77197719
default: 30s
77207720
format: duration
77217721
type: string
7722+
collectorTargetReloadInterval:
7723+
default: 30s
7724+
format: duration
7725+
type: string
77227726
enabled:
77237727
type: boolean
77247728
env:

bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-07-15T11:00:04Z"
102+
createdAt: "2025-08-01T17:09:57Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,6 +7719,10 @@ spec:
77197719
default: 30s
77207720
format: duration
77217721
type: string
7722+
collectorTargetReloadInterval:
7723+
default: 30s
7724+
format: duration
7725+
type: string
77227726
enabled:
77237727
type: boolean
77247728
env:

config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7705,6 +7705,10 @@ spec:
77057705
default: 30s
77067706
format: duration
77077707
type: string
7708+
collectorTargetReloadInterval:
7709+
default: 30s
7710+
format: duration
7711+
type: string
77087712
enabled:
77097713
type: boolean
77107714
env:

docs/api/opentelemetrycollectors.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30747,6 +30747,17 @@ The default is 30s, which means that if a collector becomes not Ready, the targe
3074730747
<i>Default</i>: 30s<br/>
3074830748
</td>
3074930749
<td>false</td>
30750+
</tr><tr>
30751+
<td><b>collectorTargetReloadInterval</b></td>
30752+
<td>string</td>
30753+
<td>
30754+
CollectorTargetReloadInterval defines the interval at which the Prometheus receiver will reload targets from the target allocator.
30755+
The default is 30s.<br/>
30756+
<br/>
30757+
<i>Format</i>: duration<br/>
30758+
<i>Default</i>: 30s<br/>
30759+
</td>
30760+
<td>false</td>
3075030761
</tr><tr>
3075130762
<td><b>enabled</b></td>
3075230763
<td>boolean</td>

internal/manifests/collector/config_replace.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ func ReplaceConfig(otelcol v1beta1.OpenTelemetryCollector, targetAllocator *v1al
5858
return "", validateCfgPromErr
5959
}
6060

61+
// Use the interval from CRD (which has a default of 30s if not specified)
62+
if otelcol.Spec.TargetAllocator.CollectorTargetReloadInterval != nil {
63+
interval := otelcol.Spec.TargetAllocator.CollectorTargetReloadInterval.Duration.String()
64+
options = append(options, ta.WithCollectorTargetReloadInterval(interval))
65+
}
66+
6167
// To avoid issues caused by Prometheus validation logic, which fails regex validation when it encounters
6268
// $$ in the prom config, we update the YAML file directly without marshaling and unmarshalling.
6369
updPromCfgMap, getCfgPromErr := ta.AddTAConfigToPromConfig(promCfgMap, naming.TAService(targetAllocator.Name), options...)

0 commit comments

Comments
 (0)