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: add jaeger http trace format (#696) #701

Merged
merged 30 commits into from
Jan 20, 2020

Conversation

DotSpy
Copy link
Member

@DotSpy DotSpy commented Jan 16, 2020

Which problem is this PR solving?

Short description of the changes

  • add jaeger http trace format for working with uber-trace-id header

@codecov-io
Copy link

codecov-io commented Jan 16, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@e0e7b85). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master     #701   +/-   ##
=========================================
  Coverage          ?   91.01%           
=========================================
  Files             ?      221           
  Lines             ?    10366           
  Branches          ?      959           
=========================================
  Hits              ?     9435           
  Misses            ?      931           
  Partials          ?        0

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 is a great start, thanks for this.

@dyladan
Copy link
Member

dyladan commented Jan 16, 2020

You just need to fix the formatting now by running yarn run fix.

@vladislav-kiva
Copy link
Contributor

yarn run fix

You just need to fix the formatting now by running yarn run fix.

sorry first time touching js ts and etc

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.

See my comment previously but the mechanism you used will convert it to decimal not hex and only will give a single character.

@DotSpy DotSpy requested a review from dyladan January 16, 2020 16:02
Copy link
Member

@OlivierAlbertini OlivierAlbertini left a comment

Choose a reason for hiding this comment

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

Should it be in a new package ? I don't believe that core should have something with Jaeger implementation. Because after that we could have Zipkin, Elastic APM etc...

@mayurkale22
Copy link
Member

Should it be in a new package ? I don't believe that core should have something with Jaeger implementation. Because after that we could have Zipkin, Elastic APM etc...

+1 I would suggest to create a new package (something like opentelemetry-propagation-jaeger).

@DotSpy
Copy link
Member Author

DotSpy commented Jan 17, 2020

Deployed it locally and it's working, i'm very happy :)
Screenshot from 2020-01-17 15-00-19

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.

Think this looks good now. Thanks for doing this :)

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, added few comments - some minor changes, but the urls in readme needs to be changed,
thx

