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: Add metrics for the number of triggers by source #904

Merged
merged 8 commits into from
Sep 4, 2023

Conversation

Tetrergeru
Copy link
Member

No description provided.

@Tetrergeru Tetrergeru requested a review from a team as a code owner August 30, 2023 13:11
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

Merging #904 (9145f09) into master (6bb22d4) will decrease coverage by 0.30%.
Report is 2 commits behind head on master.
The diff coverage is 20.31%.

❗ Current head 9145f09 differs from pull request most recent head 3f48c14. Consider uploading reports for the commit 3f48c14 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master     #904      +/-   ##
==========================================
- Coverage   68.99%   68.69%   -0.30%     
==========================================
  Files         195      196       +1     
  Lines       10858    10919      +61     
==========================================
+ Hits         7491     7501      +10     
- Misses       2928     2976      +48     
- Partials      439      442       +3     
Files Changed Coverage Δ
api/middleware/logger.go 0.00% <0.00%> (ø)
cmd/api/main.go 0.00% <0.00%> (ø)
database/redis/trigger.go 72.46% <0.00%> (-6.28%) ⬇️
notifier/notifier.go 71.53% <33.33%> (-3.47%) ⬇️
cmd/api/trigger_stats.go 35.71% <35.71%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

countByTriggerSource: map[moira.TriggerSource]Histogram{
moira.GraphiteLocal: registry.NewHistogram(triggersMetricsPrefix, string(moira.GraphiteLocal)),
moira.GraphiteRemote: registry.NewHistogram(triggersMetricsPrefix, string(moira.GraphiteRemote)),
moira.PrometheusRemote: registry.NewHistogram(triggersMetricsPrefix, string(moira.PrometheusRemote)),
Copy link
Member

@kissken kissken Aug 31, 2023

Choose a reason for hiding this comment

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

triggers.count.source better i think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

}
}

func (metrics *TriggersMetrics) Update(source moira.TriggerSource, count int64) {
Copy link
Member

Choose a reason for hiding this comment

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

godoc as always

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@@ -52,6 +52,38 @@ func (connector *DbConnector) GetPrometheusTriggerIDs() ([]string, error) {
return triggerIds, nil
}

func (connector *DbConnector) GetTriggerCount() (map[moira.TriggerSource]int64, error) {
Copy link
Member

Choose a reason for hiding this comment

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

any test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a test

metrics/triggers.go Outdated Show resolved Hide resolved
It may fail if the generated number has `.9999999` because of the float-precision problems
@Tetrergeru
Copy link
Member Author

/build

@Tetrergeru Tetrergeru merged commit 95f3170 into master Sep 4, 2023
6 checks passed
@Tetrergeru Tetrergeru deleted the feature/trigger-count-metrics branch September 4, 2023 12:47
@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Build and push Docker images with tag: 2023-09-04.95f3170

1 similar comment
@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Build and push Docker images with tag: 2023-09-04.95f3170

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