Skip to content

Commit 17e055c

Browse files
[ONPREM-2157] Integrate Tempo with Grafana as a data source (#60)
* Configure Tempo as a Grafana data source * Update README * Remove ENFORCE_CACHE_LABELS=off The issue has been resolved
1 parent f3081b9 commit 17e055c

File tree

6 files changed

+93
-32
lines changed

6 files changed

+93
-32
lines changed

.circleci/config.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ jobs:
213213
kubectl wait --for=condition=available --timeout=30s deployment/cert-manager-webhook -n cert-manager
214214
215215
kubectl apply -f https://github.com/grafana/tempo-operator/releases/download/v0.16.0/tempo-operator.yaml
216+
kubectl get cm tempo-operator-manager-config -n tempo-operator-system -o yaml | \
217+
sed 's/^ *grafanaOperator: false$/ grafanaOperator: true/' | \
218+
kubectl apply -f -
219+
kubectl rollout restart deployment/tempo-operator-controller -n tempo-operator-system
216220
kubectl wait --for=condition=available --timeout=30s deployment/tempo-operator-controller -n tempo-operator-system
217221
- run:
218222
name: Install Helm chart
@@ -232,6 +236,14 @@ jobs:
232236
name: Check Prometheus status
233237
command: |
234238
curl --retry 5 --retry-connrefused --retry-max-time 120 http://localhost:9090/api/v1/status/buildinfo
239+
- run:
240+
name: Port-forward Tempo
241+
command: kubectl port-forward svc/tempo-server-monitoring-tempo 3200
242+
background: true
243+
- run:
244+
name: Check Tempo status
245+
command: |
246+
curl --retry 5 --retry-connrefused --retry-max-time 120 http://localhost:3200/api/status/buildinfo
235247
- run:
236248
name: Wait for Grafana
237249
command: kubectl wait --for=jsonpath='{.subsets[*].addresses}' endpoints/server-monitoring-grafana-service --timeout=2m
@@ -252,6 +264,17 @@ jobs:
252264
done
253265
echo "Prometheus data source is not healthy: ${status}"
254266
exit 1
267+
- run:
268+
name: Check Grafana's Tempo data source is configured
269+
command: |
270+
for i in {1..30}; do
271+
id=$(curl --retry 5 --retry-connrefused -s -u admin:admin "http://localhost:3000/api/datasources/name/server-monitoring-tempo" | jq -r '.id')
272+
[ "$id" != "null" ] && echo "Got ID ${id} for Tempo. Data source is configured." && exit 0
273+
echo "Tempo data source not configured yet. Retrying..."
274+
sleep 10
275+
done
276+
echo "Tempo data source configuration failed"
277+
exit 1
255278
- run:
256279
name: Describe Pods on failure
257280
command: kubectl describe pods & exit 1
@@ -260,6 +283,10 @@ jobs:
260283
name: Describe Prometheus on failure
261284
command: kubectl describe prometheus & exit 1
262285
when: on_fail
286+
- run:
287+
name: Describe Tempo on failure
288+
command: kubectl describe tempomonolithic & exit 1
289+
when: on_fail
263290
- run:
264291
name: Describe Grafana on failure
265292
command: kubectl describe grafana & exit 1

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,30 @@ $ helm install server-monitoring-stack server-monitoring-stack/server-monitoring
6565
6666
#### 3.2 Install Tempo Operator (Optional)
6767

68-
If you plan to enable distributed tracing with Tempo (`tempo.enabled=true`), you must manually install the Tempo Operator by following the official documentation at https://grafana.com/docs/tempo/latest/setup/operator/#installation[]. There is currently no official Helm chart available for the Tempo Operator or its CRDs.
68+
If you plan to enable distributed tracing with Tempo (`tempo.enabled=true`), you must manually install the Tempo Operator. There is currently no official Helm chart available for the Tempo Operator or its CRDs, so manual installation is required. The Tempo Operator also requires cert-manager to be installed in your cluster. Additionally, this reference chart requires the `grafanaOperator` feature gate to be enabled for proper integration with Grafana.
69+
70+
For more detailed installation instructions, refer to the [official Tempo Operator documentation](https://grafana.com/docs/tempo/latest/setup/operator/#installation).
71+
72+
**Prerequisites:**
73+
- cert-manager must be installed in your cluster
74+
75+
**Example installation steps:**
76+
77+
1. Install the Tempo Operator:
78+
```bash
79+
$ kubectl apply -f https://github.com/grafana/tempo-operator/releases/download/v0.16.0/tempo-operator.yaml
80+
```
81+
2. Enable the `grafanaOperator` feature gate (required for integration with Grafana):
82+
```bash
83+
$ kubectl get cm tempo-operator-manager-config -n tempo-operator-system -o yaml | \
84+
sed 's/^ *grafanaOperator: false$/ grafanaOperator: true/' | \
85+
kubectl apply -f -
86+
```
87+
3. Restart the operator deployment to apply the configuration:
88+
```bash
89+
$ kubectl rollout restart deployment/tempo-operator-controller -n tempo-operator-system
90+
$ kubectl wait --for=condition=available --timeout=120s deployment/tempo-operator-controller -n tempo-operator-system
91+
```
6992

7093
### 4. Install the Helm Chart
7194

@@ -193,7 +216,7 @@ Dashboards are provisioned directly from CRDs, which means any manual edits will
193216
| grafana.service.annotations | object | `{}` | Metadata annotations for the service. |
194217
| grafana.service.port | int | `3000` | Port on which the Grafana service will be exposed. |
195218
| grafana.service.type | string | `"ClusterIP"` | Specifies the type of service for Grafana. Options include ClusterIP, NodePort, or LoadBalancer. Use NodePort or LoadBalancer to expose Grafana externally. Ensure that grafana.credentials are set for security purposes. |
196-
| grafanaoperator | object | `{"env":[{"name":"ENFORCE_CACHE_LABELS","value":"off"}],"fullnameOverride":"server-monitoring-grafana-operator","image":{"repository":"quay.io/grafana-operator/grafana-operator","tag":"v5.18.0"}}` | Full values for the Grafana Operator chart can be obtained at: https://github.com/grafana/grafana-operator/blob/master/deploy/helm/grafana-operator/values.yaml |
219+
| grafanaoperator | object | `{"fullnameOverride":"server-monitoring-grafana-operator","image":{"repository":"quay.io/grafana-operator/grafana-operator","tag":"v5.18.0"}}` | Full values for the Grafana Operator chart can be obtained at: https://github.com/grafana/grafana-operator/blob/master/deploy/helm/grafana-operator/values.yaml |
197220
| grafanaoperator.fullnameOverride | string | `"server-monitoring-grafana-operator"` | Overrides the fully qualified app name. |
198221
| grafanaoperator.image.repository | string | `"quay.io/grafana-operator/grafana-operator"` | Image repository for the Grafana Operator. |
199222
| grafanaoperator.image.tag | string | `"v5.18.0"` | Tag for the Grafana Operator image. |
@@ -220,13 +243,13 @@ Dashboards are provisioned directly from CRDs, which means any manual edits will
220243
| prometheusOperator.prometheusConfigReloader.image.repository | string | `"quay.io/prometheus-operator/prometheus-config-reloader"` | Image repository for Prometheus Config Reloader. |
221244
| prometheusOperator.prometheusConfigReloader.image.tag | string | `"v0.81.0"` | Tag for the Prometheus Config Reloader image. |
222245
| prometheusOperator.replicas | int | `1` | Number of Prometheus Operator replicas to deploy. |
246+
| tempo.customConfig | object | `{}` | Add any custom Tempo configurations you require here. This should be a YAML object of additional settings for Tempo. |
223247
| tempo.enabled | string | `"-"` | Enable Tempo distributed tracing Requires manual installation of Tempo Operator Set to true to enable, false to disable, "-" to use global default |
224248
| tempo.resources | object | `{"limits":{"cpu":"1000m","memory":"2Gi"},"requests":{"cpu":"500m","memory":"1Gi"}}` | Resource requirements for Tempo pods Adjust based on your trace volume and cluster capacity |
225249
| tempo.resources.limits.cpu | string | `"1000m"` | Maximum CPU Tempo pods can use |
226250
| tempo.resources.limits.memory | string | `"2Gi"` | Maximum memory Tempo pods can use |
227251
| tempo.resources.requests.cpu | string | `"500m"` | Minimum CPU guaranteed to Tempo pods |
228252
| tempo.resources.requests.memory | string | `"1Gi"` | Minimum memory guaranteed to Tempo pods |
229-
| tempo.retentionPeriod | string | `"24h"` | Trace retention period How long to keep trace data before deletion |
230253
| tempo.storage | object | `{"traces":{"backend":"memory","size":"20Gi"}}` | Storage configuration for trace data |
231254
| tempo.storage.traces.backend | string | `"memory"` | Storage backend for traces Default: in-memory storage (traces lost on pod restart) Suitable for development/testing environments only |
232255
| tempo.storage.traces.size | string | `"20Gi"` | Storage volume size For memory/pv: actual volume size For cloud backends: size of WAL (Write-Ahead Log) volume Increase for higher trace volumes or longer retention |

README.md.gotmpl

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,30 @@ $ helm install {{ template "chart.name" . }} {{ template "chart.name" . }}/{{ te
5959

6060
#### 3.2 Install Tempo Operator (Optional)
6161

62-
If you plan to enable distributed tracing with Tempo (`tempo.enabled=true`), you must manually install the Tempo Operator by following the official documentation at https://grafana.com/docs/tempo/latest/setup/operator/#installation[]. There is currently no official Helm chart available for the Tempo Operator or its CRDs.
62+
If you plan to enable distributed tracing with Tempo (`tempo.enabled=true`), you must manually install the Tempo Operator. There is currently no official Helm chart available for the Tempo Operator or its CRDs, so manual installation is required. The Tempo Operator also requires cert-manager to be installed in your cluster. Additionally, this reference chart requires the `grafanaOperator` feature gate to be enabled for proper integration with Grafana.
63+
64+
For more detailed installation instructions, refer to the [official Tempo Operator documentation](https://grafana.com/docs/tempo/latest/setup/operator/#installation).
65+
66+
**Prerequisites:**
67+
- cert-manager must be installed in your cluster
68+
69+
**Example installation steps:**
70+
71+
1. Install the Tempo Operator:
72+
```bash
73+
$ kubectl apply -f https://github.com/grafana/tempo-operator/releases/download/v0.16.0/tempo-operator.yaml
74+
```
75+
2. Enable the `grafanaOperator` feature gate (required for integration with Grafana):
76+
```bash
77+
$ kubectl get cm tempo-operator-manager-config -n tempo-operator-system -o yaml | \
78+
sed 's/^ *grafanaOperator: false$/ grafanaOperator: true/' | \
79+
kubectl apply -f -
80+
```
81+
3. Restart the operator deployment to apply the configuration:
82+
```bash
83+
$ kubectl rollout restart deployment/tempo-operator-controller -n tempo-operator-system
84+
$ kubectl wait --for=condition=available --timeout=120s deployment/tempo-operator-controller -n tempo-operator-system
85+
```
6386

6487
### 4. Install the Helm Chart
6588

templates/tempo/tempomonolithic.yaml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,14 @@ spec:
3232
{{- end }}
3333
{{- end }}
3434

35-
# TODO: https://circleci.atlassian.net/browse/ONPREM-2157
36-
# observability:
37-
# grafana:
38-
# dataSource:
39-
# enabled: true
35+
observability:
36+
grafana:
37+
dataSource:
38+
enabled: true
4039

40+
{{- with .Values.tempo.customConfig }}
4141
extraConfig:
42-
tempo:
43-
limits_config:
44-
retention_period: {{ .Values.tempo.retentionPeriod }}
45-
compactor:
46-
ring:
47-
kvstore:
48-
store: inmemory
49-
ingester:
50-
lifecycler:
51-
ring:
52-
kvstore:
53-
store: inmemory
42+
{{ toYaml . | nindent 4 }}
43+
{{- end }}
5444

5545
{{- end }}

tests/tempo/tempomonolithic_test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ tests:
9292
path: spec.storage.traces.size
9393
value: 50Gi
9494

95-
- it: should set retention period
95+
- it: should configure custom distributor config
9696
set:
9797
tempo.enabled: true
98-
tempo.retentionPeriod: 7d
98+
tempo.customConfig:
99+
distributor:
100+
log_received_traces: true
99101
asserts:
100102
- equal:
101-
path: spec.extraConfig.tempo.limits_config.retention_period
102-
value: 7d
103+
path: spec.extraConfig.distributor.log_received_traces
104+
value: true
103105

104106
- it: should not create resource when disabled
105107
set:

values.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ grafanaoperator:
8181
repository: quay.io/grafana-operator/grafana-operator
8282
# -- Tag for the Grafana Operator image.
8383
tag: v5.18.0
84-
env:
85-
# https://github.com/grafana/grafana-operator/issues/1971
86-
- name: ENFORCE_CACHE_LABELS
87-
value: "off"
8884

8985
grafana:
9086
enabled: "-"
@@ -196,6 +192,6 @@ tempo:
196192
# For cloud backends: size of WAL (Write-Ahead Log) volume
197193
# Increase for higher trace volumes or longer retention
198194
size: 20Gi
199-
# -- Trace retention period
200-
# How long to keep trace data before deletion
201-
retentionPeriod: 24h
195+
# -- Add any custom Tempo configurations you require here. This should be a
196+
# YAML object of additional settings for Tempo.
197+
customConfig: {}

0 commit comments

Comments
 (0)