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(otlp-exporter): add timeout env var #2738

Merged
merged 82 commits into from
May 11, 2022

Conversation

svetlanabrennan
Copy link
Contributor

@svetlanabrennan svetlanabrennan commented Jan 25, 2022

Signed-off-by: Svetlana Brennan svetlana.svn@gmail.com

Which problem is this PR solving?

Partially Fixes #2706 (issue)

This is just the first PR for issue #2706 that adds OTEL_EXPORTER_OTLP_TIMEOUT & OTEL_EXPORTER_OTLP_TRACES_TIMEOUT as an environment variable for the otlp trace exporters. I wanted to split this issue up in separate prs so it's easier to review and I need this timeout variable for another pr regarding retry logic I'm working on.

Short description of the changes

  • Added OTEL_EXPORTER_OTLP_TIMEOUT as default environment variable
  • Added OTEL_EXPORTER_OTLP_TRACES_TIMEOUT as default environment variable
  • Added timeoutMillis property to the OTLPExporterBase class
  • Added timeout logic to http request (sendWithHttp utility function)
  • Added timeout logic to xhr request (sendWithXhr utility function)
  • Added timeout logic to grpc request (send utility function)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

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

  • Unit tests
  • Integration tests

Checklist:

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

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@codecov
Copy link

codecov bot commented Jan 25, 2022

Codecov Report

Merging #2738 (da4e4c8) into main (ac578e9) will decrease coverage by 0.27%.
The diff coverage is 40.00%.

❗ Current head da4e4c8 differs from pull request most recent head 6ee89b0. Consider uploading reports for the commit 6ee89b0 to get more accurate results

@@            Coverage Diff             @@
##             main    #2738      +/-   ##
==========================================
- Coverage   92.78%   92.51%   -0.28%     
==========================================
  Files         183      183              
  Lines        5921     5958      +37     
  Branches     1257     1266       +9     
==========================================
+ Hits         5494     5512      +18     
- Misses        427      446      +19     
Impacted Files Coverage Δ
...kages/otlp-exporter-base/src/platform/node/util.ts 21.33% <0.00%> (-6.26%) ⬇️
...erimental/packages/otlp-exporter-base/src/types.ts 16.66% <ø> (ø)
...ntal/packages/otlp-grpc-exporter-base/src/types.ts 100.00% <ø> (ø)
...ental/packages/otlp-grpc-exporter-base/src/util.ts 67.18% <0.00%> (-1.07%) ⬇️
...ckages/opentelemetry-core/src/utils/environment.ts 96.00% <ø> (ø)
...perimental/packages/otlp-exporter-base/src/util.ts 89.65% <94.11%> (+6.32%) ⬆️
...ackages/otlp-exporter-base/src/OTLPExporterBase.ts 95.23% <100.00%> (+0.23%) ⬆️

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@svetlanabrennan svetlanabrennan marked this pull request as ready for review January 25, 2022 23:19
@svetlanabrennan svetlanabrennan requested a review from a team January 25, 2022 23:19
@svetlanabrennan
Copy link
Contributor Author

I haven't updated documentation yet. I would like some feedback on this pr before I update documentation please.

@svetlanabrennan
Copy link
Contributor Author

Does OTEL_EXPORTER_OTLP_TRACES_TIMEOUT take precedence over OTEL_EXPORTER_OTLP_TIMEOUT?

svetlanabrennan and others added 3 commits January 26, 2022 13:32
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
…ntelemetry-js into add-exporter-timeout

Merge main into add-exporter-timeout
@vmarchaud
Copy link
Member

oes OTEL_EXPORTER_OTLP_TRACES_TIMEOUT take precedence over OTEL_EXPORTER_OTLP_TIMEOUT

Yes it should, signal specific configs take priority over generic ones

@svetlanabrennan
Copy link
Contributor Author

Got it. I just implemented that logic for OTEL_EXPORTER_OTLP_TRACES_TIMEOUT to take precedence over OTEL_EXPORTER_OTLP_TIMEOUT and refactored some code.

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@svetlanabrennan
Copy link
Contributor Author

Added timeout config information to each otlp trace exporter readme.

This pr is ready for review/merge from my end.

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@vmarchaud vmarchaud added the enhancement New feature or request label Jan 29, 2022
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@svetlanabrennan
Copy link
Contributor Author

Lint test is passing now. The codecov tests are failing but they were passing previously. The codecov path test is saying that the sendWithHttp function isn't being test but it is being tested - the tests are just located in another package.

Should I move these tests into the otlp-exporter-base package?

@svetlanabrennan
Copy link
Contributor Author

Tests failing after main merge. I'm seeing this test failing in the 'main' branch as well (when I run the tests locally).

@Flarna
Copy link
Member

Flarna commented Apr 27, 2022

@dyladan moved the latest label of @opentelemetry/api from verion 1.04 to 1.1.0. This could be the cause here in case several API versions are installed.

@Flarna
Copy link
Member

Flarna commented Apr 27, 2022

local tests on main are green for me. Seems like CI specific failures. Maybe some caching?

@svetlanabrennan
Copy link
Contributor Author

It must have been the cache. The local tests are passing now both in main and in this pr branch.

@svetlanabrennan
Copy link
Contributor Author

@dyladan moved the latest label of @opentelemetry/api from verion 1.04 to 1.1.0. This could be the cause here in case several API versions are installed.

Was this a codecov config change? I assume so because these tests are all passing when I run it locally.

@dyladan
Copy link
Member

dyladan commented Apr 28, 2022

Codecov would not affect the tests anyway but this is probably because the 1.1 api is now latest. There is most likely a version mismatch somewhere. I'm on my phone and ooo right now but may be able to look later if I have time

@svetlanabrennan
Copy link
Contributor Author

Looks like 1 browser test is failing after merging main into this branch. Not sure why. All tests passing when I run it locally.

@Flarna
Copy link
Member

Flarna commented May 5, 2022

re-triggered the test and it's green now. Seems to be a test issue

@svetlanabrennan
Copy link
Contributor Author

I think there's also a test issue with the codecov for "codecov/patch" because it's indicating that some lines are not covered by tests but they are tested.

For example, it says line 54 isn't tested in this file but there is a test for it here.

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

LGTM % nits

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.

LGTM % legendecas' nit

experimental/CHANGELOG.md Outdated Show resolved Hide resolved
svetlanabrennan and others added 3 commits May 9, 2022 15:42
… tests

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@svetlanabrennan
Copy link
Contributor Author

One test failing in an unrelated package (didn't work on that package in this pr).

Could this be a test issue again like @Flarna mentioned earlier for another time an unrelated test was failing?

svetlanabrennan and others added 2 commits May 10, 2022 10:05
@dyladan
Copy link
Member

dyladan commented May 10, 2022

Failure seems to be in the OTLPTraceExporter which is touched by this PR

Signed-off-by: Svetlana Brennan <svetlana.svn@gmail.com>
@svetlanabrennan
Copy link
Contributor Author

Failure seems to be in the OTLPTraceExporter which is touched by this PR

The real http request tests were failing randomly. I think it was a timing issue. So I moved those tests to their own test suite and it's passing now. Also ran it locally a handful of times and it's all green as well.

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.

Overall LGTM was just a bit surprised to see the behavior split by major node version

@@ -60,6 +60,7 @@ All notable changes to experimental packages in this project will be documented
* feat(proto): add @opentelemetry/otlp-transformer package with hand-rolled transformation #2746 @dyladan
* feat(sdk-metrics-base): shutdown and forceflush on MeterProvider #2890 @legendecas
* feat(sdk-metrics-base): return the same meter for identical input to getMeter #2901 @legendecas
* feat(otlp-exporter): add [OTEL_EXPORTER_OTLP_TIMEOUT](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options) env var to otlp exporters #2738 @svetlanabrennan
Copy link
Member

Choose a reason for hiding this comment

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

👍

@dyladan dyladan merged commit 479321c into open-telemetry:main May 11, 2022
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.

otlp exporters: missing some environment variables from spec in SDK
8 participants