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(opentelemetry-exporter-jaeger): http sender #965

Merged
merged 24 commits into from
Jun 10, 2020

Conversation

leonardodalcin
Copy link
Contributor

@leonardodalcin leonardodalcin commented Apr 13, 2020

Which problem is this PR solving?

Enables the usage of jaeger-client-node HTTPSender in order to send spans over http.

The behavior implemented complies with the following jaeger-client-node documentation statement:

By default, the client sends traces via UDP to the agent at localhost:6832. 
Use JAEGER_AGENT_HOST and JAEGER_AGENT_PORT to send UDP traces to a different host:port. 
If JAEGER_ENDPOINT is set, the client sends traces to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. 
If JAEGER_ENDPOINT is secured, HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables.

Extracted from: https://github.com/jaegertracing/jaeger-client-node#environment-variables

Short description of the changes

1. packages/opentelemetry-exporter-jaeger/src/jaeger.ts:

  • Populates the config fields endpoint, username and password at JaegerExporter contruction . code
  • Checks if config.endpoint is setten and instanciates this._sender as a HTTPSender and reffers original documentation in commentaries. code

2. packages/opentelemetry-exporter-jaeger/src/types.ts:

  • Adds the properties endpoint, username and password to ExporterConfig interface . code
  • Declares HTTPSender as a jaeger type. code

@codecov-io
Copy link

codecov-io commented Apr 13, 2020

Codecov Report

Merging #965 into master will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #965      +/-   ##
==========================================
+ Coverage   92.31%   92.39%   +0.08%     
==========================================
  Files         117      118       +1     
  Lines        3396     3407      +11     
  Branches      689      694       +5     
==========================================
+ Hits         3135     3148      +13     
+ Misses        261      259       -2     
Impacted Files Coverage Δ
...ckages/opentelemetry-exporter-jaeger/src/jaeger.ts 94.82% <100.00%> (+5.03%) ⬆️
...ackages/opentelemetry-exporter-jaeger/src/types.ts 100.00% <100.00%> (ø)
...ackages/opentelemetry-exporter-jaeger/src/utils.ts 100.00% <100.00%> (ø)

@@ -38,8 +39,21 @@ export class JaegerExporter implements SpanExporter {
typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;

config.host = config.host || process.env.JAEGER_AGENT_HOST;
config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT;
config.username = config.username || process.env.JAEGER_USER;
config.password = config.password || process.env.JAEGER_PASSWORD;
Copy link
Member

Choose a reason for hiding this comment

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

I woud prefer to verify that one of username/password or endpoint is defined and valid to avoid runtime errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 7e64566

Copy link
Member

Choose a reason for hiding this comment

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

With your commit, i think it's not possible to only use JAEGER_AGENT_ENDPOINT env var since you check for config.endpoint which should be undefined in this case. Is that normal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If process.env.JAEGER_ENDPOINT is defined, then config.endpoint will also be. I don't think i understood what you meant.

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, only need the tests to pass

@mayurkale22 mayurkale22 requested a review from mwear as a code owner May 27, 2020 05:40
@mayurkale22 mayurkale22 added the enhancement New feature or request label May 27, 2020
@mayurkale22
Copy link
Member

Any release date for this?

Sorry for the delay in response. We will include this change in 0.8.3 release. Let us know if you're blocked on this, we can cut the release sometime this week.

@romilpunetha
Copy link

Any release date for this?

Sorry for the delay in response. We will include this change in 0.8.3 release. Let us know if you're blocked on this, we can cut the release sometime this week.

Not a blocker. I was looking for a standard way to do this across node and java services. Java auto instrumentation sends it directly to the collector. I couldn't find a way to make use of the agent there, whereas nodejs agent would only send to the agent.

// to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured,
// HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables.
if (localConfig.endpoint) {
localConfig.endpoint = localConfig.endpoint || process.env.JAEGER_ENDPOINT;
Copy link
Member

Choose a reason for hiding this comment

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

this will never use the env

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should fix it: 8d51800

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

@mayurkale22
Copy link
Member

@dyladan please take a look when you get a chance.

@leonardodalcin Please, resolve the conflicts.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 9, 2020

CLA Check
The committers are authorized under a signed CLA.

@dyladan
Copy link
Member

dyladan commented Jun 10, 2020

@leonardodalcin looks like this is ready to merge once conflicts are resolved

@mayurkale22 mayurkale22 merged commit 21f0862 into open-telemetry:master Jun 10, 2020
@leonardodalcin leonardodalcin deleted the http-sender branch December 1, 2021 14:01
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
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.

None yet

9 participants