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

User-defined metric cardinality #604

Merged
merged 4 commits into from
Oct 9, 2021

Conversation

flowchartsman
Copy link
Contributor

@flowchartsman flowchartsman commented Aug 28, 2021

Draft

WIP, no test exercise yet, but passes docker-ci.sh tests. Feedback welcome.

I am a bit dissatisfied with the use of the const/iota enum in the public package and the integers in internal, but it's necessary to avoid import cycles. Otherwise the enum needs to be moved out of pulsar and placed into another package, or the enum needs to be mirrored in internal

Fixes #500

Motivation

Allow selective metrics cardinality configuration

Modifications

Allow log cardinality level to be set to none, tenant, namespace or topic.

@flowchartsman flowchartsman changed the title initial commit User-defined metric cardinality Aug 28, 2021
@flowchartsman
Copy link
Contributor Author

flowchartsman commented Aug 28, 2021

Paging @merlimat for a quick sanity check on the WIP, since they did initial implementation (#410)

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

Nice!

type Metrics struct {
metricsLevel int
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to define a 2nd enum for internal use instead of ints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might, but that’s definitely a hack around some layout problems. But there probably aren’t any half-measures there, save an awkward new package, so I guess that’s a ticket for another day.

Copy link
Contributor Author

@flowchartsman flowchartsman Aug 28, 2021

Choose a reason for hiding this comment

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

One option could be to make the consts be strings instead of integers, and then have internal do a switch on these. Then at least the hard-coded values would have more meaning than inscrutable integer values. Like

type MetricsCardinality string
const (
    MetricsCardinalityNone MetricsCardinality = `none`
    MetricsCardinalityTenant MetricsCardinality = `tenant`
    MetricsCardinalityNamespace MetricsCardinality = `namespace`
    MetricsCardinalityTopic MetricsCardinality = `topic`
)

@merlimat merlimat added this to the 0.7.0 milestone Aug 28, 2021
@wolfstudy wolfstudy marked this pull request as ready for review October 9, 2021 08:49
Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@wolfstudy wolfstudy merged commit ce79489 into apache:master Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Topic Level Prometheus Metrics Optional
3 participants