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

Add node-observ-lib #25

Merged
merged 9 commits into from
Nov 14, 2023
Merged

Add node-observ-lib #25

merged 9 commits into from
Nov 14, 2023

Conversation

v-zhuravlev
Copy link

@v-zhuravlev v-zhuravlev commented Jul 24, 2023

Similar to windows-observ-lib, node-observ-lib is created, using many panels from commonlib:. It also refactors everything from node-mixin by using grafonnet (v10 schema).

Node observ lib would allow:

  • Easily read and maintain dashboards as code
  • Easily modify any dashboard, panel, target, variable... before rendering final result
  • Change instanceLabels,groupLabels from default job,instance to use dashboards in environments with extra or custom labels
  • Instantiate node dashboards more than once in a single environment (Uid and filteringSelector are used to avoid conflicts).

Due to current incompatibility with old mixin, lib is created in a separate folder.

What is not implemented (yet?):

  • MacOS dashboard (will add in next iteration)
  • USE dashboards (node-rsrc-use.json, node-cluster-rsrc-use.json,node-multicluster-rsrc-use.json) (decide if needs re implementing or just drop)

What is recreated/moved from old node-mixin:

  • All dashboards, except mentioned above
  • All alerts
  • All recording rules

Added:

  • New loki annotations (only added if enableLokiLogs:true)
    • Service failed
    • Critical system event
    • Session opened
    • Session closed
  • Title case is used across all recreated panels and dashboard names

@v-zhuravlev v-zhuravlev marked this pull request as ready for review November 9, 2023 12:20
@v-zhuravlev v-zhuravlev changed the title Example usage of jsonnet-libs/common-lib/common Add node-observ-lib Nov 9, 2023
Copy link

@rgeyer rgeyer left a comment

Choose a reason for hiding this comment

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

LGTM

Couple nits/comments.

Comment on lines +20 to +23
{
hide: true,
iconColor: 'light-purple',
},
Copy link

Choose a reason for hiding this comment

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

Couldn't you use commonlib.annotations.fatal.new instead? These values are implied there 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Technically, it is not fatal event. So maybe it is best to change color instead :)

): {

local this = self,
config: {
Copy link

Choose a reason for hiding this comment

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

Did we decide and document somewhere that config should go in the main definition of the mixin?

We have an existing pattern of looking for an external config.libsonnet file to change configurable options, so this could be confusing.

Copy link
Author

Choose a reason for hiding this comment

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

Nope, there was no decision if config should be inline or in separate file. I'll see what I can do.

Copy link
Author

@v-zhuravlev v-zhuravlev Nov 13, 2023

Choose a reason for hiding this comment

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

Decided to refactor it. New() is now parameterless, and all config is moved to config.libsonnet file. Some sane defaults are provided for all params required in modular libs. And any of those defaults can be modified by calling it like this:

local nodelib = import './main.libsonnet';


local linux =
  nodelib.new()
  + nodelib.withConfigMixin({
    filteringSelector: 'job=~".*node.*"',
    groupLabels: ['job'],
    instanceLabels: ['instance'],
    dashboardNamePrefix: 'Node exporter / ',
    dashboardTags: ['node-exporter-mixin'],
    uid: 'node',
  });

Copy link

Choose a reason for hiding this comment

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

This looks great to me! Makes the config a bit more modular and clear where the changeable parameters are.

I like the withConfigMixin function too, allowing the user to easily supply their own config overrides.

This makes sense to me, I'd be curious if the rest of the team has any feedback. @Dasomeone @gaantunes ?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for missing this ping (and the PR, will review that as well)

I really like the solution you've come up with here, with config separate by default but a function to supply in-line should it be desired. Quite happy to go forward with what the two of you have already done :D

@Dasomeone
Copy link
Member

Just a comment here, based on the description:

Due to current incompatibility with old mixin, lib is created in a separate folder.

Is there a list of the incompatibilities? Is it just the two listed for macos and USE dashboards? Are we tracking that in the issue or separate issue?

Copy link

@gaantunes gaantunes left a comment

Choose a reason for hiding this comment

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

Looks amazing @v-zhuravlev, very well organized and easy to customize.
I also love that even though it is a lot of jsonnet code, it is easy to understand what is happening. Our previous approach of putting everything in just a few files was hard to grok.

Copy link
Member

@Dasomeone Dasomeone left a comment

Choose a reason for hiding this comment

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

Couple very minor nitpicks but generally looks fantastic, great work Vitaly!!

Copy link
Member

Choose a reason for hiding this comment

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

Minor nitpicks throughout: I don't mind shortening observability to observ for the folder name, but it feels pretty awkward everywhere else

Copy link
Author

Choose a reason for hiding this comment

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

Good one, updated readme


local linux =
nodelib.new()
+ nodelib.withConfigMixin({
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add a little explanation/example with separate configuration?

Copy link
Author

Choose a reason for hiding this comment

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

added

docs/node-observ-lib/alerts.libsonnet Show resolved Hide resolved
@v-zhuravlev
Copy link
Author

Just a comment here, based on the description:

Due to current incompatibility with old mixin, lib is created in a separate folder.

Is there a list of the incompatibilities? Is it just the two listed for macos and USE dashboards? Are we tracking that in the issue or separate issue?

yes, those are major ones. Also some config params are dropped, like clusterLabel...

@v-zhuravlev v-zhuravlev merged commit 836773a into master Nov 14, 2023
2 checks passed
@v-zhuravlev v-zhuravlev deleted the vzhuravlev/common-lib-example branch November 14, 2023 14:03
v-zhuravlev added a commit that referenced this pull request Nov 29, 2023
* Add node-observ-lib

* Remove trends support (not in 10.0 schema)

* Make filteringSelector for logs dashboard configurable

* Temp change dependency (until PR is merged for commonlib)

* Refactor config

* Update jsonnetfile.json

* Update README

* Add separate loki example

* Add sep file example

Signed-off-by: Vitaly Zhuravlev <[email protected]>
v-zhuravlev added a commit that referenced this pull request Nov 1, 2024
* Add node-observ-lib

* Remove trends support (not in 10.0 schema)

* Make filteringSelector for logs dashboard configurable

* Temp change dependency (until PR is merged for commonlib)

* Refactor config

* Update jsonnetfile.json

* Update README

* Add separate loki example

* Add sep file example

Signed-off-by: Vitaly Zhuravlev <[email protected]>
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