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

profiler: Implement WithUploadTimeout #852

Merged
merged 5 commits into from
Mar 26, 2021

Conversation

felixge
Copy link
Member

@felixge felixge commented Feb 19, 2021

Also add support for the DD_PROFILING_UPLOAD_TIMEOUT used by other
DD profilers such as Java.

The timeout is implemented using a request context, which allows
removing the timeout option from the defaultClient and WithUDS option.

defaultHTTPTimeout is promoted to DefaultUploadTimeout to be consistent
with the other default options.

The order of preference is:

  1. DefaultUploadTimeout
  2. DD_PROFILING_UPLOAD_TIMEOUT
  3. WithUploadTimeout()

Implements PROF-2810

@felixge felixge force-pushed the felix.geisendoerfer/profiler-upload-timeout branch from cb33583 to 344e01c Compare February 19, 2021 12:59
@felixge felixge added this to the 1.29.0 milestone Feb 19, 2021
@felixge felixge force-pushed the felix.geisendoerfer/profiler-upload-timeout branch from 344e01c to 0b2e7a0 Compare February 19, 2021 13:03
Also add support for the DD_PROFILING_UPLOAD_TIMEOUT used by other
DD profilers such as Java.

The timeout is implemented using a request context, which allows
removing the timeout option from the defaultClient and WithUDS option.

defaultHTTPTimeout is promoted to DefaultUploadTimeout to be consistent
with the other default options.

The order of preference is:
1. DefaultUploadTimeout
2. DD_PROFILING_UPLOAD_TIMEOUT
3. WithUploadTimeout()

Implements PROF-2810
@felixge felixge force-pushed the felix.geisendoerfer/profiler-upload-timeout branch from 0b2e7a0 to 73b1bbf Compare February 19, 2021 13:05
@gbbr gbbr modified the milestones: 1.29.0, 1.30.0 Feb 26, 2021
@felixge felixge marked this pull request as ready for review March 22, 2021 11:57
Copy link
Member

@pmbauer pmbauer 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 an objectively better approach than the existing pattern. Until recently there was no specified upload timeout; the state of code prior to this pull request was modeled on what dd-trace-go/ddtrace is doing.

However, I do think there should be a default timeout, which this pull request effectively removes.

We might also add a test for this in upload_test.go.

@gbbr thoughts on this approach and updating the trace client to use a similar pattern?

profiler/upload.go Outdated Show resolved Hide resolved
pmbauer
pmbauer previously approved these changes Mar 22, 2021
Copy link
Member

@pmbauer pmbauer left a comment

Choose a reason for hiding this comment

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

Nevermind, I can't read. I do see the DefaultUploadTimeout

@gbbr
Copy link
Contributor

gbbr commented Mar 22, 2021

@gbbr thoughts on this approach and updating the trace client to use a similar pattern?

I guess users can currently change the default client to a custom http.Client to obtain this effect. Is that different than a request with a timeout context? Not sure.

There was no need to have this until now with a specific function, but we can if we have to.

@pmbauer
Copy link
Member

pmbauer commented Mar 22, 2021

@gbbr that makes sense. Profiler has a DD_PROFILING_UPLOAD_TIMEOUT env var we are trying to normalize our clients on and as the tracer doesn't have an equivalent, it makes sense to deviate here I think.

@felixge felixge force-pushed the felix.geisendoerfer/profiler-upload-timeout branch from b3cf200 to 3db6059 Compare March 25, 2021 08:32
@felixge
Copy link
Member Author

felixge commented Mar 25, 2021

@gbbr @pmbauer this is ready for another look, thx!

@felixge felixge merged commit c76588d into v1 Mar 26, 2021
@felixge felixge deleted the felix.geisendoerfer/profiler-upload-timeout branch March 26, 2021 12:19
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.

3 participants