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

Unable to instrument prerelease tagged packages #2294

Closed
weyert opened this issue Jun 23, 2021 · 1 comment · Fixed by #2309
Closed

Unable to instrument prerelease tagged packages #2294

weyert opened this issue Jun 23, 2021 · 1 comment · Fixed by #2309
Assignees
Labels
bug Something isn't working

Comments

@weyert
Copy link
Contributor

weyert commented Jun 23, 2021

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

I am using the most recent version of Opentelemetry 0.22

What version of Node are you using?

14.17.0

Please provide the code you used to setup the OpenTelemetry SDK

N/A

What did you do?

I am trying to write my own custom instrumentation of an internal package which is versioned using alpha, beta-packages. Currently, the InstrumentationBase has a function named isSupported which checks the module version against a list of allowed versions. The check uses satisfies -function of the semver-package only this function appears to ignore alpha, beta versions.

For example, if I am using the following code snippet:

const selectQueryBuilder = new InstrumentationNodeModuleFile<typeof typeorm>(
      '@company/typeorm/query-builder/SelectQueryBuilder.js',
      ['*'],
      (moduleExports, moduleVersion) => {

and the package version is 2.0.0-beta.1 that then function isSupported returns false` which results in the package not being instrumented while its supported.

If possible, provide a recipe for reproducing the error.

What did you expect to see?

I expected to be able to instrument any package no matter which version with or without prerelease tags when using the * as supported version

What did you see instead?

The custom instrumentation is not happening

Additional context

I think this could be solved in multiple ways:

  1. Allow to provide a custom isSupported-function implementation as part of the configuration for the InstrumentationBase-class
  2. Allow to provide an opt-in configuration includePrerelease which passes the following configuration to the semver-package's satisfies-function: { includePrerelease }
  3. Implement support for * as supported version which always return true in the isSupported-function
@weyert weyert added the bug Something isn't working label Jun 23, 2021
@dyladan
Copy link
Member

dyladan commented Jun 23, 2021

My vote is for 2 here

@dyladan dyladan self-assigned this Jun 30, 2021
MattGson pushed a commit to MattGson/opentelemetry-ext-js that referenced this issue May 4, 2022
Utilises mechanism added here open-telemetry/opentelemetry-js#2294
to support pre-release kafkaJS versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants