Skip to content

Commit 56ed781

Browse files
Merge pull request #34 from CircleCI-Public/ONPREM-2071/relabelings
[ONPREM-2071] Drop default ServiceMonitor labels
2 parents e88653c + 1f8b636 commit 56ed781

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

.helmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
.vscode/
2525

2626
.circleci/
27+
bin/
2728
do
2829
docs/
2930
renovate.json5

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: server-monitoring-stack
33
description: A reference Helm chart for setting up a monitoring stack for CircleCI server
4-
version: 0.1.0-alpha.1
4+
version: 0.1.0-alpha.2
55
dependencies:
66
- name: prometheus-operator-crds
77
version: 18.0.*

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This repository is currently under active development and is not yet a supported
99

1010
A reference Helm chart for setting up a monitoring stack for CircleCI server
1111

12-
![Version: 0.1.0-alpha.1](https://img.shields.io/badge/Version-0.1.0--alpha.1-informational?style=flat-square)
12+
![Version: 0.1.0-alpha.2](https://img.shields.io/badge/Version-0.1.0--alpha.2-informational?style=flat-square)
1313

1414
## Installing the Monitoring Stack
1515

@@ -47,7 +47,7 @@ $ helm repo update
4747
Before installing the full chart, you must first install the dependency subcharts, including the Prometheus Custom Resource Definitions (CRDs) and the Grafana operator chart. This assumes you are installing it in the same namespace as your CircleCI server installation:
4848

4949
```bash
50-
$ helm install server-monitoring-stack server-monitoring-stack/server-monitoring-stack --set global.enabled=false --set prometheusOperator.installCRDs=true --version 0.1.0-alpha.1 -n <your-server-namespace>
50+
$ helm install server-monitoring-stack server-monitoring-stack/server-monitoring-stack --set global.enabled=false --set prometheusOperator.installCRDs=true --version 0.1.0-alpha.2 -n <your-server-namespace>
5151
```
5252
> **_NOTE:_** It's possible to install the monitoring stack in a different namespace than the CircleCI server installation. If you do so, set the `prometheus.serviceMonitor.selectorNamespaces` value with the target namespace.
5353
@@ -56,7 +56,7 @@ $ helm install server-monitoring-stack server-monitoring-stack/server-monitoring
5656
Next, install the Helm chart using the following command:
5757

5858
```bash
59-
$ helm upgrade --install server-monitoring-stack server-monitoring-stack/server-monitoring-stack --reset-values --version 0.1.0-alpha.1 -n <your-server-namespace>
59+
$ helm upgrade --install server-monitoring-stack server-monitoring-stack/server-monitoring-stack --reset-values --version 0.1.0-alpha.2 -n <your-server-namespace>
6060
```
6161

6262
### 5. Verify Prometheus Is Up and Targeting Telegraf
@@ -162,7 +162,11 @@ grafana:
162162
| prometheus.persistence.size | string | `"10Gi"` | Size of the persistent volume claim. |
163163
| prometheus.persistence.storageClass | string | `""` | Storage class for persistent volume provisioner. You can create a custom storage class with a "retain" policy to ensure the persistent volume remains even after the chart is uninstalled. |
164164
| prometheus.replicas | int | `2` | Number of Prometheus replicas to deploy. |
165+
| prometheus.serviceMonitor.endpoints[0].metricRelabelings[0].action | string | `"labeldrop"` | |
166+
| prometheus.serviceMonitor.endpoints[0].metricRelabelings[0].regex | string | `"instance"` | |
165167
| prometheus.serviceMonitor.endpoints[0].port | string | `"prometheus-client"` | Port name for the Prometheus client service. |
168+
| prometheus.serviceMonitor.endpoints[0].relabelings[0].action | string | `"labeldrop"` | |
169+
| prometheus.serviceMonitor.endpoints[0].relabelings[0].regex | string | `"(container|endpoint|namespace|pod|service)"` | |
166170
| prometheus.serviceMonitor.selectorLabels | object | `{"app.kubernetes.io/instance":"circleci-server","app.kubernetes.io/name":"telegraf"}` | Labels to select ServiceMonitors for scraping metrics. By default, it's configured to scrape the existing Telegraf deployment in CircleCI server. |
167171
| prometheus.serviceMonitor.selectorNamespaces | list | `[]` | Namespaces to look for ServiceMonitor objects. Set this if the CircleCI server monitoring stack is deploying in a different namespace than the actual CircleCI server installation. |
168172
| prometheusOperator.crds.annotations."helm.sh/resource-policy" | string | `"keep"` | |

values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ prometheus:
4949
endpoints:
5050
- # -- Port name for the Prometheus client service.
5151
port: prometheus-client
52+
# Default ServiceMonitor labels that are dropped since
53+
# they overwrite app metric labels and are not useful
54+
# as they always point to the server Telegraf instance.
55+
relabelings:
56+
- regex: (container|endpoint|namespace|pod|service)
57+
action: labeldrop
58+
metricRelabelings:
59+
- regex: instance
60+
action: labeldrop
5261
persistence:
5362
# -- Enable persistent storage for Prometheus.
5463
enabled: false

0 commit comments

Comments
 (0)