Skip to content

Commit ff907f8

Browse files
committed
MON-3500: Enable sending exemplars over RW in UWM
1 parent 4bdf151 commit ff907f8

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Note: This CHANGELOG is only for the monitoring team to track all monitoring related changes. Please see OpenShift release notes for official changes.
22

3+
## 4.15
4+
5+
- [#2161](https://github.com/openshift/cluster-monitoring-operator/pull/2161) Add `PrometheusRestrictedConfig.RemoteWrite[].SendExemplars`.
6+
37
## 4.14
48

59
- [#1937](https://github.com/openshift/cluster-monitoring-operator/pull/1937) Disables btrfs collector

Diff for: Documentation/api.md

+1
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ The `RemoteWriteSpec` resource defines the settings for remote write storage.
525525
| proxyUrl | string | Defines an optional proxy URL. |
526526
| queueConfig | *[monv1.QueueConfig](https://github.com/prometheus-operator/prometheus-operator/blob/v0.66.0/Documentation/api.md#queueconfig) | Allows tuning configuration for remote write queue parameters. |
527527
| remoteTimeout | string | Defines the timeout value for requests to the remote write endpoint. |
528+
| sendExemplars | *bool | Enables sending of exemplars over remote write. Note that the experimental \"exemplar-storage\" feature must be enabled using the `spec.enableFeature` option for exemplars to be scraped in the first place. Only supported for UWM configurations. |
528529
| sigv4 | *monv1.Sigv4 | Defines AWS Signature Version 4 authentication settings. |
529530
| tlsConfig | *[monv1.SafeTLSConfig](https://github.com/prometheus-operator/prometheus-operator/blob/v0.66.0/Documentation/api.md#safetlsconfig) | Defines TLS authentication settings for the remote write endpoint. |
530531
| url | string | Defines the URL of the remote write endpoint to which samples will be sent. |

Diff for: Documentation/openshiftdocs/modules/remotewritespec.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ link:prometheusrestrictedconfig.adoc[PrometheusRestrictedConfig]
4141

4242
|remoteTimeout|string|Defines the timeout value for requests to the remote write endpoint.
4343

44+
|sendExemplars|*bool|Enables sending of exemplars over remote write. Note that the experimental \"exemplar-storage\" feature must be enabled using the `spec.enableFeature` option for exemplars to be scraped in the first place. Only supported for UWM configurations.
45+
4446
|sigv4|*monv1.Sigv4|Defines AWS Signature Version 4 authentication settings.
4547

4648
|tlsConfig|*monv1.SafeTLSConfig|Defines TLS authentication settings for the remote write endpoint.

Diff for: pkg/manifests/manifests.go

+22
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5050
"k8s.io/apimachinery/pkg/util/yaml"
5151
auditv1 "k8s.io/apiserver/pkg/apis/audit/v1"
52+
"k8s.io/klog/v2"
5253
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
5354
)
5455

@@ -69,6 +70,9 @@ const (
6970
telemetryTokenSecretKey = "token"
7071

7172
collectionProfileLabel = "monitoring.openshift.io/collection-profile"
73+
74+
// --enable-feature=exemplar-storage: https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage
75+
EnableFeatureExemplarStorageString = "exemplar-storage"
7276
)
7377

7478
var (
@@ -1455,6 +1459,14 @@ func (f *Factory) PrometheusK8s(grpcTLS *v1.Secret, trustedCABundleCM *v1.Config
14551459

14561460
if len(f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.RemoteWrite) > 0 {
14571461
p.Spec.RemoteWrite = addRemoteWriteConfigs(clusterID, p.Spec.RemoteWrite, f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.RemoteWrite...)
1462+
1463+
// Explicitly warn that we are ignoring the `SendExemplars` configuration for in-cluster scenarios.
1464+
for _, rws := range f.config.ClusterMonitoringConfiguration.PrometheusK8sConfig.RemoteWrite {
1465+
if *rws.SendExemplars {
1466+
klog.Warningln("Enabling `SendExemplars` in the in-cluster Prometheus configuration has no affect, as it is only supported for UWM configurations.")
1467+
break
1468+
}
1469+
}
14581470
}
14591471

14601472
for _, rw := range p.Spec.RemoteWrite {
@@ -1759,6 +1771,15 @@ func (f *Factory) PrometheusUserWorkload(grpcTLS *v1.Secret, trustedCABundleCM *
17591771
f.config.ClusterMonitoringConfiguration.TelemeterClientConfig.ClusterID,
17601772
p.Spec.RemoteWrite,
17611773
f.config.UserWorkloadConfiguration.Prometheus.RemoteWrite...)
1774+
1775+
// Since `SendExemplars` is experimental currently, we need to enable "exemplar-storage" explicitly to make sure
1776+
// CMO turns this on automatically in Prometheus if any *UWM* RemoteWrite[] enables this.
1777+
for _, rws := range f.config.UserWorkloadConfiguration.Prometheus.RemoteWrite {
1778+
if *rws.SendExemplars {
1779+
p.Spec.EnableFeatures = append(p.Spec.EnableFeatures, EnableFeatureExemplarStorageString)
1780+
break
1781+
}
1782+
}
17621783
}
17631784

17641785
if f.config.UserWorkloadConfiguration.Prometheus.EnforcedSampleLimit != nil {
@@ -3622,6 +3643,7 @@ func addRemoteWriteConfigs(clusterID string, rw []monv1.RemoteWriteSpec, rwTarge
36223643
ProxyURL: target.ProxyURL,
36233644
MetadataConfig: target.MetadataConfig,
36243645
OAuth2: target.OAuth2,
3646+
SendExemplars: target.SendExemplars,
36253647
}
36263648
if target.TLSConfig != nil {
36273649
rwConf.TLSConfig = &monv1.TLSConfig{

Diff for: pkg/manifests/types.go

+5
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,11 @@ type RemoteWriteSpec struct {
753753
QueueConfig *monv1.QueueConfig `json:"queueConfig,omitempty"`
754754
// Defines the timeout value for requests to the remote write endpoint.
755755
RemoteTimeout string `json:"remoteTimeout,omitempty"`
756+
// Enables sending of exemplars over remote write. Note that the experimental
757+
// "exemplar-storage" feature must be enabled using the `spec.enableFeature`
758+
// option for exemplars to be scraped in the first place. Only supported for
759+
// UWM configurations.
760+
SendExemplars *bool `json:"sendExemplars,omitempty"`
756761
// Defines AWS Signature Version 4 authentication settings.
757762
Sigv4 *monv1.Sigv4 `json:"sigv4,omitempty"`
758763
// Defines TLS authentication settings for the remote write endpoint.

0 commit comments

Comments
 (0)