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

ref(server): Add a dedicated metric for transaction usage #2571

Merged
merged 9 commits into from
Oct 6, 2023

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Oct 5, 2023

Adds a dedicated and cheap counter metric for usage tracking. It contains the has_profile tag, which will later be removed from the durations metric to lower its cardinality.

This metric should improve the performance of all usage queries. In the long term, it allows to decouple product metrics from bookkeeping.

@jan-auer jan-auer self-assigned this Oct 6, 2023
@jan-auer jan-auer marked this pull request as ready for review October 6, 2023 10:05
@jan-auer jan-auer requested a review from a team October 6, 2023 10:05
@jan-auer
Copy link
Member Author

jan-auer commented Oct 6, 2023

This is ready for review while I fix integration tests.

tags: TransactionDurationTags {
has_profile: self.has_profile,
has_profile: self.has_profile, // TODO: Stop producing this in v3
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we still producing this tag until we update the consumers?

Copy link
Member

Choose a reason for hiding this comment

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

We have to.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's no functional need to remove the tag, everything works correctly with and without the tag, but as @jjbayer pointed out we need to keep it until the consumers are fully updated.

buckets: Vec<Bucket>,
quotas: Q,
scoping: Scoping,
usage: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

usage may be hard to understand outside this scope. What do you think about making this an enum of two variants (usage and transaction duration)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. The metrics rate limiter overall has a convoluted signature, so I chose the simplest change to follow up with a proper refactoring. I'm not yet sure about whether this should be an enum, the config, or something else, so I'd prefer to stick with the simplest choice. Would that work?

tags: TransactionDurationTags {
has_profile: self.has_profile,
has_profile: self.has_profile, // TODO: Stop producing this in v3
Copy link
Member

Choose a reason for hiding this comment

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

We have to.

@jan-auer jan-auer enabled auto-merge (squash) October 6, 2023 12:23
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.

3 participants