Skip to content

prometheus: improve UX, add grafana, node_exporter, custom dashboards#82656

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
tbg:roachtest-grafana
Jun 9, 2022
Merged

prometheus: improve UX, add grafana, node_exporter, custom dashboards#82656
craig[bot] merged 1 commit intocockroachdb:masterfrom
tbg:roachtest-grafana

Conversation

@tbg
Copy link
Copy Markdown
Member

@tbg tbg commented Jun 9, 2022

We already had the ability to deploy a prometheus instance to a node in
the cluster. However, to run experiments / long investigations1 we
often need a Grafana instance with the dashboards du jour. This commit
dramatically cuts down on the manual steps needed to get this set up.

All it takes is adding setup like this to the roachtest:

clusNodes := c.Range(1, c.Spec().NodeCount-1)
workloadNode := c.Node(c.Spec().NodeCount)
promNode := workloadNode
cfg := (&prometheus.Config{}).
        WithPrometheusNode(promNode).
        WithCluster(clusNodes).
        WithGrafanaDashboard("https://gist.githubusercontent.com/tbg/f238d578269143187e71a1046562225f/raw").
        WithNodeExporter(clusNodes).
        WithWorkload(workloadNode, 2112).
        WithWorkload(workloadNode, 2113)

p, saveSnap, err := prometheus.Init(
        ctx,
        *cfg,
        c,
        t.L(),
        repeatRunner{C: c, T: t}.repeatRunE,
)
require.NoError(t, err)
defer saveSnap(ctx, t.ArtifactsDir())

There has been talk2 of adding some of this tooling to roachprod.
Probably a good idea, but we can pour infinite amount of work into this,
and for now I think this is a good stepping stone and satisfies my
immediate needs.

Release note: None

Footnotes

  1. https://github.com/cockroachdb/cockroach/issues/82109

  2. internal slack

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@tbg tbg requested a review from nicktrav June 9, 2022 08:22
@tbg
Copy link
Copy Markdown
Member Author

tbg commented Jun 9, 2022

cc @irfansharif @msbutler

@tbg tbg marked this pull request as ready for review June 9, 2022 08:23
@tbg tbg requested a review from a team as a code owner June 9, 2022 08:23
@tbg tbg requested review from erikgrinaker and removed request for a team June 9, 2022 08:23
@tbg tbg force-pushed the roachtest-grafana branch from a8cc58a to 69c52ce Compare June 9, 2022 08:26
Copy link
Copy Markdown
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely agree that this belongs in roachprod, but seems useful enough as an intermediate step. Only skimmed the code itself, given the ad hoc nature.

We already had the ability to deploy a prometheus instance to a node in
the cluster. However, to run experiments / long investigations[^1] we
often need a Grafana instance with the dashboards du jour. This commit
dramatically cuts down on the manual steps needed to get this set up.

All it takes is adding setup like this to the roachtest:

```
clusNodes := c.Range(1, c.Spec().NodeCount-1)
workloadNode := c.Node(c.Spec().NodeCount)
promNode := workloadNode
cfg := (&prometheus.Config{}).
        WithCluster(clusNodes).
        WithPrometheusNode(promNode).
        WithGrafanaDashboard("https://gist.githubusercontent.com/tbg/f238d578269143187e71a1046562225f/raw").
        WithNodeExporter(clusNodes).
        WithWorkload(workloadNode, 2112).
        WithWorkload(workloadNode, 2113)

p, saveSnap, err := prometheus.Init(
        ctx,
        *cfg,
        c,
        t.L(),
        repeatRunner{C: c, T: t}.repeatRunE,
)
require.NoError(t, err)
defer saveSnap(ctx, t.ArtifactsDir())
```

There has been talk[^2] of adding some of this tooling to `roachprod`.
Probably a good idea, but we can pour infinite amount of work into this,
and for now I think this is a good stepping stone and satisfies my
immediate needs.

[^1]: cockroachdb#82109
[^2]: [internal slack](https://cockroachlabs.slack.com/archives/CAC6K3SLU/p1654267035695569?thread_ts=1654153265.215669&cid=CAC6K3SLU)

Release note: None
@tbg tbg force-pushed the roachtest-grafana branch from 69c52ce to a442b27 Compare June 9, 2022 11:55
@tbg
Copy link
Copy Markdown
Member Author

tbg commented Jun 9, 2022

bors r=erikgrinaker
TFTQR!

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 9, 2022

Build succeeded:

@craig craig bot merged commit c520ac8 into cockroachdb:master Jun 9, 2022
@tbg tbg deleted the roachtest-grafana branch June 9, 2022 13:09
Copy link
Copy Markdown
Collaborator

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed after-the-fact, but :lgtm:. Thank you!

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants