Skip to content

Example of annotation ? #93

Closed Answered by Duologic
abhishek-1985 asked this question in Q&A
Discussion options

You must be logged in to vote

The annotations part of grafonnet has not received a lot of attention yet. I just had a quick look at how to do this with the current code but it not very user-friendly yet.

local grafonnet = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local annotation = g.dashboard.annotation;

your_dashboard
+ g.dashboard.withAnnotations([
  annotation.datasource.withType('prometheus')
  + annotation.datasource.withUid('default')
  + annotation.withName('A vector annotation')
  + {
    // adding these here as the upstream schema does not implement them yet, so there is not function for it
    expr: 'vector(1)',
    enabled: true,
  },
])

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Duologic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #89 on August 18, 2023 08:04.