Skip to content

Instantly share code, notes, and snippets.

@sdboyer
Last active August 3, 2022 01:05
Show Gist options
  • Save sdboyer/3f7c1ac4bbb64c8b9658230e0b9c7cc0 to your computer and use it in GitHub Desktop.
Save sdboyer/3f7c1ac4bbb64c8b9658230e0b9c7cc0 to your computer and use it in GitHub Desktop.
Example grafana datasource plugin slot implementations (query and dsoptions) for prometheus datasource plugin
package dsschema
import "github.com/grafana/thema"
Query: thema.#Lineage & {
name: "prometheus"
seqs: [
{
schemas: [
{// 0.0
expr: string
legendFormat: string
interval: string
intervalMS: int64
stepMode: string
range: bool | *true
instant: !range
exemplar: bool | *false
intervalFactor: int64
utcOffsetSec: int64
},
]
},
]
}
DSOptions: thema.#Lineage & {
name: "prometheus"
seqs: [
{
schemas: [
{// 0.0
Options: {
timeInterval: string | *"15s"
httpMethod: "GET" | *"POST"
queryTimeout?: string
directUrl?: string
customQueryParameters?: string
disableMetricsLookup?: boolean
}
SecureOptions: {
basicAuthUser?: string
basicAuthPassword?: string
}
},
]
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment