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

chore: creating meta package for default auto instrumentations for node #379

Merged
merged 12 commits into from
Mar 15, 2021

Conversation

obecny
Copy link
Member

@obecny obecny commented Mar 4, 2021

Which problem is this PR solving?

Short description of the changes

  • Creates meta package for default auto instrumentations for node

Usage

const { NodeTracerProvider } = require('@opentelemetry/node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

const exporter = new CollectorTraceExporter({
  serviceName: 'auto-instrumentations-node',
});

const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();

registerInstrumentations({
  instrumentations: [
    getNodeAutoInstrumentations({
      // load custom configuration for http instrumentation
      "@opentelemetry/instrumentation-http": {
        applyCustomAttributesOnSpan: (span)=> {
          span.setAttribute('foo2', 'bar2');
        },
      },
    }),
  ],
});

@obecny obecny added the enhancement New feature or request label Mar 4, 2021
@obecny obecny self-assigned this Mar 4, 2021
@obecny
Copy link
Member Author

obecny commented Mar 4, 2021

@open-telemetry/javascript-approvers this is basically complete but without tests, please have a look before I start adding unit tests

@codecov
Copy link

codecov bot commented Mar 4, 2021

Codecov Report

Merging #379 (f563fcf) into main (e0b7dde) will increase coverage by 0.46%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
+ Coverage   93.88%   94.34%   +0.46%     
==========================================
  Files          12       10       -2     
  Lines         409      407       -2     
  Branches       44       44              
==========================================
  Hits          384      384              
+ Misses         25       23       -2     
Impacted Files Coverage Δ
packages/opentelemetry-host-metrics/.eslintrc.js
...ors/opentelemetry-propagator-ot-trace/.eslintrc.js

@obecny obecny marked this pull request as ready for review March 10, 2021 12:09
@obecny obecny requested a review from a team as a code owner March 10, 2021 12:09
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.

This looks great, just have a suggestion for a way to lower the number of places that need to be updated when we add a package.

metapackages/auto-instrumentations-node/src/utils.ts Outdated Show resolved Hide resolved
metapackages/auto-instrumentations-node/src/utils.ts Outdated Show resolved Hide resolved
metapackages/auto-instrumentations-node/src/utils.ts Outdated Show resolved Hide resolved
obecny and others added 4 commits March 10, 2021 19:06
* chore: use one map to manage instrumentation types

* chore: lint

* chore: use default config

* chore: merge configs

* style: no any

* chore: infer config type

* style: lint

* style: no any

* chore: export config map type

* chore: bring back deleted debug log
@obecny obecny requested a review from vmarchaud March 15, 2021 11:47
@vmarchaud
Copy link
Member

@obecny Do you want to wait for mysql plugin to release this ?

@obecny
Copy link
Member Author

obecny commented Mar 15, 2021

@obecny Do you want to wait for mysql plugin to release this ?

it all depends when the mysql will be merged / done

@obecny obecny merged commit 9244a08 into open-telemetry:main Mar 15, 2021
@obecny obecny deleted the node branch March 15, 2021 13:13
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.

Create meta package for auto instrumentations for node
3 participants