grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.42k stars 208 forks source link

Bundle alloy-mixin as release asset #162

Open rfratto opened 7 months ago

rfratto commented 7 months ago

Request

Bundle alloy-mixin as one of the release assets so users can install it without having to clone the repo.

This should likely be bundled as a rendered set of dashboards in a Zip instead of Jsonnet; not everyone will want to install Jsonnet and/or Grizzly to deploy the dashboards.

Use case

Lower the number of steps it takes to gain access to the official Alloy dashboards/alerts.

M0NsTeRRR commented 7 months ago

Linked to #184

github-actions[bot] commented 6 months ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

algo7 commented 4 months ago

Is there a documentation somewhere explaining how to generate the dashboard and alert rules provided under the alloy-mixin directory?

Skaronator commented 4 months ago

Currently trying to figure that out myself. It looks like you need jsonnet and jsonnet-bundler.

Then run within the operations/alloy-mixin directory the install command:

jb install

After that, you should be able to generate the dashboards for my understanding but nothing works.

$ jsonnet dashboards.libsonnet
{ }
$ jsonnet grizzly.jsonnet
RUNTIME ERROR: couldn't open import "github.com/grafana/jsonnet-libs/logs-lib/logs/main.libsonnet": no match locally or in the Jsonnet library paths.
    ./grizzly/../././dashboards/alloy-logs.libsonnet:2:23-92    thunk <logsDashboard>
    ./grizzly/../././dashboards/alloy-logs.libsonnet:12:9-22    thunk <alloyLogs>
    ./grizzly/../././dashboards/alloy-logs.libsonnet:36:24-33   object <anonymous>
    ./grizzly/dashboards.jsonnet:23:13-42   object <anonymous>
    ./grizzly/dashboards.jsonnet:(15:15)-(26:4) object <anonymous>
    ./grizzly/dashboards.jsonnet:(15:15)-(26:4) object <anonymous>
    During manifestation
Skaronator commented 4 months ago

Okay, I figured it out using Grizzly. Not sure if you need the jsonnet bundler from my last post, but this works:

grr export -o json grizzly.jsonnet .

Edit: Okay grizzly exports are not grafana dashboards :roll_eyes: but I think the .spec field is the actual dashboard.

NissesSenap commented 4 months ago

It has been on my TODO to do some upstream PR around this for a while, but sadly I haven't had the time. After getting some help from a Grafana employee, I managed to get this to work.

First, tell grr to only generate local files

grr config set only-spec true
# the grafana token and URL won't be used, but they have to be there for grizzly to work
grr config set grafana.url http://localhost:3000/
grr config set grafana.token abcd12345 #this don't matter

Time to build alloy specific stuff

cd operations/alloy-mixin
grr export grizzly.jsonnet output -o json
# grr also supports yaml output, which can be useful if you want the prometheusRules.
grr export grizzly.jsonnet output2 -o yaml

Make sure you are using grr 0.4.2 or later, else stuff won't work. See https://github.com/grafana/grizzly/pull/436 for more info.

Hopefully this helps @algo7 and @Skaronator

algo7 commented 4 months ago

Okay, I figured it out using Grizzly. Not sure if you need the jsonnet bundler from my last post, but this works:

grr export -o json grizzly.jsonnet .

Edit: Okay grizzly exports are not grafana dashboards 🙄 but I think the .spec field is the actual dashboard.

Yes. The spec part of the manifests generated by grr is actually the rules and the dashboards that can be used with Grafana directly.

I did

cat dashboard_or_rule.json | jq ".spec"

and just use the output directly.

algo7 commented 4 months ago

It has been on my TODO to do some upstream PR around this for a while, but sadly I haven't had the time. After getting some help from a Grafana employee, I managed to get this to work.

First, tell grr to only generate local files

grr config set only-spec true
# the grafana token and URL won't be used, but they have to be there for grizzly to work
grr config set grafana.url http://localhost:3000/
grr config set grafana.token abcd12345 #this don't matter

Time to build alloy specific stuff

cd operations/alloy-mixin
grr export grizzly.jsonnet output -o json
# grr also supports yaml output, which can be useful if you want the prometheusRules.
grr export grizzly.jsonnet output2 -o yaml

Make sure you are using grr 0.4.2 or later, else stuff won't work. See grafana/grizzly#436 for more info.

Hopefully this helps @algo7 and @Skaronator

I managed to figured it out reading grizzly doc. I was spending so much time with jsonnet and jb when referencing the Kubernetes Mixin

Thanks for replying :+1: . Should help other people facing the similar issue before the doc comes out; and it's good to know that it's on the way :tada: