Skip to content

Commit 1d8962b

Browse files
azure-monitor-assistant[bot]github-actions[bot]rashmichandrashekargracewehnerCopilot
authored
build(deps): Upgrade otelcollector to v0.148.0 (#1473)
This PR upgrades the otelcollector to the latest version available for the opentelemetry-collector and opentelemetry-operator. It was automatically generated by the GitHub Actions workflow. The summary of the OSS changelog is below: # Prometheusreceiver Changes ## v0.144.0 to v0.148.0 Generated on: 2026-03-24 07:26:22 --- ### v0.148.0 - [**OTHER**] `receiver/prometheus_remote_write`: Introduce new snake case compliant name `prometheus_remote_write` ([#46726](open-telemetry/opentelemetry-collector-contrib#46726)) - [**FEATURE**] `receiver/prometheus`: Graduate `receiver.prometheusreceiver.RemoveReportExtraScrapeMetricsConfig` feature gate to stable; deprecate `receiver.prometheusreceiver.EnableReportExtraScrapeMetrics` feature gate ([#44181](open-telemetry/opentelemetry-collector-contrib#44181)) The `report_extra_scrape_metrics` configuration option is now fully ignored; remove it from your configuration to avoid crashes. The `receiver.prometheusreceiver.EnableReportExtraScrapeMetrics` feature gate is deprecated and will be removed in v0.148.0; use the `extra_scrape_metrics` Prometheus scrape configuration option instead. - [**BUG FIX**] `receiver/prometheus`: receiver/prometheusreceiver: return stable SeriesRef from AppendHistogram for correct per-series staleness tracking ([#44528](open-telemetry/opentelemetry-collector-contrib#44528)) - [**BUG FIX**] `receiver/prometheus`: Validate target allocator interval during configuration to prevent runtime panic when interval is set to 0 or a negative value. ([#46700](open-telemetry/opentelemetry-collector-contrib#46700)) Previously, setting `interval` to 0s or a negative value would cause a runtime panic when `time.NewTicker()` was called with an invalid duration. The configuration is now validated early to prevent this panic and provide a clear error message. ### v0.147.0 - [**FEATURE**] `receiver/prometheusremotewrite`: Add support for extracting exemplars from Prometheus counters ([#46145](open-telemetry/opentelemetry-collector-contrib#46145)) ### v0.146.0 - [**FEATURE**] `receiver/prometheusremotewrite`: Improved performance when parsing Remote Write v2 requests. ([#45623](open-telemetry/opentelemetry-collector-contrib#45623)) - [**FEATURE**] `receiver/prometheusremotewrite`: Add exemplar support to the Prometheus Remote Write receiver ([#44983](open-telemetry/opentelemetry-collector-contrib#44983)) ### v0.145.0 - [**BREAKING**] `receiver/prometheus`: Promote `receiver.prometheusreceiver.RemoveReportExtraScrapeMetricsConfig` feature gate to beta ([#44181](open-telemetry/opentelemetry-collector-contrib#44181)) The `report_extra_scrape_metrics` configuration option is now ignored by default. Extra scrape metrics are instead controlled by the `receiver.prometheusreceiver.EnableReportExtraScrapeMetrics` feature gate and the Prometheus upstream configuration available in `promconfig` (either globally or per-scrape config). - [**FEATURE**] `receiver/prometheus`: Support removable Prometheus service discoveries via Go build tags. ([#44406](open-telemetry/opentelemetry-collector-contrib#44406)) Prometheus service discoveries can now be removed at build time when building the collector with OCB (OpenTelemetry Collector Builder). Use the `build_tags` option in the builder configuration to pass Go build tags such as `remove_all_sd` to exclude optional service discoveries. See the Prometheus documentation for available build tags to customize which service discoveries are included. ## Summary | Category | Count | |----------|-------| | Breaking Changes | 1 | | Features | 5 | | Bug Fixes | 2 | | Other Changes | 1 | | **Total** | **9** | # Target-allocator Changes ## v0.144.0 to v0.148.0 Generated on: 2026-03-24 07:26:38 --- ### 0.147.0 - [**BUG FIX**] `target allocator`: Fix Service Monitor/Pod Monitor in TargetAllocator doesnt pick up updates to secrets ([#4091](open-telemetry/opentelemetry-operator#4091)) Fixes issue where service/pod Monitors don't pick up updates to secrets. ### 0.146.0 - [**FEATURE**] `target allocator`: Expose missing Prometheus CR fields in the Operator API ([#1934](open-telemetry/opentelemetry-operator#1934)) Added `podMonitorNamespaceSelector`, `serviceMonitorNamespaceSelector`, `scrapeConfigNamespaceSelector`, `probeNamespaceSelector`, `evaluationInterval`, and `scrapeProtocols` to the `prometheusCR` configuration within the `TargetAllocator` and `OpenTelemetryCollector` APIs to achieve feature parity with the underlying Target Allocator. ### 0.145.0 - [**FEATURE**] `target allocator`: Add readiness and liveness probe configurations for target allocator CRD ([#4639](open-telemetry/opentelemetry-operator#4639)) - [**FEATURE**] `target allocator`: Make the least-weighted target allocation strategy take job name into account. ([#3128](open-telemetry/opentelemetry-operator#3128)) Uses job name instead of "first match" to when number of targets is equal. The effect is to spread out targets with the same job name across collectors. - [**BUG FIX**] `target allocator`: Fix TLS certificate hot-reload for mTLS connections ([#4368](open-telemetry/opentelemetry-operator#4368)) The Target Allocator now automatically reloads TLS certificates when they are renewed by cert-manager. Previously, certificate renewals required a pod restart because certificates were only loaded once at startup. The fix uses fsnotify to watch the certificate directory and dynamically reloads certificates via the GetCertificate callback, enabling seamless certificate rotation without downtime. - [**BUG FIX**] `collector`: Configure collector to reload client certificate periodically ([#4657](open-telemetry/opentelemetry-operator#4657)) When the collector connects to the target allocator over mTLS, certificates were not automatically reloaded after expiration. This adds reload_interval to the TLS configuration, enabling the Prometheus receiver to periodically reload certificates from disk. The default interval of 5 minutes provides a good balance between picking up renewed certificates promptly and avoiding unnecessary overhead. ## Summary | Category | Count | |----------|-------| | Breaking Changes | 0 | | Features | 3 | | Bug Fixes | 3 | | Other Changes | 0 | | **Total** | **6** | --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Rashmi Chandrashekar <rashmy@microsoft.com> Co-authored-by: Grace Wehner <grace.wehner@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bf05d52 commit 1d8962b

File tree

85 files changed

+4956
-3737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4956
-3737
lines changed

.trivyignore

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# This file contains CVEs to be ignored by Trivy
22

33
# CRITICAL
4-
CVE-2026-33186
5-
4+
CVE-2026-33186 #google.golang.org/grpc
65
# HIGH
7-
# temp override for high priority ME upgrade, need to remove.
8-
CVE-2026-24051
9-
CVE-2026-25679
106

11-
# MEDIUM
12-
CVE-2026-27142
7+
# MEDIUM

OPENTELEMETRY_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.144.0
1+
v0.148.0

TARGETALLOCATOR_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.144.0
1+
v0.148.0

internal/docs/UpgradeotelCol.md

Lines changed: 0 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -71,221 +71,6 @@ go build -buildmode=pie -ldflags '-linkmode external -extldflags=-Wl,-z,now -s -
7171

7272
```
7373
74-
// pointing to this fork for prometheus-operator since we need fixes for asset store which is only available from v0.84.0 of prometheus-operator
75-
// targetallocator cannot upgrade to v0.84.0 because of this issue - https://github.com/open-telemetry/opentelemetry-operator/issues/4196
76-
// this commit is from this repository -https://github.com/rashmichandrashekar/prometheus-operator/tree/rashmi/v0.81.0-patch-assetstore - which only has the asset store fixes on top of v0.81.0 of prometheus-operator
77-
replace github.com/prometheus-operator/prometheus-operator => github.com/rashmichandrashekar/prometheus-operator v0.0.0-20250715221118-b55ea6d3c138
78-
79-
```
80-
81-
09. Replace the module as module `github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator`
82-
10. In file otelcollector/otel-allocator/internal/watcher/promOperator.go -
83-
84-
* Add imports for the below -
85-
86-
```
87-
promMonitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring"
88-
"k8s.io/client-go/metadata"
89-
```
90-
91-
* In NewPrometheusCRWatcher method add this before GetAllowDenyLists() -
92-
93-
```
94-
mdClient, err := metadata.NewForConfig(cfg.ClusterConfig)
95-
if err != nil {
96-
return nil, err
97-
}
98-
```
99-
100-
Update the below lines with the following lines -
101-
102-
```
103-
factory := informers.NewMonitoringInformerFactories(allowList, denyList, monitoringclient, allocatorconfig.DefaultResyncTime, nil)
104-
105-
monitoringInformers, err := getInformers(factory, cfg.ClusterConfig, promLogger)
106-
```
107-
108-
```
109-
monitoringInformerFactory := informers.NewMonitoringInformerFactories(allowList, denyList, monitoringclient, allocatorconfig.DefaultResyncTime, nil)
110-
metaDataInformerFactory := informers.NewMetadataInformerFactory(allowList, denyList, mdClient, allocatorconfig.DefaultResyncTime, nil)
111-
monitoringInformers, err := getInformers(monitoringInformerFactory, cfg.ClusterConfig, promLogger, metaDataInformerFactory)
112-
```
113-
114-
* Update group. Name value from "monitoring.coreos.com" to promMonitoring. GroupName in the method checkCRDAvailability
115-
116-
* Add additional function parameters in the function getInformers - metaDataInformerFactory informers. FactoriesForNamespaces
117-
118-
* Add the below code before return statement of the method getInformers
119-
120-
```
121-
secretInformers, err := informers.NewInformersForResourceWithTransform(metaDataInformerFactory, v1.SchemeGroupVersion.WithResource(string(v1.ResourceSecrets)), informers.PartialObjectMetadataStrip)
122-
if err != nil {
123-
return nil, err
124-
}
125-
if secretInformers != nil {
126-
informersMap[string(v1.ResourceSecrets)] = secretInformers
127-
}
128-
```
129-
130-
* In the function Watch(), replace this code -
131-
132-
```
133-
// only send an event notification if there isn't one already
134-
resource.AddEventHandler(cache.ResourceEventHandlerFuncs{
135-
// these functions only write to the notification channel if it's empty to avoid blocking
136-
// if scrape config updates are being rate-limited
137-
AddFunc: func(obj interface{}) {
138-
select {
139-
case notifyEvents <- struct{}{}:
140-
default:
141-
}
142-
},
143-
UpdateFunc: func(oldObj, newObj interface{}) {
144-
select {
145-
case notifyEvents <- struct{}{}:
146-
default:
147-
}
148-
},
149-
DeleteFunc: func(obj interface{}) {
150-
select {
151-
case notifyEvents <- struct{}{}:
152-
default:
153-
}
154-
},
155-
})
156-
```
157-
158-
with the below code -
159-
160-
```
161-
// Use a custom event handler for secrets since secret update requires asset store to be updated so that CRs can pick up updated secrets.
162-
if name == string(v1.ResourceSecrets) {
163-
w.logger.Info("Using custom event handler for secrets informer", "informer", name)
164-
// only send an event notification if there isn't one already
165-
resource.AddEventHandler(cache.ResourceEventHandlerFuncs{
166-
// these functions only write to the notification channel if it's empty to avoid blocking
167-
// if scrape config updates are being rate-limited
168-
AddFunc: func(obj interface{}) {
169-
select {
170-
case notifyEvents <- struct{}{}:
171-
default:
172-
}
173-
},
174-
UpdateFunc: func(oldObj, newObj interface{}) {
175-
oldMeta, _ := oldObj.(metav1.ObjectMetaAccessor)
176-
newMeta, _ := newObj.(metav1.ObjectMetaAccessor)
177-
secretName := newMeta.GetObjectMeta().GetName()
178-
secretNamespace := newMeta.GetObjectMeta().GetNamespace()
179-
_, exists, err := w.store.GetObject(&v1.Secret{
180-
ObjectMeta: metav1.ObjectMeta{
181-
Name: secretName,
182-
Namespace: secretNamespace,
183-
},
184-
})
185-
if !exists || err != nil {
186-
if err != nil {
187-
w.logger.Error("unexpected store error when checking if secret exists, skipping update", secretName, "error", err)
188-
return
189-
}
190-
// if the secret does not exist in the store, we skip the update
191-
return
192-
}
193-
194-
newSecret, err := w.store.GetSecretClient().Secrets(secretNamespace).Get(context.Background(), secretName, metav1.GetOptions{})
195-
196-
if err != nil {
197-
w.logger.Error("unexpected store error when getting updated secret - ", secretName, "error", err)
198-
return
199-
}
200-
201-
w.logger.Info("Updating secret in store", "newObjName", newMeta.GetObjectMeta().GetName(), "newobjnamespace", newMeta.GetObjectMeta().GetNamespace())
202-
if err := w.store.UpdateObject(newSecret); err != nil {
203-
w.logger.Error("unexpected store error when updating secret - ", newMeta.GetObjectMeta().GetName(), "error", err)
204-
} else {
205-
w.logger.Info(
206-
"Successfully updated store, sending update event to notifyEvents channel",
207-
"oldObjName", oldMeta.GetObjectMeta().GetName(),
208-
"oldobjnamespace", oldMeta.GetObjectMeta().GetNamespace(),
209-
"newObjName", newMeta.GetObjectMeta().GetName(),
210-
"newobjnamespace", newMeta.GetObjectMeta().GetNamespace(),
211-
)
212-
select {
213-
case notifyEvents <- struct{}{}:
214-
default:
215-
}
216-
}
217-
},
218-
DeleteFunc: func(obj interface{}) {
219-
secretMeta, _ := obj.(metav1.ObjectMetaAccessor)
220-
221-
secretName := secretMeta.GetObjectMeta().GetName()
222-
secretNamespace := secretMeta.GetObjectMeta().GetNamespace()
223-
224-
// check if the secret exists in the store
225-
secretObj := &v1.Secret{
226-
ObjectMeta: metav1.ObjectMeta{
227-
Name: secretName,
228-
Namespace: secretNamespace,
229-
},
230-
}
231-
_, exists, err := w.store.GetObject(secretObj)
232-
// if the secret does not exist in the store, we skip the delete
233-
if !exists || err != nil {
234-
if err != nil {
235-
w.logger.Error("unexpected store error when checking if secret exists, skipping delete", secretMeta.GetObjectMeta().GetName(), "error", err)
236-
return
237-
}
238-
// if the secret does not exist in the store, we skip the delete
239-
return
240-
}
241-
w.logger.Info("Deleting secret from store", "objName", secretMeta.GetObjectMeta().GetName(), "objnamespace", secretMeta.GetObjectMeta().GetNamespace())
242-
// if the secret exists in the store, we delete it
243-
// and send an event notification to the notifyEvents channel
244-
if err := w.store.DeleteObject(secretObj); err != nil {
245-
w.logger.Error("unexpected store error when deleting secret - ", secretMeta.GetObjectMeta().GetName(), "error", err)
246-
//return
247-
} else {
248-
w.logger.Info(
249-
"Successfully removed secret from store, sending update event to notifyEvents channel",
250-
"objName", secretMeta.GetObjectMeta().GetName(),
251-
"objnamespace", secretMeta.GetObjectMeta().GetNamespace(),
252-
)
253-
select {
254-
case notifyEvents <- struct{}{}:
255-
default:
256-
}
257-
}
258-
},
259-
})
260-
} else {
261-
w.logger.Info("Using default event handler for informer", "informer", name)
262-
// only send an event notification if there isn't one already
263-
resource.AddEventHandler(cache.ResourceEventHandlerFuncs{
264-
// these functions only write to the notification channel if it's empty to avoid blocking
265-
// if scrape config updates are being rate-limited
266-
AddFunc: func(obj interface{}) {
267-
select {
268-
case notifyEvents <- struct{}{}:
269-
default:
270-
}
271-
},
272-
UpdateFunc: func(oldObj, newObj interface{}) {
273-
select {
274-
case notifyEvents <- struct{}{}:
275-
default:
276-
}
277-
},
278-
DeleteFunc: func(obj interface{}) {
279-
select {
280-
case notifyEvents <- struct{}{}:
281-
default:
282-
}
283-
},
284-
})
285-
}
286-
287-
```
288-
28974
10. Run go mod tidy from the otel-allocator directory and then run make.
29075
29176
## Configuration Reader Builder

internal/otel-upgrade-scripts/upgrade.sh

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -609,111 +609,4 @@ else
609609
fi
610610
fi
611611

612-
# Replace prometheus-operator dependency in go.mod in folder - otel-allocator
613-
echo "Adding prometheus-operator fork replace directive to otel-allocator/go.mod..."
614-
615-
GO_MOD_FILE="otelcollector/otel-allocator/go.mod"
616-
REPLACE_BLOCK="// pointing to this fork for prometheus-operator since we need fixes for asset store which is only available from v0.84.0 of prometheus-operator
617-
// targetallocator cannot upgrade to v0.84.0 because of this issue - https://github.com/open-telemetry/opentelemetry-operator/issues/4196
618-
// this commit is from this repository -https://github.com/rashmichandrashekar/prometheus-operator/tree/rashmi/v0.81.0-patch-assetstore - which only has the asset store fixes on top of v0.81.0 of prometheus-operator
619-
replace github.com/prometheus-operator/prometheus-operator => github.com/rashmichandrashekar/prometheus-operator v0.0.0-20250715221118-b55ea6d3c138
620-
"
621-
622-
# Insert before the first 'require' line
623-
awk -v block="$REPLACE_BLOCK" '
624-
BEGIN { inserted=0 }
625-
/^require / && !inserted {
626-
print block
627-
inserted=1
628-
}
629-
{ print }
630-
' "$GO_MOD_FILE" > "${GO_MOD_FILE}.tmp" && mv "${GO_MOD_FILE}.tmp" "$GO_MOD_FILE"
631-
632-
echo "Added prometheus-operator fork replace directive."
633-
634-
echo "Running go mod tidy in otelcollector/otel-allocator..."
635-
(cd otelcollector/otel-allocator && go mod tidy)
636-
echo "go mod tidy completed."
637-
638-
# Update promOperator.go to include secretinformer changes
639-
echo "Updating promOperator.go to include secretinformer changes..."
640-
PROM_OP_FILE="otelcollector/otel-allocator/internal/watcher/promOperator.go"
641-
642-
# Add imports to promOperator.go
643-
PROM_OP_FILE="otelcollector/otel-allocator/internal/watcher/promOperator.go"
644-
645-
awk '
646-
/^import \(/ && !added {
647-
print
648-
print "\tpromMonitoring \"github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring\""
649-
print "\t\"k8s.io/client-go/metadata\""
650-
added=1
651-
next
652-
}
653-
{ print }
654-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
655-
656-
echo "Added imports to promOperator.go."
657-
# Update NewPrometheusCRWatcher method
658-
# Add mdClient initialization after resourceSelector declaration in NewPrometheusCRWatcher
659-
awk '
660-
/resourceSelector .*/ && !added {
661-
print
662-
print ""
663-
print " mdClient, err := metadata.NewForConfig(cfg.ClusterConfig)"
664-
print " if err != nil {"
665-
print " return nil, err"
666-
print " }"
667-
added=1
668-
next
669-
}
670-
{ print }
671-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
672-
673-
# Replace factory and monitoringInformers initialization in promOperator.go
674-
awk '
675-
/factory := informers\.NewMonitoringInformerFactories\(allowList, denyList, monitoringclient, allocatorconfig\.DefaultResyncTime, nil\)/ {
676-
print " monitoringInformerFactory := informers.NewMonitoringInformerFactories(allowList, denyList, monitoringclient, allocatorconfig.DefaultResyncTime, nil)"
677-
print " metaDataInformerFactory := informers.NewMetadataInformerFactory(allowList, denyList, mdClient, allocatorconfig.DefaultResyncTime, nil)"
678-
next
679-
}
680-
/monitoringInformers, err := getInformers\(factory, cfg\.ClusterConfig, promLogger\)/ {
681-
print " monitoringInformers, err := getInformers(monitoringInformerFactory, cfg.ClusterConfig, promLogger, metaDataInformerFactory)"
682-
next
683-
}
684-
{ print }
685-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
686-
687-
# Update group.Name to promMonitoring.GroupName in checkCRDAvailability
688-
awk '
689-
/group\.Name == "monitoring\.coreos\.com" {/ {
690-
gsub(/group\.Name == "monitoring\.coreos\.com"/, "group.Name == promMonitoring.GroupName")
691-
}
692-
{ print }
693-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
694-
695-
# Update getInformers function signature to add metaDataInformerFactory parameter
696-
awk '
697-
/func getInformers\(/ && !updated {
698-
sub(/\) \(/, ", metaDataInformerFactory informers.FactoriesForNamespaces) (")
699-
updated=1
700-
}
701-
{ print }
702-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
703-
704-
# Insert secret informer logic before return statement in getInformers
705-
awk '
706-
/return informersMap, nil/ && !added {
707-
print " secretInformers, err := informers.NewInformersForResourceWithTransform(metaDataInformerFactory, v1.SchemeGroupVersion.WithResource(string(v1.ResourceSecrets)), informers.PartialObjectMetadataStrip)"
708-
print " if err != nil {"
709-
print " return nil, err"
710-
print " }"
711-
print " if secretInformers != nil {"
712-
print " informersMap[string(v1.ResourceSecrets)] = secretInformers"
713-
print " }"
714-
added=1
715-
}
716-
{ print }
717-
' "$PROM_OP_FILE" > "${PROM_OP_FILE}.tmp" && mv "${PROM_OP_FILE}.tmp" "$PROM_OP_FILE"
718-
719612
echo "Upgrade process complete!"

0 commit comments

Comments
 (0)