[exporter/datadogexporter] Do not validate key if the result will not be checked
Description: <Describe what has changed.>
In the DataDog exporter, for both traces and metrics, the API Key validation is being run and then, if the fail_on_invalid_key option is set, the result is thrown away. This PR prevents the validation from running at all if the error would be ignored. With both traces and metrics enabled, this can speed up the startup of the exporter by up to 1 second.
Link to tracking Issue: <Issue number if applicable>
Testing: <Describe what testing was performed and which tests were added.>
Documentation: <Describe the documentation added.>
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: craigandrews / name: Craig Andrews (0cc92b3c838e664c6b0ec794fe006783e7c5844f)
This PR was marked stale due to lack of activity. It will be closed in 14 days.
@craigandrews any thoughts on the above?
@craigandrews any thoughts on the above?
The use case was to use the DD exporter inside an AWS Lambda function. The key was being validated separately for trace and metrics making the cold boot of the Lambda function take over 800ms. Removing the calls reduced it to <100ms. However, for unrelated reasons I've moved away from this solution.
Okay, that's a fair reason to move this check into its own goroutine. I will create a card in our backlog to get around to doing this eventually.
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Closed as inactive. Feel free to reopen if this PR is still being worked on.
I'm having the same problem, my Lambda initialization frequently times out on the API key check call, I think doing this in a goroutine if not set to fail would be a good change, as the only purpose in this cause would be to log an error.