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(jaeger-remote-sampler): Implement jaeger remote sampler #4589

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

legalimpurity
Copy link

@legalimpurity legalimpurity commented Mar 27, 2024

Which problem is this PR solving?

This is an implementation of JaegerRemoteSampler. This follows the specification mentioned here.

Fixes #4534

Short description of the changes

Add a new samper implementation in experimental packages.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Have added full coverage for entire code.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added

@legalimpurity legalimpurity requested a review from a team as a code owner March 27, 2024 12:18
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 92.86%. Comparing base (2610122) to head (7f476b3).
Report is 12 commits behind head on main.

❗ Current head 7f476b3 differs from pull request most recent head b553fbe. Consider uploading reports for the commit b553fbe to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4589      +/-   ##
==========================================
+ Coverage   90.77%   92.86%   +2.08%     
==========================================
  Files          90      331     +241     
  Lines        1930     9571    +7641     
  Branches      417     2054    +1637     
==========================================
+ Hits         1752     8888    +7136     
- Misses        178      683     +505     
Files Coverage Δ
...s/sampler-jaeger-remote/src/JaegerRemoteSampler.ts 100.00% <100.00%> (ø)
...s/sampler-jaeger-remote/src/PerOperationSampler.ts 100.00% <100.00%> (ø)
...mental/packages/sampler-jaeger-remote/src/types.ts 100.00% <100.00%> (ø)
...y-sdk-trace-base/src/sampler/ParentBasedSampler.ts 78.78% <0.00%> (-5.09%) ⬇️
...trace-base/src/sampler/TraceIdRatioBasedSampler.ts 92.00% <0.00%> (-8.00%) ⬇️

... and 244 files with indirect coverage changes

@legalimpurity
Copy link
Author

Good morning guys? did anyone had a chance to review this?

@legalimpurity legalimpurity changed the title feat(jaeger-remote-samper): Implement jaeger remote sampler feat(jaeger-remote-sampler): Implement jaeger remote sampler Apr 10, 2024
@legalimpurity
Copy link
Author

Hello Guys any update here? @pichlermarc

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Ah sorry, I must've not posted my review yesterday 😞 - a few comments, mostly around testing/imports.

Once addressed, I'll do another pass to look more closely into the actual implementation 👍

@@ -0,0 +1,69 @@
{
"name": "@opentelemetry/sampler-jaeger-remote",
"version": "0.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"version": "0.0.1",
"version": "0.50.0",

@@ -9,6 +9,7 @@ All notable changes to experimental packages in this project will be documented
### :rocket: (Enhancement)

* feat(otlp-transformer): consolidate scope/resource creation in transformer [#4600](https://github.com/open-telemetry/opentelemetry-js/pull/4600)
* feat(jaeger-remote-samper): added support of jaeger-remote-samper [#4534](https://github.com/open-telemetry/opentelemetry-js/pull/4589)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* feat(jaeger-remote-samper): added support of jaeger-remote-samper [#4534](https://github.com/open-telemetry/opentelemetry-js/pull/4589)
* feat(jaeger-remote-sampler): added support of jaeger-remote-sampler [#4534](https://github.com/open-telemetry/opentelemetry-js/pull/4589)

Copy link
Member

Choose a reason for hiding this comment

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

please also add a link to the spec in a sub-list item below.
The commit scope we use is usually the package name which is sampler-jaeger-remote (different order of words) - so we may want to use this here.

@@ -0,0 +1 @@
# Sample Jaeger Remote Sampler
Copy link
Member

Choose a reason for hiding this comment

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

This needs a lot more details (usage examples, etc.)
Please also add the same disclaimer as is found on the other packages (the one about the package being experimental and possible breaking changes).

"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "1.8.0",
Copy link
Member

Choose a reason for hiding this comment

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

API dependencies are usually a range of the earliest API version that it can be used with up until the most recent version. To find the exact supported versions please check which features from the API you're using and in which version they were introduced.

* limitations under the License.
*/

import { Context } from '@opentelemetry/api/src/context/types';
Copy link
Member

Choose a reason for hiding this comment

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

Avoid deep imports.

Suggested change
import { Context } from '@opentelemetry/api/src/context/types';
import { Context } from '@opentelemetry/api';

TraceIdRatioBasedSampler,
} from '@opentelemetry/sdk-trace-base';
import { SpanKind } from '@opentelemetry/api/src/trace/span_kind';
import { Link } from '@opentelemetry/api/src/trace/link';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { Link } from '@opentelemetry/api/src/trace/link';
import { Link } from '@opentelemetry/api';

}

toString(): string {
return `JaegerRemoteSampler{endpoint=${this._endpoint},${
Copy link
Member

Choose a reason for hiding this comment

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

would there ever be any sensitive data (token and things like this) in this._endpoint?

Copy link
Author

Choose a reason for hiding this comment

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

nope. just get endpoint with maybe service name.

} from '@opentelemetry/sdk-trace-base';
import { SpanKind } from '@opentelemetry/api/src/trace/span_kind';
import { Link } from '@opentelemetry/api/src/trace/link';
import { SpanAttributes } from '@opentelemetry/api/src/trace/attributes';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { SpanAttributes } from '@opentelemetry/api/src/trace/attributes';
import { SpanAttributes } from '@opentelemetry/api';

Comment on lines +125 to +129
// Required for testing
getRootSampler(): Sampler {
return this._root;
}

Copy link
Member

Choose a reason for hiding this comment

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

I'd also like to avoid this if possible. This will actually add to the public API of the stable package. If exported it should serve a purpose other than testing.

Comment on lines +42 to +46
// Required for testing
getRatio(): number {
return this._ratio;
}

Copy link
Member

Choose a reason for hiding this comment

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

I'd also like to avoid this if possible. This will actually add to the public API of the package. If exported it should serve a purpose other than testing.

pichlermarc and others added 9 commits April 26, 2024 09:09
…pen-telemetry#4605)

* feat(sdk-trace-base): log resoruce attributes in ConsoleSpanExporter

* fixup! feat(sdk-trace-base): log resoruce attributes in ConsoleSpanExporter
…metry#4624)

Now that instrumentation-undici exists, point to it for users that want
instrumentation of Node.js' fetch().
…lemetry#4627)

This package accidentally got a dep and devDep on api-logs, at
different versions. The result was it being pinned at the older
version in package-lock.

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
…pen-telemetry#4612)

* fix(otlp-grpc-exporter-base): avoid TypeError on exporter shutdown

* chore: update changelog

* fix: use gRPC Client type over any

* fixup! fix: use gRPC Client type over any

* fix: use ts-lint/ts-ignore
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.

Implement Jaeger Remote Sampler as defined by the specification
3 participants