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

Add lambda embedded metrics plugin #53

Closed
wants to merge 5 commits into from
Closed

Conversation

mishaled
Copy link

@mishaled mishaled commented Apr 27, 2023

Which issues does it affect?

What it does

This feature adds a support for lambda EMF custom metrics

@mishaled mishaled changed the title Add lambda embedded metrics plugin (#1) Add lambda embedded metrics plugin Apr 27, 2023
tags?: Record<string, string> | undefined,
context?: Record<string, string> | undefined
): Promise<void> {
await this.sendMetric(name, Unit.Seconds, value, tags, context, StorageResolution.High);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are u sure its seconds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korengal You're right, its MS, I'll fix that

Copy link
Author

@mishaled mishaled May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@korengal korengal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think It will be easier to use this package:
https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics/#getting-started

  1. It writes to console in a format that AWS knows how to take it without async calls.
  2. The api is easier
const metrics = new Metrics({
            namespace: METRICS_NAMESPACE,
            serviceName: process.env.AWS_LAMBDA_FUNCTION_NAME || '',
            defaultDimensions: labels
        });

        metrics.addMetric(metricName, unit, value);
        metrics.publishStoredMetrics();

In addition, I would call the plugin CloudwatchPlugin

@mishaled mishaled requested a review from korengal May 1, 2023 08:36
@mishaled mishaled closed this May 8, 2024
@mishaled mishaled reopened this Aug 29, 2024
@mishaled mishaled closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants