Skip to content
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: remove service_undefined from default dimensions #3374

Open
2 tasks done
akshuc96 opened this issue Nov 26, 2024 · 3 comments
Open
2 tasks done

Feature request: remove service_undefined from default dimensions #3374

akshuc96 opened this issue Nov 26, 2024 · 3 comments
Labels
feature-request This item refers to a feature request for an existing or new utility metrics This item relates to the Metrics Utility next-major-version on-hold This item is on-hold and will be revisited in the future

Comments

@akshuc96
Copy link

Use case

The customers may not want to publish the service as a dimension, because they are is using other dimensions.

Solution/User Experience

Remove default dimension as service in the powertools

Alternative solutions

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@akshuc96 akshuc96 added feature-request This item refers to a feature request for an existing or new utility triage This item has not been triaged by a maintainer, please wait labels Nov 26, 2024
Copy link

boring-cyborg bot commented Nov 26, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@dreamorosi
Copy link
Contributor

Hi @akshuc96,

The default behavior of Metrics is to add a service dimension to all metrics to help customers identify metrics. This value can be set by customers either via the serviceName constructor option or POWERTOOLS_SERVICE_NAME env variable.

This is not something we intend to change, so we will continue with this default as we believe it constitutes a sensible default.

What we can consider changing instead is what happens when customers don't specify a service name using either of the two methods above. Currently, if you don't set a service name, the Metrics utility will set the service dimension with value service_undefined, i.e.:

{"_aws":{"Timestamp":1732794693747,"CloudWatchMetrics":[{"Namespace":"my-app","Dimensions":[["service"]],"Metrics":[{"Name":"CustomMetric","Unit":"Bits"}]}]},"service":"service_undefined","CustomMetric":100}

This is something we implemented this way mainly for consistency, but I can see how it adds little value, so I agree we should consider changing.

Since this is a default, changing it requires a potentially breaking change and thus, we can do this only in our next major version - for which we don't yet have a date.

Besides adding this item to our v3 discussion, as a temporary solution, you can call metrics.clearDefaultDimensions() at some point after having initialized the Metric class, for example:

import { Metrics } from '@aws-lambda-powertools/metrics';

const metrics = new Metrics({ namespace: 'my-app' });
metrics.clearDefaultDimensions();

export const handler = async () => {
  // ...
};

cc @aws-powertools/lambda-python-core & @aws-powertools/lambda-dotnet-core - you might want to consider this same change in case you're doing the same.

@dreamorosi dreamorosi added metrics This item relates to the Metrics Utility on-hold This item is on-hold and will be revisited in the future revisit-in-3-months Blocked issues/PRs that need to be revisited and removed triage This item has not been triaged by a maintainer, please wait labels Nov 28, 2024
@dreamorosi dreamorosi moved this from Triage to On hold in Powertools for AWS Lambda (TypeScript) Nov 28, 2024
@dreamorosi dreamorosi added next-major-version and removed revisit-in-3-months Blocked issues/PRs that need to be revisited labels Feb 3, 2025
@dreamorosi
Copy link
Contributor

We are still committed to do this in the next major version - I have added the item to the discussion and the corresponding label.

If you find this item useful please feel free to add a 👍 to the original post above.

@dreamorosi dreamorosi changed the title Feature request: Remove default dimension as service in the powertools in typescript Feature request: remove service_undefined from default dimensions Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This item refers to a feature request for an existing or new utility metrics This item relates to the Metrics Utility next-major-version on-hold This item is on-hold and will be revisited in the future
Projects
Development

No branches or pull requests

2 participants