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

feat: generate Grafonnet for Grafana v11.0.0 #199

Merged
merged 17 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 1 addition & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
.PHONY: generate regenerate localmkdocs test

LATEST := v10.4.0
LATEST := v11.0.0

generate: gen/grafonnet-latest

gen/grafonnet-latest:
./scripts/generate.sh ${LATEST} && \
./scripts/generate_latest.sh ${LATEST}

regenerate: gen/grafonnet-v*

gen/grafonnet-v10.3.0:
./scripts/generate.sh v10.3.0

gen/grafonnet-v10.2.0:
./scripts/generate.sh v10.2.0

gen/grafonnet-v10.1.0:
./scripts/generate.sh v10.1.0

gen/grafonnet-v10.0.0:
./scripts/generate.sh v10.0.0

gen/grafonnet-v9.5.0:
./scripts/generate.sh v9.5.0

gen/grafonnet-v9.4.0:
./scripts/generate.sh v9.4.0

localmkdocs:
python -m venv .mkdocs/.venv; \
source .mkdocs/.venv/bin/activate; \
Expand Down
5 changes: 5 additions & 0 deletions custom/dashboard.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
+ self.time.withFrom('now-6h')
+ self.time.withTo('now'),

'#withSchemaVersion': { 'function'+: { args: [d.arg('value', d.T.integer, default=39)] } },
withSchemaVersion(value=39): {
schemaVersion: value,
},

'#withPanels':: d.func.new(
'`withPanels` sets the panels on a dashboard authoratively. It automatically adds IDs to the panels, this can be disabled with `setPanelIDs=false`.',
args=[
Expand Down
17 changes: 17 additions & 0 deletions custom/query/azureMonitor.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'grafana-azure-monitor-datasource',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
23 changes: 23 additions & 0 deletions custom/query/cloudWatch.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
local withDatasourceStub = {
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'cloudwatch',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
},

CloudWatchAnnotationQuery+: withDatasourceStub,
CloudWatchLogsQuery+: withDatasourceStub,
CloudWatchMetricsQuery+: withDatasourceStub,
}
20 changes: 20 additions & 0 deletions custom/query/elasticsearch.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
bucketAggs+: { '#': { help: '', name: 'bucketAggs' } },
metrics+: { '#': { help: '', name: 'metrics' } },

'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'elasticsearch',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
12 changes: 12 additions & 0 deletions custom/query/expr.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
'#': {
help: 'Server Side Expression operations for grafonnet.alerting.ruleGroup.rule',
name: 'expr',
},
TypeMath+: { '#': { help: 'grafonnet.query.expr.TypeMath', name: 'TypeMath' } },
TypeReduce+: { '#': { help: 'grafonnet.query.expr.TypeReduce', name: 'TypeReduce' } },
TypeResample+: { '#': { help: 'grafonnet.query.expr.TypeResample', name: 'TypeResample' } },
TypeClassicConditions+: { '#': { help: 'grafonnet.query.expr.TypeClassicConditions', name: 'TypeClassicConditions' } },
TypeThreshold+: { '#': { help: 'grafonnet.query.expr.TypeThreshold', name: 'TypeThreshold' } },
TypeSql+: { '#': { help: 'grafonnet.query.expr.TypeSql', name: 'TypeSql' } },
}
17 changes: 17 additions & 0 deletions custom/query/googleCloudMonitoring.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'cloud-monitoring',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
17 changes: 17 additions & 0 deletions custom/query/grafanaPyroscope.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'grafanapyroscope',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
1 change: 1 addition & 0 deletions custom/query/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
17 changes: 17 additions & 0 deletions custom/query/parca.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(value): {
datasource+: {
type: 'parca',
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
1 change: 1 addition & 0 deletions custom/query/prometheus.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
1 change: 1 addition & 0 deletions custom/query/tempo.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
uid: value,
},
},
'#withDatasourceMixin':: { ignore: true },
}
17 changes: 17 additions & 0 deletions custom/query/testData.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';

{
'#withDatasource':: d.func.new(
'Set the datasource for this query.',
args=[
d.arg('value', d.T.string),
]
),
withDatasource(): {
datasource+: {
type: 'datasource',
uid: 'grafana',
},
},
'#withDatasourceMixin':: { ignore: true },
}
18 changes: 16 additions & 2 deletions docs/API/accesspolicy/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@

## Index

* [`fn withKind(value)`](#fn-withkind)
* [`fn withKind(value="*")`](#fn-withkind)
* [`fn withTarget(value)`](#fn-withtarget)
* [`fn withVerb(value)`](#fn-withverb)
* [`fn withVerbMixin(value)`](#fn-withverbmixin)

## Fields

### fn withKind

```jsonnet
withKind(value)
withKind(value="*")
```

PARAMETERS:

* **value** (`string`)
- default value: `"*"`

The kind this rule applies to (dashboards, alert, etc)
### fn withTarget
Expand All @@ -42,5 +44,17 @@ PARAMETERS:

* **value** (`string`)

READ, WRITE, CREATE, DELETE, ...
should move to k8s style verbs like: "get", "list", "watch", "create", "update", "patch", "delete"
### fn withVerbMixin

```jsonnet
withVerbMixin(value)
```

PARAMETERS:

* **value** (`string`)

READ, WRITE, CREATE, DELETE, ...
should move to k8s style verbs like: "get", "list", "watch", "create", "update", "patch", "delete"
Loading
Loading