-
Notifications
You must be signed in to change notification settings - Fork 0
/
datasources.yml
108 lines (98 loc) · 3.52 KB
/
datasources.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# documentation for this is sometimes a bit lacking but you can see clues from https://github.com/grafana/grafana/blob/main/devenv/datasources.yaml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
basicAuth: false
isDefault: false
version: 1
editable: false
jsonData:
httpMethod: GET
# manageAlerts: true
# alertmanagerUid: gdev-alertmanager
# prometheusType: Prometheus #Cortex | Mimir | Prometheus | Thanos
# prometheusVersion: 2.40.0
exemplarTraceIdDestinations:
- name: traceID
datasourceUid: tempo
- name: Tempo
type: tempo
uid: tempo
access: proxy
orgId: 1
url: http://tempo:3200
basicAuth: false
isDefault: true
version: 1
editable: true
apiVersion: 1
jsonData:
httpMethod: GET
serviceMap: # This enables the "service graph" tab on the tempo explore page
datasourceUid: 'prometheus'
lokiSearch: # This enables the "loki search" tab on the tempo explore page
datasourceUid: 'loki'
nodeGraph: # This enables the "node graph" panel when viewing a trace
enabled: true
search:
hide: false
tracesToLogsV2:
datasourceUid: loki
spanStartTimeShift: '-10m'
spanEndTimeShift: '10m'
filterByTraceID: false
filterBySpanID: false
customQuery: true
tags:
- { key: 'service.name', value: 'service_name' }
query: '{app="boomer"} | logfmt |= "$${__span.traceId}"'
# both of these result in grafana failing to link to the logs
#
# query: '{app="boomer"} | logfmt | service_name="$${__span.tags.service_name}" |= "$${__span.traceId}"'
# query: '{app="boomer"} | logfmt | service_name="$${service_name}" | trace_id="$${__span.traceId}"'
tracesToMetrics:
datasourceUid: 'prometheus'
spanStartTimeShift: '-1h'
spanEndTimeShift: '1h'
tags: # used for the queries below
# tag keys here are the span/resource attributes
# tag values (if specified) are the prometheus label names .. if not specified this defaults to the tag key
- { key: 'service.name', value: 'service' }
queries:
# 2023-12-22 : queries only support "$__tags" interpolation: https://github.com/grafana/grafana/blob/feb7b38fba1f8d694395efa803c742d2678eab7e/public/app/features/explore/TraceView/createSpanLink.tsx#L589
# - This is pretty limiting as you can't use the span name
# - You can quite easily set a breakpoint on that function in your browser
- name: 'count/2min'
query: 'increase(traces_spanmetrics_calls_total{$$__tags}[2m])'
- name: Loki
type: loki
uid: loki
access: proxy
orgId: 1
url: http://loki:3100
version: 1
editable: false
isDefault: false
correlations: # https://grafana.com/docs/grafana/latest/administration/correlations/
- targetUID: prometheus
label: "Logs to metrics"
description: "Related metrics stored in Prometheus"
config:
type: query
target:
expr: >
{ job="boomer" }
field: "TraceID" # matches the derived field name in the datasource below
jsonData:
maxLines: 1000
derivedFields: # Field with internal link pointing to data source in Grafana.
- datasourceUid: tempo
matcherRegex: "trace_id=(\\w+)"
name: TraceID
url: '$${__value.raw}' # url will be interpreted as query for the datasource
urlDisplayLabel: 'View Trace' # optional for URL Label to set a custom display label for the link