moxious / triage

testing triage actions for issues
0 stars 1 forks source link

Annotations: Switching data source to builtin doesn't remove mappings #349

Open tonypowa opened 1 month ago

tonypowa commented 1 month ago

What happened?

For most data sources (e.g. Static), we can map the annotation details (e.g. title and text) to fields. This makes no sense for builtin data source, hence with #51256 the configuration UI was hidden. But existing mappings still exist in the model and are used when displaying annotations. This leads to the strange effect that e.g. the text isn't visible in the tooltip, although it is stored in the DB.

What did you expect to happen?

Mappings should be cleared when switching to an annotation data source which doesn't support them, or at least they shouldn't be considered when processing annotations.

Did this work before?

Not that I'm aware of.

How do we reproduce it?

  1. Create a new annotation of type "Static".

  2. Add two fields, "abc" and "def".

  3. Map "title" and "text" to these two fields.

  4. Click "Apply".

  5. Verify in the JSON model of the dashboard that the mappings are filled.

  6. Edit the annotation and change the data source to "-- Grafana --".

  7. Observe that mappings are no longer visible in the UI.

  8. Click "Apply".

  9. Find that the mappings still exist in the JSON model.

The following steps can't be executed on the playground since I can't seem to add any annotations:

  1. Go back to the panel and create an annotation with some text.

  2. Hover the annotation and observe that the text isn't shown.

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

I tried most of the steps in the playground:

Grafana: Grafana v11.1.0-69950 (a4bb4c8400)

OS:

Browser: Chrome 124

Grafana platform?

None

Datasource(s)?

No response

tonypowa commented 1 month ago

This issue is a test copy of an issue in another repo. Original issue: https://github.com/grafana/grafana/issues/#87491

moxious commented 1 month ago

Summary: When switching an annotation's data source to built-in in Grafana, existing mappings are not removed, causing issues like annotation text not being displayed, even though it's stored in the database. The expected behavior would be for the mappings to clear or to be ignored for data sources that do not use them.

moxious commented 1 month ago

Hello @tonypowa, it looks like this issue is related to the handling of annotations within Grafana. Considering the details you've provided, this appears to be best suited for the Grafana Metrics project. The issue pertains to the usage and configuration of annotations, which is often tied to metrics and dashboarding functionalities. I will label this issue accordingly for the team associated with the Grafana Metrics project to take a look.

moxious commented 1 month ago

Elaboration:

Hello @tonypowa, thank you for reporting the issue! 🌟 Your detailed account on the annotation data source problem is very helpful. To better assist you and to replicate the problem, could you please provide a bit more information? Here are some questions and requests to help identify the issue accurately:

Once we have this additional information, we will be in a better position to determine the cause of the issue and work towards a fix.