Coding a Loki derived field of type Internal Link in the datasources.yaml file

I have a docker compose file with application containers and one container each for Prometheus, Loki, Zipkin and Grafana.

I am trying to code a derived field of type Internal Link in the datasources.yaml file mounted in the Grafana container. But the below snippet doesn’t seem to work. The Grafana UI does not show this derived field as an internal link (internal link toggle is disabled).

apiVersion: 1

datasources:

  - name: Zipkin
    type: zipkin
    access: proxy
    url: http://zipkin:9411
    editable: true
    
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://prometheus:9090
    editable: true

  - name: Loki
    type: loki
    access: proxy
    url: http://loki:3100
    editable: true
    isDefault: true
    jsonData:
      derivedFields:
        - datasourceName: Zipkin
          matcherRegex: "\\[.*,(\\w+),.*,.*\\]"
          name: TraceID
          url: "${__value.raw}"

https://grafana.com/docs/grafana/latest/features/datasources/loki/ has an example snippet, but that uses “datasourceUid”. I doubt that the datasourceUid is available during design time.

What am I missing?

Also, I am able to get the internal link working using the Grafana UI. Is there a way to export the datasources.yaml from a running Grafana instance?

Thanks for your help.

cheers,
senthil

Hello @senthilcool! :wave: Please, check out this github issue to see more information/guidance on how to set this up:

1 Like

Hi @ivanahuckova, :ok_hand:. :pray: