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: prometheus serializer #1310

Merged
merged 15 commits into from
Aug 26, 2020
Merged

Conversation

legendecas
Copy link
Member

Which problem is this PR solving?

Short description of the changes

  • Add PrometheusSerializer to serialize aggregated metric records.
  • Add PrometheusLabelsBatcher to aggregate metric records with different labels.
  • Remove dependency on prom-client.

@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #1310 into master will increase coverage by 0.10%.
The diff coverage is 94.47%.

@@            Coverage Diff             @@
##           master    #1310      +/-   ##
==========================================
+ Coverage   93.80%   93.91%   +0.10%     
==========================================
  Files         149      151       +2     
  Lines        4539     4615      +76     
  Branches      940      953      +13     
==========================================
+ Hits         4258     4334      +76     
  Misses        281      281              
Impacted Files Coverage Δ
...etry-exporter-prometheus/src/PrometheusExporter.ts 89.83% <89.83%> (ø)
...ry-exporter-prometheus/src/PrometheusSerializer.ts 96.15% <96.15%> (ø)
...exporter-prometheus/src/PrometheusLabelsBatcher.ts 100.00% <100.00%> (ø)

Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

overal lgtm, nit pick about comparison

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

  1. I think you are changing here too many things at the same time.
  2. The serializer itself is not spec compliant
  3. The changes to metrics should be done first in separate PR, after that PR you can focus on serialisation only .

@dyladan
Copy link
Member

dyladan commented Aug 17, 2020

@obecny have your concerns here been addressed?

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

last concern with the batcher - added comment

@legendecas
Copy link
Member Author

#1428 added mapping MetricKind. VALUE_RECORDER to Prometheus data type as Gauge. However, the aggregator type by default determined by Batcher is MinMaxLastSumCountAggregator for MetricKind. VALUE_RECORDER, which in otel collector exporter is been mapped as Summary. To keep alignment, aggregator MinMaxLastSumCountAggregator is mapped as summary in the latest changes.

@obecny
Copy link
Member

obecny commented Aug 24, 2020

#1428 added mapping MetricKind. VALUE_RECORDER to Prometheus data type as Gauge. However, the aggregator type by default determined by Batcher is MinMaxLastSumCountAggregator for MetricKind. VALUE_RECORDER, which in otel collector exporter is been mapped as Summary. To keep alignment, aggregator MinMaxLastSumCountAggregator is mapped as summary in the latest changes.

Choosing the aggregation based on metric type might be wrong. The user can use the same metric and create its own batcher and use different aggregators for the same metrics. Also due to last conversation on spec we will have to change ValueObserver aggregator and ValueRecorder again so to avoid any such problems in future we should only depends on aggregator type and never on metric type when trying to get the value (btw MinMaxLastSumCountAggregator will be removed completely)

Copy link
Member

@obecny obecny 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 Aug 25, 2020

This looks ok to me, but I want to mention that this looks like it does a lot more than just the serialization. In the future, I would appreciate if you would break out other work into separate PRs because it makes it very difficult to review when the PR is so large.

I am also concerned that many of the largest changes seem to have come after the first round of reviews, which means the approvals it already had were for code that is very different than the current state.

I am not going to block this PR, but please keep these things in mind for future PRs.

@dyladan dyladan added the enhancement New feature or request label Aug 25, 2020
@dyladan dyladan merged commit 53f0654 into open-telemetry:master Aug 26, 2020
@legendecas
Copy link
Member Author

Thanks for the reviews! :D

@legendecas legendecas deleted the prometheus branch August 27, 2020 02:48
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 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.

Remove prom-client from prometheus exporter
4 participants