-
Notifications
You must be signed in to change notification settings - Fork 4
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
MetricsUtils.withSingleMetric doesn't publish powertools default "Service" dimension #30
Comments
Hey @qtdzz Thanks for opening the issue, I will have a look at this later today. |
@qtdzz I have read through the details of this issue now. Some thoughts.
Challenge here is to keep this precedence consistent That being said, since this is related to behavior in core utilities of powertools, I quickly checked the behavior for python version as well. It does not support this feature as well. @heitorlessa What are your thoughts on this? |
Thank you @pankajagrawal16 for looking into the issue and the information. Now I get the challenging part.
I assume you are talking about the As far as I understand, the steps you described to resolve default powertools dimension are all in It's indeed not a clean solution but from consumers perspective, I think it provides much better experience. |
Apologies, Yeah I meant Implementation is not an issue, we might support it. At this point I am wondering if it's too much assumptions to make for the users. And since this is a core utility, i will be much interested in learning what python folks think about this support. @heitorlessa May be you missed this one, thoughts? |
We did or nay internationally - single metric is for customers looking to
create a single metric that would differ from dimensions and other metrics
already set.
I’m totally onboard to have an additional parameter within single metric to
include service dimension and/or default dimensions too —- this however
begs the question as to why you’d want both service and default dimensions
in this case vs Metrics.
If there’s a proposed UX, let’s create a roadmap item to discuss more
narrowly ;-)
…On Wed, 2 Jun 2021 at 10:06, Pankaj Agrawal ***@***.***> wrote:
Thank you @pankajagrawal16 <https://github.com/pankajagrawal16> for
looking into the issue and the information. Now I get the challenging part.
1. Else, Check if service attribute specified on @Tracing annotation,
if found use it as Service dimension
I assume you are talking about the @Metric annotation.
As far as I understand, the steps you described to resolve default
powertools dimension are all in LambdaMetricsAspect.refreshMetricsContext
<https://github.com/awslabs/aws-lambda-powertools-java/blob/master/powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspect.java#L122>.
Could we keep the value after resolving as a static variable in the
LambdaMetricsAspect class or any other within the internal package? So
that customers will know that they shouldn't use it. Then we can take it as
a fallback in MetricsUtils.withSingleMetric when there is no default
dimension.
It's indeed not a clean solution but from consumers perspective, I think
it provides much better experience.
Apologies, Yeah I meant @metrics annotaion.
Implementation is not an issue, we might support it. At this point I am
wondering if it's too much assumptions to make for the users. And since
this is a core utility, i will be much interested in learning what python
folks think about this support.
@heitorlessa <https://github.com/heitorlessa> May be you missed this one,
thoughts?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/awslabs/aws-lambda-powertools-java/issues/409#issuecomment-852832770>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBD3JXU65WC4NZIQC5TTQXRCDANCNFSM45ZH3Y3A>
.
|
Makes sense, There are no changes to UX. The But it makes sense, that since this probably changes to behavior of core utility, I will create a roadmap item and start discussion there |
I’d suggest not doing that but making an opt-in behaviour.
Adding dimension based on these assumptions not only creates side effects
but it’ll also lead to higher costs on their bill - Adding a dimension
effectively creates another Metric as it’s a tuple (metric+dimension)
On Wed, 2 Jun 2021 at 13:13, Pankaj Agrawal ***@***.***>
wrote:
… We did or nay internationally - single metric is for customers looking to
create a single metric that would differ from dimensions and other metrics
already set. I’m totally onboard to have an additional parameter within
single metric to include service dimension and/or default dimensions too —-
this however begs the question as to why you’d want both service and
default dimensions in this case vs Metrics. If there’s a proposed UX, let’s
create a roadmap item to discuss more narrowly ;-)
… <#m_982134101925854959_>
On Wed, 2 Jun 2021 at 10:06, Pankaj Agrawal *@*.***> wrote: Thank you
@pankajagrawal16 <https://github.com/pankajagrawal16>
https://github.com/pankajagrawal16 for looking into the issue and the
information. Now I get the challenging part. 1. Else, Check if service
attribute specified on @Tracing <https://github.com/Tracing> annotation,
if found use it as Service dimension I assume you are talking about the
@Metric <https://github.com/Metric> annotation. As far as I understand,
the steps you described to resolve default powertools dimension are all in
LambdaMetricsAspect.refreshMetricsContext
https://github.com/awslabs/aws-lambda-powertools-java/blob/master/powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspect.java#L122.
Could we keep the value after resolving as a static variable in the
LambdaMetricsAspect class or any other within the internal package? So that
customers will know that they shouldn't use it. Then we can take it as a
fallback in MetricsUtils.withSingleMetric when there is no default
dimension. It's indeed not a clean solution but from consumers perspective,
I think it provides much better experience. Apologies, Yeah I meant
@metrics <https://github.com/metrics> annotaion. Implementation is not an
issue, we might support it. At this point I am wondering if it's too much
assumptions to make for the users. And since this is a core utility, i will
be much interested in learning what python folks think about this support.
@heitorlessa <https://github.com/heitorlessa>
https://github.com/heitorlessa May be you missed this one, thoughts? —
You are receiving this because you were mentioned. Reply to this email
directly, view it on GitHub <#409 (comment)
<https://github.com/awslabs/aws-lambda-powertools-java/issues/409#issuecomment-852832770>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAZPQBD3JXU65WC4NZIQC5TTQXRCDANCNFSM45ZH3Y3A
.
Makes sense, There are no changes to UX. The withSingleMetric APIs
remains the same just that it will make some assumptions and automatically
capture Service as dimension based on what's defined in environment
var/at annotation level/default dimension.
But it makes sense, that since this probably changes to behavior of core
utility, I will create a roadmap item and start discussion there
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/awslabs/aws-lambda-powertools-java/issues/409#issuecomment-852939458>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBH45S4IINTUUCGE54DTQYG5ZANCNFSM45ZH3Y3A>
.
|
Yeah makes sense, Opt in is better. |
Since this pertains to core utility Metrics, Moving here for better visibility and discussion. |
What were you trying to accomplish?
I want to use
MetricsUtils.withSingleMetric
to publish a single metric with additional dimensions without affecting dimensions of other metrics. The single metric should also have the same default powertools dimension as other metrics when I don't overriding the default dimensions.Expected Behavior
The single metric should have the default "Service" dimension as other normal metrics
Current Behavior
The single metric doesn't have the default "Service" dimension as other normal metrics
Possible Solution
I think the problem is in
MetricsUtils#logger
. I suspect two issues here:If there is no overriding default dimensions, we skip setting default dimensions. But in
LambdaMetricsAspect#refreshMetricsContext
(normal cases) we are appending the default powertoolsService
dimension instead. Possible solution: appending default PowertoolsService
dimension here as well.By using
setDimensions
if there are default overriding dimensions, this will likely cause another issue when customers usemetric.setDimensions(dimensions);
in theirConsumer<MetricsLogger>
, the overriding default dimensions will be gone. Possible solution: usesetDefaultDimensions
and update documentation to advice customers usingputDimensions
instead ofsetDimensions
(because usingsetDimensions
will hide all the default dimensions)Steps to Reproduce (for bugs)
defaultDimensions
.MetricsUtils.metricsLogger()
so my metrics will have the default "Service" dimension created by Lambda PowertoolsAdditionalDimension
metric.putDimension(dimensions)
instead ofsetDimensions
, you will get all default EMF dimensions such asLogGroup
,ServiceName
,ServiceType
which is also not desirable, I think.Environment
The text was updated successfully, but these errors were encountered: