apiVersion: 1

datasources:
  - name: Prometheus
    type: prometheus
    uid: prometheus
    access: proxy
    orgId: 1
    url: http://prometheus:9090
    basicAuth: false
    isDefault: true
    version: 1
    editable: false
    jsonData:
      httpMethod: GET

  - name: Loki
    type: loki
    uid: loki
    url: http://loki:3100
    access: proxy
    basicAuth: false
    jsonData:
      derivedFields:
        - name: Tempo
          datasourceUid: tempo
          matcherRegex: '"trace_id":"(\w+)"'
          url: '$${__value.raw}'
          urlDisplayLabel: 'View Trace'

  - name: Tempo
    type: tempo
    uid: tempo
    access: proxy
    url: http://tempo:3200
    basicAuth: false
    jsonData:
      tracesToLogsV2:
        datasourceUid: 'loki'
        customQuery: true
        query: '{app_name="my-app"}  | json | trace_id="$${__trace.traceId}"'
        spanStartTimeShift: '-5m'
        spanEndTimeShift: '5m'
