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

annotations appear in more than one panel for a snapshot #12278

Closed
londonanthonyoleary opened this issue Jun 14, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@londonanthonyoleary
Copy link

commented Jun 14, 2018

I asked this question yesterday but got no reply: I have a simple dashboard with just two chart panels. when i create an annotation manually for one chart in grafan 5, it only appears for that chart/panel as expected, not on the other chart in the dashboard. but when i do a local snapshot using the UI, that annotation appears on both charts? is this a known bug, or if any work around.
in the same dashobard, i deleted a chart. saved the dashboard. created a new chart but an annotation from the previous deleted chart appeared in it before even adding any metric or datasource.

i also have a tool i use for generating snapshots using the rest api i included the annotations for all dashboards in the snapshot data json, then i do the snapshot for a specific dashboard, except annotations from other dashboards are included in the specific snapshot i want (easier just to request all annotations for me). so there is definitely a bug in grafana that does not check the panel ID's & dashboard ID combination correctly for snapshot annotations.

I have found so many snapshot issues, it is just not fun anymore, and my company might cancel the use of snapshots now.

@marefr marefr added this to the 5.2 milestone Jun 15, 2018

@marefr

This comment has been minimized.

Copy link
Member

commented Jun 15, 2018

Definitely a bug. Seems like the snapshotted annotations is correct, but the problem is that "live" annotations query incorrectly are loaded for snapshot.

@marefr

This comment has been minimized.

Copy link
Member

commented Jun 18, 2018

@londonanthonyoleary we found the bug which is caused by the annotation properties is not copied correctly when creating a snapshot. If you do snapshots thru api, please make sure to include the annotation properties as seen in fix https://github.com/grafana/grafana/pull/12317/files#diff-df8464dc479987e73062daf66a5853b7R126

marefr added a commit that referenced this issue Jun 18, 2018

@londonanthonyoleary

This comment has been minimized.

Copy link
Author

commented Jun 20, 2018

Thanks for very for looking at it:
for your fix to add the fields, these fields are not contained in the api/annotations GET , so wonder if i should just hard code them?

In the golang snapshot tool, i call the GET annotations API:
params := "api/annotations?from=" + from + "&to=" + to
req, err := http.NewRequest("GET", reqURL.String()+params, nil)

But the response does not contain these fields:

  •    type: annotation.type,
    
  •        builtIn: annotation.builtIn,
    
  •        hide: annotation.hide
    

the response is:
[{"id":118,"alertId":0,"alertName":"","dashboardId":44,"panelId":3,"userId":0,"newState":"","prevState":"","time":1529493722000,"text":"aaa","regionId":117,"tags":["aaatag"],"login":"aoleary","email":"aoleary","avatarUrl":"/avatar/818c48ea93775ff32805d051bb74f641","data":{}},{"id":117,"alertId":0,"alertName":"","dashboardId":44,"panelId":3,"userId":0,"newState":"","prevState":"","time":1529493705000,"text":"aaa","regionId":117,"tags":["aaatag"],"login":"aoleary","email":"aoleary","avatarUrl":"/avatar/818c48ea93775ff32805d051bb74f641","data":{}}]

@marefr

This comment has been minimized.

Copy link
Member

commented Jun 20, 2018

@londonanthonyoleary I was referring to when creating a new snapshot thru HTTP API - then you provide the dashboard json model and where the annotations are specified, for each annotations you should add those fields to each annotation. But please note that you'll need to provide real values for them, i.e.

type: 'dashboard' | 'tags',
builtIn: true | false,
hide: true | false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.