apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-config
  namespace: metrics
  labels:
    app.kubernetes.io/name: grafana
  annotations:
    use-subpath: "true"
data:
  datasources.yaml: |
    apiVersion: 1
    datasources:
      - name: Tempo
        uid: tempo
        orgId: 1
        type: tempo
        access: proxy
        url: "http://tempo:3200"
        jsonData:
          tracesToLogsV2:
            datasourceUid: loki
          tracesToProfiles:
            datasourceUid: pyroscope
            profileTypeId: "process_cpu:cpu:nanoseconds:cpu:nanoseconds"
      - name: Loki
        uid: loki
        type: loki
        access: proxy
        orgId: 1
        url: http://loki:3100
        version: 1
        editable: false
        jsonData:
          timeout: 60
          maxLines: 1000
      - name: Prometheus
        uid: prometheus
        type: prometheus
        access: proxy
        url: http://prometheus-server:9090
        editable: false
        jsonData:
          httpMethod: "POST"
          prometheusType: "Prometheus"
          prometheusVersion: "2.9.1"
          tlsSkipVerify: true
          timeout: 30
      - name: Pyroscope
        uid: pyroscope
        type: grafana-pyroscope-datasource
        access: proxy
        orgId: 1
        url: http://pyroscope:4040
        editable: false

    deleteDatasources:
      - name: "Prometheus"
        uid: prometheus
        orgId: 1