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

Add nodejs sdk package #1187

Merged
merged 36 commits into from
Jul 27, 2020
Merged

Conversation

dyladan
Copy link
Member

@dyladan dyladan commented Jun 11, 2020

This PR is a WIP SDK package for NodeJS. It exports a configure function which configures a working tracing and metrics SDK. Any configuration can be set using this method, but if configurations are omitted a default configuration will be used.

@dyladan
Copy link
Member Author

dyladan commented Jun 11, 2020

/cc @open-telemetry/javascript-approvers PTAL

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #1187 into master will decrease coverage by 0.24%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##           master    #1187      +/-   ##
==========================================
- Coverage   93.53%   93.28%   -0.25%     
==========================================
  Files         148      149       +1     
  Lines        4144     4200      +56     
  Branches      840      861      +21     
==========================================
+ Hits         3876     3918      +42     
- Misses        268      282      +14     
Impacted Files Coverage Δ
packages/opentelemetry-sdk-node/src/sdk.ts 75.00% <75.00%> (ø)

@dyladan
Copy link
Member Author

dyladan commented Jun 19, 2020

@markwolff PTAL at the new version

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.

lgtm, it matches pretty much what i've wrote to abstract away sdk initialization at my company

@dyladan
Copy link
Member Author

dyladan commented Jun 23, 2020

Still working on adding tests and things like that, but I'm going to mark this as ready for reviews.

@dyladan dyladan marked this pull request as ready for review June 23, 2020 20:48
// You can optionally detect resources asynchronously from the environment.
// Detected resources are merged with the resources provided in the SDK configuration.
sdk
.autoDetectResources()
Copy link
Member

Choose a reason for hiding this comment

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

I believe resource detection should be integral part of the SDK, I should be available implicitly in the SDK. No extra call required from the users to register it. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Resource detection may do some async work so we need some way for users to wait for it. If it is done at construction there is no way to wait for it.

Copy link
Member

Choose a reason for hiding this comment

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

Would having a detectResources flag on NodeSDKConfiguration be a reasonable compromise? If set to true, start would block until they resolved, but it would save the additional API call. I'm neutral as to whether it'd default to true or false.

packages/opentelemetry-sdk-node/src/types.ts Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Show resolved Hide resolved
packages/opentelemetry-sdk-node/package.json Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/package.json Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/test/sdk.test.ts Outdated Show resolved Hide resolved
@dyladan dyladan changed the title WIP: add nodejs sdk package Add nodejs sdk package Jul 1, 2020
Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

This looks like it's off to a good start and goes a long way towards simplifying setup. What do you think about having a shutdown method as a central place to flush the export pipeline?

Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

LGTM modulo the bug with suggested fix in the comments. If we're waiting on other work for the shutdown suggestion (#1187 (review)) it's fine to move forward with this and add it in later.

Thanks for putting this together. It makes setup so much easier!

packages/opentelemetry-sdk-node/LICENSE Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Outdated Show resolved Hide resolved
dyladan and others added 2 commits July 21, 2020 15:42
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
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, just few minor things, not sure why but all files are missing new line in the end of file ?

packages/opentelemetry-sdk-node/LICENSE Show resolved Hide resolved
packages/opentelemetry-sdk-node/README.md Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/sdk.ts Outdated Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/types.ts Show resolved Hide resolved
packages/opentelemetry-sdk-node/src/types.ts Show resolved Hide resolved
@obecny
Copy link
Member

obecny commented Jul 27, 2020

@dyladan can you fix the build so that it can get be merged and released with 0.10 ? it has already all required reviews

@dyladan dyladan added the enhancement New feature or request label Jul 27, 2020
@dyladan dyladan merged commit 54f1be5 into open-telemetry:master Jul 27, 2020
@dyladan dyladan deleted the node-sdk branch July 27, 2020 17:56
sidharthv96 added a commit to sidharthv96/opentelemetry-js that referenced this pull request Jul 28, 2020
* upstream/master:
  fix: add missing grpc-js index (open-telemetry#1358)
  chore: 0.10.0 release proposal (open-telemetry#1345)
  Proto update to latest to support arrays and maps (open-telemetry#1339)
  feat: add OTEL_LOG_LEVEL env var (open-telemetry#974)
  Add nodejs sdk package (open-telemetry#1187)
  feat: add baggage support to the opentracing shim (open-telemetry#918)
  Removing default span attributes (open-telemetry#1342)
jonahrosenblum pushed a commit to jonahrosenblum/opentelemetry-js that referenced this pull request Aug 8, 2020
Co-authored-by: Naseem <naseemkullah@gmail.com>
Co-authored-by: legendecas <legendecas@gmail.com>
Co-authored-by: Mark Wolff <mrw00010@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
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 <dyladan@users.noreply.github.com>

* fix meterprovider config to use bracket notation

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: add callbacks to shutdown methods

* fix: merge conflict

* simplify meter shutdown code

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* fix: fix one-liner

* private function name style fix

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* 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 <aravinarjunn@gmail.com>

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

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

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

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

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

Signed-off-by: Aravin Sivakumar <aravinarjunn@gmail.com>

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

Co-authored-by: Mayur Kale <mayurkale@google.com>

* Add nodejs sdk package (#1187)

Co-authored-by: Naseem <naseemkullah@gmail.com>
Co-authored-by: legendecas <legendecas@gmail.com>
Co-authored-by: Mark Wolff <mrw00010@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>

* 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 <dyladan@users.noreply.github.com>

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

Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>

* 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 <dyladan@users.noreply.github.com>

* Propagate b3 parentspanid and debug flag (#1346)

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

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

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

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

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

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* 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 <dyladan@users.noreply.github.com>
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Aravin <34178459+aravinsiva@users.noreply.github.com>
Co-authored-by: Ruben Vargas Palma <ruben.vp8510@gmail.com>
Co-authored-by: Mayur Kale <mayurkale@google.com>
Co-authored-by: Naseem <naseemkullah@gmail.com>
Co-authored-by: legendecas <legendecas@gmail.com>
Co-authored-by: Mark Wolff <mrw00010@gmail.com>
Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
Co-authored-by: Naseem <naseem@transit.app>
Co-authored-by: Mark Wolff <mark.wolff@microsoft.com>
Co-authored-by: Cong Zou <32532612+EdZou@users.noreply.github.com>
Co-authored-by: Reginald McDonald <40721169+reggiemcdonald@users.noreply.github.com>
Co-authored-by: WhiteSource Renovate <bot@renovateapp.com>
Co-authored-by: srjames90 <srjames@lightstep.com>
Co-authored-by: David W <dwitt12345@gmail.com>
Co-authored-by: Mick Dekkers <mickdekkersnl@gmail.com>
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.

9 participants