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: Collector Metric Exporter for the Web #1308

Merged
merged 51 commits into from
Aug 5, 2020

Conversation

davidwitten
Copy link
Member

@davidwitten davidwitten commented Jul 13, 2020

Summary

This PR addresses Issue #1109.

Currently, the Collector Exporter only sends traces to the collector. In Python, Java, and Go, for example, metric exporting already exists for the collector. This PR adds that feature. I created two versions, one for Node and the other for browser. The node version uses gRPC, and the browser uses Beacon or XHR. It's up to date with all previous collector exporter commits.

What this PR does

This is the 6th part of this long PR.

Note: Please review this PR first

I previously did some refactoring, which, when merged, would greatly simplify this PR.

This PR creates a CollectorMetricExporter.ts file that is almost identical to the CollectorTraceExporter.ts.

Testing

I created unit tests and I E2E tested exporting metrics with a sample application connected to Google Cloud Monitoring.

Next Steps

I will be pushing a PR to create the Node version of this exporter in parallel. Once both are merged, I will submit an example project.

@codecov
Copy link

codecov bot commented Jul 13, 2020

Codecov Report

Merging #1308 into master will increase coverage by 0.25%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1308      +/-   ##
==========================================
+ Coverage   93.77%   94.03%   +0.25%     
==========================================
  Files         149      149              
  Lines        4322     4322              
  Branches      880      880              
==========================================
+ Hits         4053     4064      +11     
+ Misses        269      258      -11     
Impacted Files Coverage Δ
...lemetry-exporter-collector/src/transformMetrics.ts 95.69% <0.00%> (+11.82%) ⬆️

@davidwitten davidwitten changed the title feat: Collector Exporter for the Web feat: Collector Metric Exporter for the Web Jul 13, 2020
@davidwitten
Copy link
Member Author

Please review the Node PR first, as this one depends on the other one.

@davidwitten
Copy link
Member Author

davidwitten commented Jul 29, 2020

Added example and verified that it works on my computer

@davidwitten davidwitten requested review from obecny and dyladan August 3, 2020 16:09
@dyladan
Copy link
Member

dyladan commented Aug 4, 2020

@open-telemetry/javascript-approvers Please take a look as this PR has been open for quite a while.

In particular I would like @obecny's approval on this as you have been active on David's other PRs and you wrote the original OTLP exporter.

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, great work David, one comment

examples/collector-exporter-node/package.json Outdated Show resolved Hide resolved
@dyladan dyladan merged commit 2af2d0c into open-telemetry:master Aug 5, 2020
jonahrosenblum pushed a commit to jonahrosenblum/opentelemetry-js that referenced this pull request Aug 8, 2020
obecny added a commit that referenced this pull request Aug 17, 2020
* feat: graceful shutdown for tracing and metrics

* fix: wording in test case

* fix: typo

* fix meterprovider config to use bracket notation

Co-authored-by: Daniel Dyla <[email protected]>

* fix meterprovider config to use bracket notation

Co-authored-by: Daniel Dyla <[email protected]>

* fix: add callbacks to shutdown methods

* fix: merge conflict

* simplify meter shutdown code

Co-authored-by: Daniel Dyla <[email protected]>

* fix: fix one-liner

* private function name style fix

Co-authored-by: Daniel Dyla <[email protected]>

* fix: naming of private member variables

* fix: graceful shutdown now works in browser

* fix: window event listener will trigger once

* fix: modify global shutdown helper functions

* fix: remove callback from remove listener args

* fix: change global shutdown function names and simplify functionality

* fix: add rest of function refactoring and simplification

* fix: remove unintended code snippet

* fix: refactor naming of listener cleanup function and fix sandbox issue

* fix: make global shutdown cleanup local

* fix: change interval of MeterProvider collection to ensure it does not trigger through clock

* chore: removing _cleanupGlobalShutdownListeners

* fix: remove unnecesary trace provider member function

* Removing default span attributes (#1342)

* refactor(opentelemetry-tracing): removing default span attributes

Signed-off-by: Aravin Sivakumar <[email protected]>

* refactor(opentelemetry-tracing): removing default span attributed from tracer object

Signed-off-by: Aravin Sivakumar <[email protected]>

* refactor(opentelemetry-tracing): removing accidental add to package.json

Signed-off-by: Aravin Sivakumar <[email protected]>

* refactor(opentelemetry-tracing): removing redundant test and fixing suggestions by Shawn and Daniel

Signed-off-by: Aravin Sivakumar <[email protected]>

* feat: add baggage support to the opentracing shim (#918)

Co-authored-by: Mayur Kale <[email protected]>

* Add nodejs sdk package (#1187)

Co-authored-by: Naseem <[email protected]>
Co-authored-by: legendecas <[email protected]>
Co-authored-by: Mark Wolff <[email protected]>
Co-authored-by: Matthew Wear <[email protected]>

* feat: add OTEL_LOG_LEVEL env var (#974)

* Proto update to latest to support arrays and maps (#1339)

* chore: 0.10.0 release proposal (#1345)

* fix: add missing grpc-js index (#1358)

* chore: 0.10.1 release proposal (#1359)

* feat(api/context-base): change compile target to es5 (#1368)

* Feat: Make ID generator configurable (#1331)

Co-authored-by: Daniel Dyla <[email protected]>

* fix: require grpc-js instead of grpc in grpc-js example (#1364)

Co-authored-by: Bartlomiej Obecny <[email protected]>

* chore(deps): update all non-major dependencies (#1371)

* chore: bump metapackage dependencies (#1383)

* chore: 0.10.2 proposal (#1382)

* fix: remove unnecesary trace provider member function

* refactor(metrics): distinguish different aggregator types (#1325)

Co-authored-by: Daniel Dyla <[email protected]>

* Propagate b3 parentspanid and debug flag (#1346)

* feat: Export MinMaxLastSumCountAggregator metrics to the collector as Summary (#1320)

Co-authored-by: Daniel Dyla <[email protected]>

* feat: Collector Metric Exporter for the Web (#1308)

Co-authored-by: Daniel Dyla <[email protected]>

* Fix issues in TypeScript getting started example code (#1374)

Co-authored-by: Daniel Dyla <[email protected]>

* chore: deploy canary releases (#1384)

* fix: protos pull

* fix: address marius' feedback

* chore: deleting removeAllListeners from prometheus, fixing tests, cleanu of events when using shutdown notifier

* fix: add documentation and cleanup code

* fix: remove async label from shutdown and cleanup test case

* fix: update controller collect to return promise

* fix: make downsides of disabling graceful shutdown more apparent

Co-authored-by: Daniel Dyla <[email protected]>
Co-authored-by: Bartlomiej Obecny <[email protected]>
Co-authored-by: Aravin <[email protected]>
Co-authored-by: Ruben Vargas Palma <[email protected]>
Co-authored-by: Mayur Kale <[email protected]>
Co-authored-by: Naseem <[email protected]>
Co-authored-by: legendecas <[email protected]>
Co-authored-by: Mark Wolff <[email protected]>
Co-authored-by: Matthew Wear <[email protected]>
Co-authored-by: Naseem <[email protected]>
Co-authored-by: Mark Wolff <[email protected]>
Co-authored-by: Cong Zou <[email protected]>
Co-authored-by: Reginald McDonald <[email protected]>
Co-authored-by: WhiteSource Renovate <[email protected]>
Co-authored-by: srjames90 <[email protected]>
Co-authored-by: David W <[email protected]>
Co-authored-by: Mick Dekkers <[email protected]>
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.

5 participants