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

Re-use memory via aggregate functions #1266

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

jtescher
Copy link
Member

@jtescher jtescher commented Sep 13, 2023

Changes

This simplifies memory reuse on subsequent collection cycles.

Also small ergonomics changes:

  • Move MetricsProducer config to builders to match other config
  • Remove the need for separate Delta* and Cumulative* aggregate types
  • Return error earlier if readers are shut down
  • Log warning if two instruments have the same name with different casing
  • Log warning if view is created with empty criteria

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

This simplifies memory reuse on subsequent collection cycles.

Also small ergonomics changes:

* Move `MetricsProducer` config to builders to match other config
* Remove the need for separate `Delta*` and `Cumulative*` aggregate
  types
* Return error earlier if readers are shut down
* Log warning if two instruments have the same name with different
  casing
* Log warning if view is created with empty criteria
@jtescher jtescher requested a review from a team September 13, 2023 15:08
opentelemetry-prometheus/src/config.rs Outdated Show resolved Hide resolved
opentelemetry-sdk/src/metrics/instrument.rs Outdated Show resolved Hide resolved
opentelemetry-sdk/src/metrics/instrument.rs Outdated Show resolved Hide resolved
opentelemetry-sdk/src/metrics/instrument.rs Outdated Show resolved Hide resolved
opentelemetry-sdk/src/metrics/instrument.rs Outdated Show resolved Hide resolved
opentelemetry-sdk/src/metrics/instrument.rs Show resolved Hide resolved
opentelemetry-sdk/src/metrics/internal/sum.rs Show resolved Hide resolved
@jtescher jtescher mentioned this pull request Sep 13, 2023
4 tasks

/// Checks whether aggregator has hit cardinality limit for metric streams
pub(crate) fn is_under_cardinality_limit(size: usize) -> bool {
size < STREAM_CARDINALITY_LIMIT as usize - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we -1 here? Does it mean 1999 should return false?

Copy link
Member

@lalitb lalitb Sep 13, 2023

Choose a reason for hiding this comment

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

I guess this was added in #1066. Return false for 1999, as the overflow measurements are aggregated in a separate metric stream. So total number of metric streams remain 2000.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah this one is also unchanged from before (aside from removing the unused &self param)

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. We should probably add it to comment to make it clearer

Copy link
Contributor

@TommyCpp TommyCpp left a comment

Choose a reason for hiding this comment

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

One nit otherwise looks good to me

@jtescher jtescher merged commit 3ee22ce into open-telemetry:main Sep 13, 2023
11 of 12 checks passed
@jtescher jtescher deleted the metrics-memory branch September 13, 2023 17:58
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