You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @btorretta, thanks for raising it so we can improve our docs. Could you give me a concrete example of what you're trying to achieve?
If I understood what you're after correctly, that visual can be represented in the following code. This demonstrates that every function function emit distinct metrics to the same namespace allowing them to group all metrics to a given application composed of multiple services. They use a different service name to easily filter metrics out, so you'd know metric X was emitted by service Y.
In this example, we add multiple values to the metric ProductAdded, first 5, then 10. While you can add multiple values to a given metric, you cannot have a dimension with multiple values.
product-service Lambda function with multiple values
fromaws_lambda_powertoolsimportMetricsfromaws_lambda_powertools.metricsimportMetricUnitmetrics=Metrics(namespace="e-commerce-app", service="product-service")
metrics.add_metric(name="ProductAdded", unit=MetricUnit.Count, value=5)
# Additional value to the same metricmetrics.add_metric(name="ProductAdded", unit=MetricUnit.Count, value=10)
Activity
heitorlessa commentedon Mar 15, 2021
Hi @btorretta, thanks for raising it so we can improve our docs. Could you give me a concrete example of what you're trying to achieve?
If I understood what you're after correctly, that visual can be represented in the following code. This demonstrates that every function function emit distinct metrics to the same namespace allowing them to group all metrics to a given application composed of multiple services. They use a different service name to easily filter metrics out, so you'd know metric X was emitted by service Y.
shoppingcart-service Lambda function
product-service Lambda function
delivery-service Lambda function
In this example, we add multiple values to the metric
ProductAdded, first 5, then 10. While you can add multiple values to a given metric, you cannot have a dimension with multiple values.product-service Lambda function with multiple values