-
Notifications
You must be signed in to change notification settings - Fork 411
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
Feature request: Create an environment variable to allow customer disable custom metrics #2996
Comments
The discussion on Discord seems to suggest that this is going to be a feature for non-production environments and/or testing, if this is the case, should this be part of the existing |
That's a great point @dreamorosi! I think we need to create an explicit variable like But what you're suggesting is: if the |
Yes
I think the question here is: what type of use case does this environment variable enable, and when do we want customers to use it? The reasoning we have been using with Tracer and Event Handler is that the default behavior is for tracing to be enabled and for Event Handler to have (for example) CORS enabled & scoped down. By providing an environment we allow customers to override this behavior in particular occasions like testing or development environments. The key proposition of these env variables is not to provide yet another configuration option but rather allow customers to temporarily tweak the behavior in some cases without having to change their code: i.e. I can test my production code without changes but I want to disable tracing because the X-Ray Daemon is not available in my testing environment. While it's indeed a customer choice, I think it should be explicit that we want these behaviors (i.e. tracing being disabled, metrics not being emitted, event handler allowing any origins, etc.) only in development environments and not in production. Having these settings behind an env variable that is explicitly named after the use case ( If they really don't want to emit metrics / traces in any of their environments, including production, then they should remove the dependency altogether to avoid having dead code / code that is a no-op but still gets imported and has potential impact on their Init phase. To sum up: I'm not against giving customers choice, but I think that we also have the responsibility to educate customers and be opinionated on topics like this, otherwise we'll end up becoming yet another k8s with dozens of knobs & handles. This by the way, was also the aim of the
In my opinion adding a With that said, I'm happy to discuss this further and commit in case everyone else wants to go in this direction. |
I see many cases where customers can use this: development environment, stage environment, stress testing where custom metrics don't matter, even in production if the customer just wants to disable metrics globally without changing code. There are many use cases where I don't think we can cover them all, and forcing clients to use
I think this is a configuration that makes the adoption of a library like Powertools more flexible and allows customers to choose their desired behavior. As I said in the first paragraph, I can't think of all the use cases customers might have, but I would like to have the option to only disable custom business metrics if I'm running a stress test in the pre-production environment.
This is true for Tracer, where the customer can remove the X-Ray dependency, but for Metrics there is no such option as our default provider uses
Yes, I agree that we should avoid creating a complex ecosystem where customers need dozens of resources to deploy a
I fully agree that we need to listen to others before making a decision. Thank you very much for raising all these points, as we are always doing an amazing job when we try to cover as many situations as possible to deliver the best customer experience. 🚀 |
Great points here! I also believe that running a staging / QA environment with POWERTOOLS_DEV would not be smart. Besides, you might have different reasons for enabling metrics BUT not logs, or vice-verse. So I believe integrating with POWERTOOLS_DEV and having a dedicated environment variable makes sense here. |
@anafalcao is working to add this support. |
|
This is now released under 3.6.0 version! |
Use case
Original discussion: #2986
Similar to the Tracer utility (https://docs.powertools.aws.dev/lambda/python/latest/core/tracer/#environment-variables), our customers want to disable custom metrics in environments like dev and others.
More information here: https://discord.com/channels/1006478942305263677/1006478942787604491/1143575948994826260
Solution/User Experience
Create an environment variable to explicitly disable custom metrics.
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: