apiVersion: v1 kind: ConfigMap metadata: name: grafana-datasources namespace: monitoring data: prometheus.yaml: | apiVersion: 1 datasources: - name: Prometheus type: prometheus access: proxy url: http://prometheus:9090 isDefault: true editable: true loki.yaml: | apiVersion: 1 datasources: - name: Loki type: loki access: proxy url: http://loki.logging.svc.cluster.local:3100 editable: true jsonData: maxLines: 1000 derivedFields: # 支持从日志跳转到 Tempo traces - datasourceUid: tempo matcherRegex: "trace_id=(\\w+)" name: TraceID url: '$${__value.raw}' tempo.yaml: | apiVersion: 1 datasources: - name: Tempo type: tempo access: proxy url: http://tempo.tracing.svc.cluster.local:3200 editable: true uid: tempo jsonData: # 支持 Trace to Logs tracesToLogs: datasourceUid: 'loki' tags: ['pod', 'namespace', 'container'] mappedTags: [{ key: 'service.name', value: 'app' }] mapTagNamesEnabled: true spanStartTimeShift: '-1h' spanEndTimeShift: '1h' filterByTraceID: true filterBySpanID: false # 服务图谱 serviceMap: datasourceUid: 'prometheus' # 搜索配置 search: hide: false # Node Graph nodeGraph: enabled: true # Loki 搜索 lokiSearch: datasourceUid: 'loki'