grafana / grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
https://grafana.github.io/grafana-operator/
Apache License 2.0
916 stars 397 forks source link

[Bug] Can't create GrafanaDatasource for Tempo with traceToLogs #674

Closed slenky closed 2 years ago

slenky commented 2 years ago

Describe the bug I am trying to create a Tempo datasource using that example

apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
metadata:
  name: tempo
spec:
  name: tempo.yaml
  datasources:
    - name: Tempo
      uid: tempo-datasource
      type: tempo
      access: proxy
      url: http://tempo:3100
      isDefault: false
      version: 1
      editable: false
      jsonData:
        httpMethod: "GET"
        nodeGraph:
          enabled: true
        search:
          hide: false
        serviceMap:
          datasourceUid: "thanos-datasource"
        tracesToLogs:
          datasourceUid: "loki-datasource"
          filterBySpanID: false
          filterByTraceID: false
          lokiSearch: true
          spanEndTimeShift: "1h"
          spanStartTimeShift: "1h"
          tags:
          - "job"
          - "instance"
          - "pod"
          - "namespace"

However, I recieve an error:

unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(GrafanaDataSource.spec.datasources[0].jsonData): unknown field "nodeGraph" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData, ValidationError(GrafanaDataSource.spec.datasources[0].jsonData): unknown field "search" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData, ValidationError(GrafanaDataSource.spec.datasources[0].jsonData): unknown field "serviceMap" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData, ValidationError(GrafanaDataSource.spec.datasources[0].jsonData.tracesToLogs): unknown field "filterBySpanID" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData.tracesToLogs, ValidationError(GrafanaDataSource.spec.datasources[0].jsonData.tracesToLogs): unknown field "filterByTraceID" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData.tracesToLogs, ValidationError(GrafanaDataSource.spec.datasources[0].jsonData.tracesToLogs): unknown field "lokiSearch" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData.tracesToLogs]

Some fields in jsonData are not up-to-date (at least according to Grafana docs they should be present):

.jsonData.nodeGraph
.jsonData.search
.jsonData.serviceMap
.jsonData.traceToLogs.filterBySpanID
.jsonData.traceToLogs.filterByTraceID
.jsonData.traceToLogs.lokiSearch

Version v.4.1.1

To Reproduce Steps to reproduce the behavior:

  1. Install operator and try to apply manifest above.

Expected behavior Tempo datasource with links to prometheus/loki created.

Suspect component/Location where the bug might be occuring during datasource creation

Screenshots If applicable, add screenshots to help explain your problem.

Runtime (please complete the following information):

NissesSenap commented 2 years ago

Thanks for bringing this to our attention @slenky. We haven't implemented all the config values that exist in grafana since they get updated so regularly. We would love to have this feature in the operator.

Is this something that you would be willing to try to implement on your own? You can for example look at: https://github.com/grafana-operator/grafana-operator/pull/609

slenky commented 2 years ago

@NissesSenap thanks for a good example and operator as well :) I've opened a PR to fix that.