Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GrafanaDataSource CRD does not line up with the documented structure #837

Closed
NickLarsenNZ opened this issue Oct 18, 2022 · 4 comments
Labels
feature-request requests a new feature that currently isn't implemented in the project good first issue Good for newcomers help wanted Extra attention is needed triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@NickLarsenNZ
Copy link

Describe the bug
There is little documentation for how to setup a GrafanaDataSource for Tempo (at least from what I could find). Because of that, I have referred to the Grafana documentation for the Tempo Datasource.

Version
4.7.0

To Reproduce
Steps to reproduce the behavior:

  1. Create a GrafanaDataSource that matches the documentation structure:
    apiVersion: integreatly.org/v1alpha1
    kind: GrafanaDataSource
    metadata:
      name: tempo
    spec:
      name: datasource-tempo.yaml
      datasources:
      - name: Tempo
        type: tempo
        access: proxy
        url: http://tempo:3100
        isDefault: false
        version: 1
        editable: false
        jsonData:
          nodeGraph:
            enabled: true
          search:
            hide: false
          serviceMap:
            datasourceUid: prometheus
          tracesToLogs:
            datasourceUid: loki
            # tags: [] # default: ['cluster', 'hostname', 'namespace', 'pod']
            # mappedTags: # Not in the CRD
            mapTagNamesEnabled: false # Not in the CRD
            spanStartTimeShift: 5m
            spanEndTimeShift: 5m
            filterByTraceID: false
            filterBySpanID: false
          # tracesToMetrics: # Not in the CRD
          lokiSearch: #! Not in the CRD, but the CRD shows this being a boolean under tracesToLogs
            datasourceUid: loki
    
  2. When applying the CRD, you should see the following error (formatted for readability):
    error validating data:
      ValidationError(GrafanaDataSource.spec.datasources[0].jsonData):
        unknown field "lokiSearch" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData, 
      ValidationError(GrafanaDataSource.spec.datasources[0].jsonData.tracesToLogs):
        unknown field "mapTagNamesEnabled" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources.jsonData.tracesT
    

Expected behavior
I would expect the jsonData structure as per Grafana docs to be accepted.

Suspect component/Location where the bug might be occuring

https://github.com/grafana-operator/grafana-operator/blob/e40bcf5106e7ae6cf3a44958b9dd7be21ba3228d/config/crd/bases/integreatly.org_grafanadatasources.yaml#L280-L299

and in the parent object

Screenshots

Runtime (please complete the following information):

  • OS: Linux
  • Grafana Operator Version: 4.7.0
  • Environment: AWS EKS
  • Deployment type: deployed
  • Other:

Additional context

@NickLarsenNZ NickLarsenNZ added bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 18, 2022
@NissesSenap
Copy link
Collaborator

We don't support all fields specified in grafana, they are to many changes for us to continuously update. Instead we add features when people ask for them just like you are now.

Look at the example tempo crd: https://github.com/grafana-operator/grafana-operator/blob/master/deploy/examples/datasources/Tempo.yaml.
Just like the error says you need to have lokiSearch under tracesToLogs. This can also be seen in the api docs:
https://github.com/grafana-operator/grafana-operator/blob/master/documentation/api.md#grafanadatasourcespecdatasourcesindexjsondatatracestologs

Also you are linking to grafana 9 docs, by default this operator supports grafana 7. It normally works to upgrade to grafana 8-9 but it would be a breaking change for us in the operator so that is why we don't update the default image.

We are currently working on a big rework of the operator and in version 5 we will only support grafana 9 and forward.
Now a days there is also a filed called customJsonData which you can define to add any config that you want to help out with tasks like this.

So if you need mapTagNamesEnabled you should be able to define in there. I haven't tried to keep the config in to locations, it's probably easiest to just have the tracesToLogs config in one location, so in your case inside customJsonData.

If you still want mapTagNamesEnabled as a part of the CRD we are happy to take PR:s in this area.

@NissesSenap NissesSenap added help wanted Extra attention is needed good first issue Good for newcomers triage/accepted Indicates an issue or PR is ready to be actively worked on. feature-request requests a new feature that currently isn't implemented in the project and removed bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 18, 2022
@NickLarsenNZ
Copy link
Author

Thanks @NissesSenap, customJsonData is what I need :)

@Bastian82
Copy link

Hi,
Can you tell me which version of grafana-operator has customJsonData implemented? Im using bitnami helm chats
docker.io/bitnami/grafana-operator:4.7.1-debian-11-r0
but got error:
error: error validating "STDIN": error validating data: ValidationError(GrafanaDataSource.spec.datasources[0]): unknown field "customJsonData" in org.integreatly.v1alpha1.GrafanaDataSource.spec.datasources; if you choose to ignore these errors, turn validation off with --validate=false

I need to add custom fields to be able to add opensearch datasource.
Thanks in advance

@NissesSenap
Copy link
Collaborator

We don't support the bitnami helm chart so I don't know how they follow the grafana-operator versions.
But this fix was solved in #803 and it was released in 4.6.0
https://github.com/grafana-operator/grafana-operator/releases/tag/v4.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request requests a new feature that currently isn't implemented in the project good first issue Good for newcomers help wanted Extra attention is needed triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants