Override URL Label for Loki derivedFields

  • What Grafana version and what operating system are you using?
    Grafana 8.2.6
    Loki 2.5.0

  • What are you trying to achieve?
    I am running Loki and Tempo and I have a derivedField in my Grafana data sources config to link from my logs in Loki to my traces in Tempo. This is working but I would like to override the name of the button that shows up in Loki to say something more meaningful than “Tempo”

  • How are you trying to achieve it?
    This seems to be configurable because if I browse the Grafana UI and click on Data Sources → Loki, I can see this field called “URL Label”:


    However, I am not sure how to set this via config in my data sources file and I cannot find an example in the documentation.

  • Can you copy/paste the configuration(s) that you are having problems with?
    My data sources config:

apiVersion: 1

datasources:
- name: Prometheus
  type: prometheus
  access: proxy
  orgId: 1
  url: http://prometheus:9090
  basicAuth: false
  isDefault: false
  version: 1
  editable: false
- name: Tempo
  type: tempo
  access: proxy
  orgId: 1
  url: http://tempo:3200
  basicAuth: false
  isDefault: false
  version: 1
  editable: true
  apiVersion: 1
  uid: tempo
  jsonData:
    httpMethod: GET
    tracesToLogs:
      datasourceUid: 'loki'
      tags: ['job', 'instance', 'pod', 'namespace']
      mappedTags: [{ key: 'service.name', value: 'service' }]
      mapTagNamesEnabled: false
      spanStartTimeShift: '1h'
      spanEndTimeShift: '1h'
      filterByTraceID: false
      filterBySpanID: false
    search:
      hide: false
    lokiSearch:
      datasourceUid: 'loki'
- name: Loki
  type: loki
  access: proxy
  url: http://gateway:3100
  uid: loki
  editable: false
  isDefault: true
  jsonData:
    derivedFields:
    - datasourceUid: tempo
      matcherRegex: .*\,\"TraceId\":\"(\w+)\"
      url: '$${__value.raw}'
      name: TraceID
      urlLabel: "View Trace"
    httpHeaderName1: "X-Scope-OrgID"
  secureJsonData:
    httpHeaderValue1: "tenant1"

You can see there I tried using urlLabel: as the setting but that doesn’t work.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors but the link is still called “Tempo”

  • Did you follow any online instructions? If so, what is the URL?
    I dug through the various online guides and couldn’t find how to set this setting… Hence this post.

The parameter for the label override is as follows:

urlDisplayLabel: "View Trace"

(Taken from source because the documentation seemingly doesn’t contain it)