-
Notifications
You must be signed in to change notification settings - Fork 294
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
[ci-visibility] Do not instrument tests if agentless is setup but no API key is provided #2072
[ci-visibility] Do not instrument tests if agentless is setup but no API key is provided #2072
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2072 +/- ##
==========================================
- Coverage 92.89% 92.81% -0.09%
==========================================
Files 207 207
Lines 8264 8291 +27
==========================================
+ Hits 7677 7695 +18
- Misses 587 596 +9
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
ci/init.js
Outdated
exporter: 'datadog' | ||
} | ||
} else { | ||
console.error(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the tracer is loaded, but not initialized, is the logger available at this point? If so, it should be used here. If not, then nevermind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good question. I'll try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, log.error
won't work because it's not enabled (https://github.com/DataDog/dd-trace-js/blob/master/packages/dd-trace/src/log.js#L115). Using console.error is a bit aggressive but the way to get it is not straightforward. You have to use ci visibility's entrypoint and opt in to agentless via the flag. At that point I think it's fine to warn users that they've messed up their setup (by missing their API key)
@bengl did you have time to have a look at this again? |
What does this PR do?
Do not call
tracer.init
ifDD_CIVISIBILITY_AGENTLESS_ENABLED
and noDATADOG_API_KEY
is set, instead of falling back to the agent-based intake.ℹ️ This is a breaking change but the feature is not GA yet, so no need for a major release.
Motivation
DD_CIVISIBILITY_AGENTLESS_ENABLED
but they have misconfigured the library, so it shouldn't fallback to the agent-based intake.Plugin Checklist
Additional Notes