DataDog / serverless-plugin-datadog

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

high_error_rate thresholds without critical cause issues #206

Closed a7i closed 9 months ago

a7i commented 2 years ago

Expected Behavior

Per README, Defining the following monitor should work

      - high_error_rate:
          name: "High Error Rate on {{functionname.name}} in {{region.name}} for {{aws_account.name}}"
          options:
            thresholds:
              warning: 0.05
              ok: 0.025

Actual Behavior

sls deploy produces the following error:

Serverless: Error occurred when configuring monitors.

The error will only go away only if you add critical to thresholds as the following example works

      - high_error_rate:
          name: "High Error Rate on {{functionname.name}} in {{region.name}} for {{aws_account.name}}"
          options:
            thresholds:
              critical: 0.10
              warning: 0.05
              ok: 0.025

Steps to Reproduce the Problem

  1. Create a metric with thresholds definition missing critical
  2. sls deploy
  3. observe Serverless: Error occurred when configuring monitors.

Specifications

Stacktrace

❯ serverless deploy --region us-west-2 --stage dev
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command datadog
Serverless: Load command datadog:clean
Serverless: Load command datadog:generate
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: [AWS ssm 200 0.605s 0 retries] getParameter({
  Name: '/aws/reference/secretsmanager/dev/cloud-functions/datadog',
  WithDecryption: true
})
Serverless: Skipping variables resolution with old resolver (new resolver reported no more variables to resolve)
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Auto instrumenting functions with Datadog
Serverless: Adding Lambda Library Layers to functions
Serverless: Unable to determine runtime for function cloud-functions-poc
Serverless: Adding Datadog Lambda Extension Layer to functions
Serverless: Unable to determine runtime for function cloud-functions-poc
Serverless: Packaging service...
Serverless: Setting Datadog Forwarder
Serverless: Adding Plugin Version 3.2.1 tag
Serverless: Adding service and environment tags
Serverless: [AWS sts 200 0.169s 0 retries] getCallerIdentity({})
Serverless: Setting Datadog Forwarder
Serverless: Adding Plugin Version 3.2.1 tag
Serverless: Adding service and environment tags
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy
...
Serverless: Service files not changed. Skipping deployment...
Serverless: Invoke aws:info
...
Serverless: Invoke aws:deploy:finalize
Serverless: Deprecation warning: Syntax for referencing SSM parameters was upgraded with automatic type detection and there's no need to add "~true" or "~split" postfixes to variable references.
            Drop those postfixes and set "variablesResolutionMode: 20210326" in your service config to adapt to a new behavior.
            Starting with next major release, this will be communicated with a thrown error.

            More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_VARIABLES_RESOLVER
astuyve commented 2 years ago

Hey @a7i - this appears to be a mistake in the documentation. Critical (or Alert, as it's called in the app), is a required field for a monitor: image

warning should be optional. I can update the documentation.

a7i commented 2 years ago

@astuyve I would expect it to merge the values from thresholds as critical value of 0.1 is the default for high_error_rate. It appears that it's overriding the whole thresholds map.

astuyve commented 2 years ago

Hi @a7i - we're leaving this open to see if other users would want this feature, but we're not prioritizing it in the near term.

Thanks for the report!

astuyve commented 9 months ago

Closing this as it's been over a 18 months with no additional requests. Feel free to re-open, or formalize a feature request if there are further questions!