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

feat(metrics-sdk): bootstrap views api #2625

Merged
merged 5 commits into from
Nov 21, 2021

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Nov 16, 2021

Which problem is this PR solving?

Bootstrap the skeleton of the views API and basic views matching.

Unblocks the metrics stream implementation: provides a way to configure Aggregations.

This PR is not a complete view implementation.

Related: #2592

Short description of the changes

  1. Add a ViewRegistry for view matching.
  2. Add InstrumentSelector and MeterSelector for metric filtering (wildcard match, exact match, etc.).
  3. Add AttributesProcessor interface for altering dimensions.
  4. Define the Aggregation interface as configuring how measurements are combined into metrics for Views (Similar to previous Processor.prototype.aggregatorFor).

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@legendecas legendecas requested a review from a team November 16, 2021 06:17
@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #2625 (f4df716) into main (13acbd3) will decrease coverage by 0.17%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2625      +/-   ##
==========================================
- Coverage   93.26%   93.08%   -0.18%     
==========================================
  Files         115      123       +8     
  Lines        4645     4761     +116     
  Branches     1036     1061      +25     
==========================================
+ Hits         4332     4432     +100     
- Misses        313      329      +16     
Impacted Files Coverage Δ
...es/opentelemetry-sdk-metrics-base/src/view/View.ts 100.00% <0.00%> (ø)
...elemetry-sdk-metrics-base/src/view/ViewRegistry.ts 100.00% <0.00%> (ø)
...telemetry-sdk-metrics-base/src/view/Aggregation.ts 71.42% <0.00%> (ø)
.../opentelemetry-sdk-metrics-base/src/Instruments.ts 46.15% <0.00%> (ø)
...lemetry-sdk-metrics-base/src/view/MeterSelector.ts 100.00% <0.00%> (ø)
...ry-sdk-metrics-base/src/view/InstrumentSelector.ts 100.00% <0.00%> (ø)
...y-sdk-metrics-base/src/view/AttributesProcessor.ts 100.00% <0.00%> (ø)
...entelemetry-sdk-metrics-base/src/view/Predicate.ts 100.00% <0.00%> (ø)

@legendecas legendecas marked this pull request as draft November 16, 2021 07:36
@legendecas legendecas marked this pull request as ready for review November 16, 2021 11:35
return this._sharedState.resource;
}

getMeter(name: string, version = '', options: metrics.MeterOptions = {}): metrics.Meter {
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of these are whitespace changes: changed 4 spaces indentation to 2 spaces indentation.

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

In general I prefer your approach of passing down a shared state class instead of exposing an aggregation function on the meter.

I don't see any handling of the case where there is no view registered. Am I just missing it?

@legendecas
Copy link
Member Author

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

LGTM

@dyladan
Copy link
Member

dyladan commented Nov 19, 2021

@open-telemetry/javascript-approvers Please take a look at this PR it is holding up other work until it can be merged

@vmarchaud vmarchaud merged commit 9b5feb2 into open-telemetry:main Nov 21, 2021
@legendecas legendecas deleted the metrics-ff/views branch November 22, 2021 02:10
@dyladan dyladan added the enhancement New feature or request label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants