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 /org/[key]/metrics endpoint #251

Merged
merged 2 commits into from
Mar 20, 2020
Merged

add /org/[key]/metrics endpoint #251

merged 2 commits into from
Mar 20, 2020

Conversation

nicpottier
Copy link
Member

Adds prometheus endpoint for contact group counts and channel counts.

@nicpottier nicpottier requested a review from rowanseymour March 20, 2020 20:17
@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #251 into master will increase coverage by 0.72%.
The diff coverage is 83.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
+ Coverage   48.34%   49.06%   +0.72%     
==========================================
  Files          84       85       +1     
  Lines        7658     7818     +160     
==========================================
+ Hits         3702     3836     +134     
- Misses       3374     3387      +13     
- Partials      582      595      +13     
Impacted Files Coverage Δ
web/org/metrics.go 83.75% <83.75%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbebf18...b3c8d1b. Read the comment docs.

web.RegisterRoute(http.MethodGet, "/mr/org/{token:[0-9a-f]+}/metrics", handleMetrics)
}

const groupCountsSQL = `
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ideally this stuff would live in models instead of web/..

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that but it is pretty specific to metrics. Everything in models.. deals with a bit more concrete stuff. I don't know, just seemed awash either way and having it closer to the point of use felt right since these are highly optimized for this use case.

Copy link
Member Author

Choose a reason for hiding this comment

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

(could I guess obfuscate with rp_?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Meh, in the end I think just being clear here is best.

defer rows.Close()

family := &dto.MetricFamily{
Name: proto.String("rapidpro_group_contact_count"),
Copy link
Contributor

Choose a reason for hiding this comment

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

temba? in case textit users want this?

Copy link
Member Author

Choose a reason for hiding this comment

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

So was thinking of using temba_ for the internal metrics (things like courier queue size for example). rapidpro_ instead being "org" level stuff.

We don't need to hide that TextIt is RapidPro I don't think.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok that works 👍

@nicpottier nicpottier merged commit dd1301e into master Mar 20, 2020
@nicpottier nicpottier deleted the metrics branch March 20, 2020 20:44
rasoro pushed a commit to Ilhasoft/mailroom that referenced this pull request Dec 16, 2024
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.

2 participants