Disabling Monitoring & Observability for Specific Stages

Hello Serverless Framework Community,

I’m diving deeper into customizing the Serverless Framework for my project needs, specifically in terms of controlling Monitoring & Observability features based on the deployment stage.

My latest approach involves using a custom variable to conditionally disable monitoring. Here’s what my serverless.yml looks like:

  stage: ${opt:stage, 'dev'}

  disableMonitoring: ${self:custom.myStage != 'dev'}

With this setup, I aim to disable the monitoring features when the deployment stage is not ‘dev’. However, this doesn’t work and I don’t know if there are better ways to handle such conditional logic in the Serverless Framework.

Does anybody know how I could disable monitoring for certain environments?

Thank you in advance!