DataDog / serverless-plugin-datadog

Serverless plugin to automagically instrument your Lambda functions with Datadog
Apache License 2.0
94 stars 50 forks source link

Error loading config: open /var/task/datadog.yaml: no such file or directory #183

Closed RomanMinkin closed 2 years ago

RomanMinkin commented 2 years ago

Expected Behavior

No warning message appears should appear in the log

Actual Behavior

Following warning appears in the log on every Lambda Function invocation:

SAGENT | WARN | Error loading config: open /var/task/datadog.yaml: no such file or directory

Steps to Reproduce the Problem

  1. Have serverless-plugin-datadog used by the lambda function
  2. Invoke Function
  3. The warning shows up in the log

Specifications

Stacktrace

No stack trace

astuyve commented 2 years ago

Hi @RomanMinkin! This appears to be coming from the datadog agent, which would mean you're using the Datadog Lambda Extension, correct?

Is the environment variable DD_LOG_LEVEL set? If so, what is it set to?

This appears intentional, but I don't think it should be shown for every invocation unless DD_LOG_LEVEL is set.

Let me know!

RomanMinkin commented 2 years ago

@astuyve thank you for the fast reply!

I'm not very familiar with how datadog-agent works and just wandering what do I do wrong as I could not figure out what setting do I need to change to fix that warning message without changing log level?

astuyve commented 2 years ago

@RomanMinkin Thanks! That's super helpful. So the log line you're seeing is indeed coming from the datadog-agent. You see it on startup because that's when the agent is initialized.

You're not doing anything wrong, it's just a warning and can be ignored. There are sane defaults set in the absence of the configuration file. Since DD_LOG_LEVEL is INFO, you could unset it entirely (or set it to something higher like ERROR) to mute this message.

You don't have to fix anything - but if you're curious, the datadog.yaml file is used to configure the agent to your liking. The most common example I see is obfuscating span tags, so you can remove sensitive data: https://docs.datadoghq.com/tracing/setup_overview/configure_data_security/?tab=http#replace-rules-for-tag-filtering

Please let me know if you are able to suppress this message by unsetting DD_LOG_LEVEL, or choosing a higher level - if so, we will close this issue. Thanks!

RomanMinkin commented 2 years ago

@astuyve setting DD_LOG_LEVEL to error does remove the warning message indeed. Thank you! Just out of curiosity is there anything can be done to somehow create datadog.yaml in the Datadog Lambda Extension so the warning would not sow up and we can use info leve lat the same time?

astuyve commented 2 years ago

@RomanMinkin Yup, even an empty one would work. You can just add it to the root level of your project.

RomanMinkin commented 2 years ago

@astuyve sorry I'm now to Datadog. Would it be too much to ask to point to how it can be done with serverless-plugin-datadog configuration?

astuyve commented 2 years ago

Oh - the plugin won't create it for you. You can just run touch datadog.yaml to create an empty file in your project, then when you run severless deploy, the Serverless Framework will automatically package it up and inject the empty file into your runtime. This will suppress the error (since the file exists, but contains no configuration). Then you can keep DD_LOG_LEVEL: INFO and won't see the message.

RomanMinkin commented 2 years ago

@astuyve awesome, that is what I was looking for! Thank you again! Closing the issue.

astuyve commented 2 years ago

Happy to help! Datadog provides a public slack channel where you can ask general questions, which may be helpful to you on your journey adopting observability with Datadog! You can join here.