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

RFC: Add Datadog metrics provider #2903

Closed
2 tasks done
roger-zhangg opened this issue Aug 1, 2023 · 3 comments · Fixed by #2906
Closed
2 tasks done

RFC: Add Datadog metrics provider #2903

roger-zhangg opened this issue Aug 1, 2023 · 3 comments · Fixed by #2906
Assignees
Labels

Comments

@roger-zhangg
Copy link
Member

roger-zhangg commented Aug 1, 2023

Is this related to an existing feature request or issue?

#2015

Which Powertools for AWS Lambda (Python) utility does this relate to?

Metrics

Summary

We didn't included the Datadog metrics provider in our initial metrics provider release due to a dependency conflict. Now that the conflict is resolved, This RFC is for adding back the previously included Datadog metrics provider

Use case

If our customer would like to use Datadog for metrics. This pre-defined Datadog metrics provider is the solution. With pre-defined Datadog metrics provider, a current Cloudwatch EMF metrics user can switch to use Datadog metrics by making few lines of code changes.

⚠️ Customer still need to setup either a Datadog Lambda Layer or a Datadog log forwarder to send the metrics.

Proposal

from aws_lambda_powertools.utilities.typing import LambdaContext
from aws_lambda_powertools.metrics.provider import DatadogMetrics
from aws_lambda_powertools.metrics.provider import DatadogMetricsProvider

# Use datadog-defined metrics provider
provider = DatadogMetricsProvider()
metrics = DatadogMetrics(provider=provider)

@metrics.log_metrics
def lambda_handler(event: dict, context: LambdaContext):
    metrics.add_metric(name="SuccessfulBooking", value=1, tags={"product":"ticket","order":"online"})
    
# JSON output to log
# {
#     "m": "SuccessfulBooking", 
#     "v": 1,
#     "e": 1678509106, 
#     "t": "['product:ticket', 'order:online']"
# }

    metrics.add_metric(name="SuccessfulBooking", value=1, product="ticket", order="online")
# JSON output to log
# {
#     "m": "SuccessfulBooking", 
#     "v": 1,
#     "e": 1678509106, 
#     "t": "['product:ticket', 'order:online']"
# }

Out of scope

Resolving Datadog side issue is out of scope

Potential challenges

Potential challenges includes Datadog might changes metrics from log format in the future, and

Dependencies and Integrations

Dependent on datadog lambda lib

Alternative solutions

No response

Acknowledgment

@leandrodamascena
Copy link
Contributor

Thanks for opening this issue to add support to Datadog @roger-zhangg!

Before merging the related PR, we will work to fix this issue in the coming days - #2916

@leandrodamascena leandrodamascena moved this from Triage to Pending review in Powertools for AWS Lambda (Python) Aug 2, 2023
@leandrodamascena leandrodamascena removed the triage Pending triage from maintainers label Aug 2, 2023
@leandrodamascena leandrodamascena self-assigned this Aug 2, 2023
@leandrodamascena
Copy link
Contributor

Closed as completed.

@github-project-automation github-project-automation bot moved this from Pending review to Coming soon in Powertools for AWS Lambda (Python) Aug 14, 2023
@leandrodamascena leandrodamascena linked a pull request Aug 14, 2023 that will close this issue
7 tasks
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

2 participants