-
Notifications
You must be signed in to change notification settings - Fork 115
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
Datadog plugin integration errors #231
Comments
Hi @judehunter , In which order are you setting up the plugins? So I took a quick look at the So other than that, I'd need to get an example project to be able to debug and see what's going on. |
@judehunter The |
ℹ To help those who need an immediate response If you use the default configuration, add this in your Datadog configuration : custom:
datadog:
exclude:
- warmUpPluginDefault |
Hey folks! I maintain the Datadog Serverless Plugin and can help provide some insight here. For Datadog's instrumentation to work, we configure a function with a few environment variables, apply our layers, and modify the handler path. This library creates a warmer function, which the Datadog plugin can modify, however it seems those settings are being reverted back. The end result is an unusable warmer function, which keeps the handler configuration, but removes the added environment variables and removes the layers: "WarmUpPluginOfficeHoursWarmerLambdaFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"S3Key": "serverless/warmup-test/dev/1682606318668-2023-04-27T14:38:38.668Z/warmUpPluginOfficeHoursWarmer.zip"
},
"Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler",
"Runtime": "nodejs18.x",
"FunctionName": "warmup-test-dev-warmup-plugin-officeHoursWarmer",
"MemorySize": 128,
"Timeout": 10,
"Description": "Serverless WarmUp Plugin (warmer \"officeHoursWarmer\")",
"Tags": [
{
"Key": "dd_sls_plugin",
"Value": "v5.28.0"
}
],
"Environment": {
"Variables": {
"DD_LAMBDA_HANDLER": ".warmup/officeHoursWarmer/index.warmUp"
}
},
"Role": {
"Fn::GetAtt": [
"WarmUpPluginOfficeHoursWarmerRole",
"Arn"
]
},
"Layers": []
}, This leaves the warmer function in a bad state. A user reached out via our support and wanted to specifically monitor logs from the warmer function, so I dug into this library and realized we could modify this behavior a few ways - however I am unsure of the side effects. The fastest fix is to return early if this library detects the warmer function already exists: https://github.com/juanjoDiaz/serverless-plugin-warmup/blob/main/src/warmer.js#L216 function addWarmUpFunctionToService(service, warmerName, warmerConfig) {
if (service.functions[`warmUpPlugin${capitalize(warmerName)}`] !== undefined) {
return;
} Alternatively, the I tested this change and confirmed Datadog can receive logs, metrics, traces, and profile data from the warmer: @juanjoDiaz - is there a preference that you have? I'd be happy to investigate/open a PR |
Hi @juanjoDiaz can you take a look at @astuyve's comment and help us figure out a direction for a fix? We have been contacted by another customer with a similar issue, we would happy to open a PR to get it resolved for them. |
Hi @astuyve, Thanks for the good work. This is a tricky one... The real issue comes from here: serverless-plugin-warmup/src/index.js Line 75 in c9ee9fa
The warmup lambdas are added on the Ideally, we all should use the same event... I am happy to hear suggestions. |
#338 is exactly about that. Another option is that you implement double events in the datadog plugin like I do here to avoid issues. |
Yup, sounds good - we're happy to implement whatever is easiest and have similar challenges with bundlers. |
I tried using this plugin with the
serverless-datadog-plugin
, but I get errors when EventBridge tries to invoke the function.Presumably because of the fact that the datadog plugin installs and attaches a Lambda Layer to the function, which the warmup function has troubles with? Not sure though.
The error is:
Removing the datadog plugin from the plugin list in
serverless.yml
fixes the problem entirely.I'm curious to hear if others had problems with this as well, or if maybe there's something wrong with my configuration.
My warmup setup is pretty barebones, with
enabled: true, prewarm: true
andschedule
set to every 5 minutes.The text was updated successfully, but these errors were encountered: