Skip to content

Commit

Permalink
refactor(trace): exit early when there's no key
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Mar 31, 2022
1 parent 64653f6 commit 9c7241d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/trace-dd.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ const collectTraces = async (filePath, metadata) => {
* Naively validate, collect necessary args.
*/
const validateArgs = async () => {
const { DD_ENV, DD_SERVICE } = process.env
const { DD_ENV, DD_SERVICE, DATA_DOG_API_KEY } = process.env

if (!DATA_DOG_API_KEY) {
console.log(
"Skipping trace collection, api key is not available. Ensure 'DATA_DOG_API_KEY' env variable is set."
)
return
}

if (!DD_ENV || !DD_SERVICE) {
throw new Error(
Expand Down

0 comments on commit 9c7241d

Please sign in to comment.