[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

OpenTelemetry propagation Jaeger provide HTTP header propagation for systems that using Jaeger HTTP header format.
Copy link
Member

Choose a reason for hiding this comment

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

What would you say for such description?:
OpenTelemetry Jaeger Propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.

[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-core
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core
Copy link
Member

Choose a reason for hiding this comment

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

you have wrong url, it should be opentelemetry-propagator-jaeger instead of opentelemetry-core

[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-core
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-core
Copy link
Member

Choose a reason for hiding this comment

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

you have wrong url, it should be opentelemetry-propagator-jaeger instead of opentelemetry-core

[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-core
Copy link
Member

Choose a reason for hiding this comment

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

you have wrong url, it should be opentelemetry-propagator-jaeger instead of opentelemetry-core

[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-core
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-core
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core&type=dev
Copy link
Member

Choose a reason for hiding this comment

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

you have wrong url, it should be opentelemetry-propagator-jaeger instead of opentelemetry-core

[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-core
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core&type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/core
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcore.svg
Copy link
Member

Choose a reason for hiding this comment

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

you have wrong url, it should be propagator-jaeger instead of core

{
"name": "@opentelemetry/propagator-jaeger",
"version": "0.3.2",
"description": "OpenTelemetry propagator Jaeger provide HTTP header propagation for systems that using Jaeger HTTP header format",
Copy link
Member

Choose a reason for hiding this comment

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

And the same here?:
OpenTelemetry Jaeger Propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.

* Propagates {@link SpanContext} through Trace Context format propagation.
* {trace-id}:{span-id}:{parent-span-id}:{flags}
* {trace-id}
* 64-bit or 128-bit random number in base16 format
Copy link
Member

Choose a reason for hiding this comment

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

comma in the end ?, and this should apply for other comments too

this._jaegerTraceHeader = customTraceHeader || UBER_TRACE_ID_HEADER;
}

inject(
Copy link
Member

Choose a reason for hiding this comment

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

pls add some jsdoc

] = `${spanContext.traceId}:${spanContext.spanId}:0:${traceFlags}`;
}

extract(
Copy link
Member

Choose a reason for hiding this comment

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

pls add some jsdoc

@obecny
Copy link
Member

obecny commented Jan 17, 2020

@DotSpy could you please add the mentioned screenshot also to the readme, so that it is shown nicely when you view the package ?

* limitations under the License.
*/

export * from './context/propagation/JaegerHttpTraceFormat.js';
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep JaegerTraceFormat in src/ dirrectly, why do we need to have sub-folder?

Copy link
Member

Choose a reason for hiding this comment

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

Also, this should be just export * from './context/propagation/JaegerHttpTraceFormat'; or export * from './JaegerHttpTraceFormat';

Copy link
Member Author

Choose a reason for hiding this comment

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

@mayurkale22 i did it like in opentelemetry-core to keep the same structure. I don't know how better, because this is my first experience with this technology stack. In other languages like Java, Scala, Kotlin and etc. we keeping the same structure for the same responsibilities.

Copy link
Member

Choose a reason for hiding this comment

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

In node it is very common to have a package with a single file in no folder structure of any kind if it only fulfills a single purpose.

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.

Thx for these changes.
One thing and some explanation for this description
"OpenTelemetry propagator-jaeger provides HTTP header propagation for systems that are using Jaeger HTTP header format"

propagator-jaeger is good name when we name package so the the namespace is correct.
For example plugin-xml-http-request, plugin-http, plugin-mysql etc. But when you are describing what it is you are using common language, that's why we have MySql Plugin and not Plugin MySql, XMLHttpRequest Plugin and not Plugin XMLHttpRequest. So the same applies here.
That's why I think it would sounds more naturally when you say Yaeger Propagator, instead Propagator Yaeger, That's why in description I think we should use this form Yaeger Propagator when we say about @opentelemetry/propagator-yaeger.
And if in future we want to have more propagators it will be @opentelemetry/propagator-xyz and we will call it XYZ Propagator.
I hope my explanation is fine :) besides that great job with your's Yaeger Propagator :)

@DotSpy
Copy link
Member Author

DotSpy commented Jan 17, 2020

"OpenTelemetry propagator-jaeger provides HTTP header propagation for systems that are using Jaeger HTTP header format"

ohh thanks, got it, will change

@mayurkale22 mayurkale22 added enhancement New feature or request Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) labels Jan 17, 2020
@DotSpy
Copy link
Member Author

DotSpy commented Jan 17, 2020

For now i do not understand why it's failing, any ideas?

@dyladan
Copy link
Member

dyladan commented Jan 17, 2020

For now i do not understand why it's failing, any ideas?

require.context only works when used with webpack. your node 8/10/12 tests are attempting to run the index-webpack.ts file as a regular test. Not sure why it is happening here and doesn't happen in the core tests. Maybe @obecny can shed some light.

@obecny
Copy link
Member

obecny commented Jan 17, 2020

For now i do not understand why it's failing, any ideas?

require.context only works when used with webpack. your node 8/10/12 tests are attempting to run the index-webpack.ts file as a regular test. Not sure why it is happening here and doesn't happen in the core tests. Maybe @obecny can shed some light.

try to replace in package.json the test script with this one
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts' --exclude 'test/index-webpack.ts'",

@dyladan
Copy link
Member

dyladan commented Jan 17, 2020

For now i do not understand why it's failing, any ideas?

require.context only works when used with webpack. your node 8/10/12 tests are attempting to run the index-webpack.ts file as a regular test. Not sure why it is happening here and doesn't happen in the core tests. Maybe @obecny can shed some light.

try to replace in package.json the test script with this one
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts' --exclude 'test/index-webpack.ts'",

Why does core not do this? https://github.com/open-telemetry/opentelemetry-js/blob/021bbbbee9356ff56c4b703633e0f67d16b3e425/packages/opentelemetry-core/package.json

@DotSpy
Copy link
Member Author

DotSpy commented Jan 17, 2020

For now i do not understand why it's failing, any ideas?

require.context only works when used with webpack. your node 8/10/12 tests are attempting to run the index-webpack.ts file as a regular test. Not sure why it is happening here and doesn't happen in the core tests. Maybe @obecny can shed some light.

try to replace in package.json the test script with this one
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts' --exclude 'test/index-webpack.ts'",

Why does core not do this? https://github.com/open-telemetry/opentelemetry-js/blob/021bbbbee9356ff56c4b703633e0f67d16b3e425/packages/opentelemetry-core/package.json

i think this issue with test directories in opentelemetry-propagator-jaeger

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

* @param {string} [customTraceHeader="uber-trace-id"] - HTTP header to inject\extract trace from.
**/
constructor(customTraceHeader?: string) {
this._jaegerTraceHeader = customTraceHeader || UBER_TRACE_ID_HEADER;
Copy link
Member

Choose a reason for hiding this comment

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

👍

@mayurkale22 mayurkale22 merged commit 6de9afb into open-telemetry:master Jan 20, 2020
@DotSpy DotSpy deleted the jaeger-format branch January 15, 2021 10:51
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
…ry#701)

* feat: add jaeger http trace format (open-telemetry#696)

* feat: add jaeger http trace format (open-telemetry#696)

* feat: add jaeger http trace format (open-telemetry#696)

* feat: add jaeger http trace format (open-telemetry#696)

* feat: add jaeger http trace format (open-telemetry#696)

* feat: add jaeger http trace format (open-telemetry#696)

* fix: we should set sampled\unsampled via flag

* fix: we should set sampled\unsampled via flag

* fix: flags should be converted to hex, not decimal

* feat: create new package for propagation jaeger

* fix: remove unused dependencies, correct readme header, moved out jaeger from core index.ts

* fix: added jaeger keyword

* fix: remove comma

* docs: replace NodeTracer with NodeTracerRegistry

* fix: added missing jaeger keyword to exporter-jaeger

* fix: remove test for browser

* fix: remove yarn for browser

* fix: use same naming style as other packages

* feat: added index.ts and version.ts, revert test for browser

* fix: tests added index-webpack.ts

* test: add test with span generated by jaeger client

* fix: apply review changes

* fix: move out from sub dirs

* docs: use common language for docs

* fix: test script fix

Co-authored-by: Uladzislau Kiva <vladislav.kiva@moneyman.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for jaeger propagation formats
8 participants