Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add metrics to PGPubsub#11971

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 1 commit intomainfromspike/11950-pubsub-metrics
Feb 1, 2024
Merged

Conversation

spikecurtis
Copy link
Contributor

Adds prometheus metrics to PGPubsub for monitoring its health and performance in production.

Related to#11950 --- additional diagnostics to help figure out what's happening

@spikecurtisGraphite App
Copy link
ContributorAuthor

This stack of pull requests is managed by Graphite.Learn more about stacking.

Join@spikecurtis and the rest of your teammates onGraphiteGraphite

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This file isn't new, it's just renamed from pubsub_test.go since it was Linux only and the metrics tests runs on any platform.

@spikecurtisspikecurtisforce-pushed thespike/11950-pubsub-metrics branch frombbf6e1b to899ec80CompareFebruary 1, 2024 05:19
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

LGTM, just a few questions/suggestions.

//nolint:gosec
_,err:=p.db.ExecContext(p.ctx,`select pg_notify(`+pq.QuoteLiteral(event)+`, $1)`,message)
iferr!=nil {
p.publishesTotal.WithLabelValues("false").Inc()
Copy link
Member

Choose a reason for hiding this comment

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

Does false label represent error here? Is that common prom metric practice? (Just checking since I'm not that experienced adding prom metrics.)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The label name issuccess with valuestrue orfalse. Just trying to keep our labeling consistent within the product and that's how we do it at

}, []string{"success"}),

newQ.close()
p.subscribesTotal.WithLabelValues("false").Inc()
}else {
p.subscribesTotal.WithLabelValues("true").Inc()
Copy link
Member

Choose a reason for hiding this comment

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

How about including the event as well? Might be useful to see if there's an abnormal amount of subs/pubs/data going for a specific event.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That's a bad idea because some events include the UUID of the thing, e.g. workspace, which would make the set of label values unbounded, which is a cardinal sin in metrics.

Not for this PR, but if we decide we really want that information, we could standardize event channel names to be a struct with a static root and then zero or more specific IDs, and then we could label the publishes, subscribes and messages with the static root.

@spikecurtisspikecurtisforce-pushed thespike/11950-pubsub-metrics branch from899ec80 toff526ccCompareFebruary 1, 2024 06:59
@spikecurtisspikecurtis merged commit5a359d5 intomainFeb 1, 2024
@spikecurtisGraphite App
Copy link
ContributorAuthor

Merge activity

@spikecurtisspikecurtis deleted the spike/11950-pubsub-metrics branchFebruary 1, 2024 07:25
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 1, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@coadlercoadlerAwaiting requested review from coadler

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees

@spikecurtisspikecurtis

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@spikecurtis@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp