Skip to content

Add recording rule to collect migrations data to telemetry. #1172

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

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

bkhizgiy
Copy link
Member

@bkhizgiy bkhizgiy commented Nov 5, 2024

Following the request of adding recording rule in openshift/cluster-monitoring-operator#2461

@bkhizgiy bkhizgiy requested a review from fabiand November 5, 2024 14:27
Copy link

sonarqubecloud bot commented Nov 5, 2024

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.70%. Comparing base (9de3139) to head (16963fa).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1172      +/-   ##
==========================================
- Coverage   15.71%   15.70%   -0.02%     
==========================================
  Files         112      112              
  Lines       23052    23052              
==========================================
- Hits         3623     3620       -3     
- Misses      19142    19144       +2     
- Partials      287      288       +1     
Flag Coverage Δ
unittests 15.70% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fabiand
Copy link
Contributor

fabiand commented Nov 6, 2024

@sradco do you mind giving this a brief look?

@sradco
Copy link

sradco commented Nov 7, 2024

@sradco do you mind giving this a brief look?

Reviewed and suggested to @bkhizgiy to move the recording rule code under /pkg/monitoring/rules to have all observability related code in a dedicated, since in CNV we show that this brings value for maintenance and also for creating automatic docs generation for the metrics and recording rule.

@sradco
Copy link

sradco commented Nov 7, 2024

Adding @avlitman to also review this.

@bkhizgiy
Copy link
Member Author

@sradco It's not possible to move this code under /pkg/monitoring/ as you suggested, since this is the operator code and is being built using a different target. It should be located under the operator folder. Since we are building the monitoring stack differently from CNV (using Ansible vs. Go), it should be added as a template to the operator during its creation.

We could add another folder under /templates/monitoring, but honestly, I don’t think it’s necessary.

@sradco
Copy link

sradco commented Nov 12, 2024

That was a suggestion, and if it doesn't fit your project, please feel free to ignore.
It was valuable for CNV to be able to see all monitoring code in the same place for purposes like automatic metrics and recording rules documentation, github permissions for sig-observability team and clear code separation.
Just raising this since it's important to plan this in early states,instead of having to refactor it later(like we needed to).

- record: cluster:mtv_migrations_status_total:max
expr: max by(status, provider, mode, target) (mtv_migrations_status_total)
labels:
app: {{ app_name }}

Choose a reason for hiding this comment

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

I would add also annotations

      annotations:
        description: "The maximum number of migration statuses, grouped by status, provider, mode, and target."

Choose a reason for hiding this comment

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

sorry for delayed review was sick.. and nice work!

- name: mtv-migrations
rules:
- record: cluster:mtv_migrations_status_total:max
expr: max by(status, provider, mode, target) (mtv_migrations_status_total)

Choose a reason for hiding this comment

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

are we sure we need all 4 labels? telemetry team is very strict about the number of records added per query. if we can aggregate by less it will be better.

Copy link

Choose a reason for hiding this comment

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

These labels are needed. It should be fine.

@yaacov
Copy link
Member

yaacov commented Nov 25, 2024

@sradco @avlitman hi, is this RP lgtm-ed by you ?

@sradco
Copy link

sradco commented Nov 25, 2024

/lgtm

@yaacov yaacov merged commit fc1f358 into kubev2v:main Nov 25, 2024
15 of 16 checks passed
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.

6 participants