Skip to content

Commit f177c0f

Browse files
authored
Added otlp-gateway as part of validation check (#1202)
* Added otlp-gateway as part of validation check * updated check to use regex instead of contains * added tempo checks * Fixed metrics/logs messaging
1 parent d55e111 commit f177c0f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

charts/k8s-monitoring/templates/destinations/_destination_validations.tpl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,21 @@
1919
{{ fail (printf "\nDestination #%d (%s) is using an unknown type (%s).\nPlease set:\ndestinations:\n - name: %s\n type: \"[%s]\"" $i $destination.name $destination.type $destination.name (include "english_list_or" $types)) }}
2020
{{- end }}
2121

22-
{{/* Check if OTLP destination using Grafana Cloud has protocol set */}}
23-
{{- if and (eq $destination.type "otlp") ($destination.url) (contains ".grafana.net" $destination.url) }}
24-
{{- if ne $destination.protocol "http" }}
25-
{{ fail (printf "\nDestination #%d (%s) is using Grafana Cloud OTLP gateway but has incorrect protocol '%s', the gateway only supports 'http'.\nPlease set:\ndestinations:\n - name: %s\n type: otlp\n url: %s\n protocol: http" $i $destination.name ($destination.protocol | default "grpc (default)") $destination.name $destination.url) }}
22+
{{/* Check if OTLP destination using Grafana Cloud OTLP gateway has protocol set */}}
23+
{{- if and (eq $destination.type "otlp") (ne $destination.protocol "http") (regexMatch "otlp-gateway-.+grafana\\.net" $destination.url) }}
24+
{{ fail (printf "\nDestination #%d (%s) is using Grafana Cloud OTLP gateway but has incorrect protocol '%s', the gateway only supports 'http'.\nPlease set:\ndestinations:\n - name: %s\n type: otlp\n url: %s\n protocol: http" $i $destination.name ($destination.protocol | default "grpc (default)") $destination.name $destination.url) }}
25+
{{- end }}
26+
27+
{{/* Check if OTLP destination using Grafana Cloud Tempo checks */}}
28+
{{- if and (eq $destination.type "otlp") (regexMatch "tempo-.+grafana\\.net" $destination.url) }}
29+
{{- if ne $destination.protocol "grpc" }}
30+
{{ fail (printf "\nDestination #%d (%s) is using Grafana Cloud Traces but has incorrect protocol '%s', the Tempo only supports 'grpc'.\nPlease set:\ndestinations:\n - name: %s\n type: otlp\n url: %s\n protocol: grpc" $i $destination.name ($destination.protocol | default "grpc (default)") $destination.name $destination.url) }}
31+
{{- end }}
32+
{{- if eq $destination.metrics.enabled "true" }}
33+
{{ fail (printf "\nDestination #%d (%s) is using Grafana Cloud Traces but has metrics enabled, the Tempo only supports traces.\nPlease set:\ndestinations:\n - name: %s\n type: otlp\n url: %s\n metrics:\n enabled: false" $i $destination.name $destination.name $destination.url) }}
34+
{{- end }}
35+
{{- if eq $destination.logs.enabled "true" }}
36+
{{ fail (printf "\nDestination #%d (%s) is using Grafana Cloud Traces but has logs enabled, the Tempo only supports traces.\nPlease set:\ndestinations:\n - name: %s\n type: otlp\n url: %s\n logs:\n enabled: false" $i $destination.name $destination.name $destination.url) }}
2637
{{- end }}
2738
{{- end }}
2839

0 commit comments

Comments
 (0)