forked from DataDog/datadog-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp_error.py
More file actions
23 lines (17 loc) · 707 Bytes
/
http_error.py
File metadata and controls
23 lines (17 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import requests
from decorator import conditional_decorator
from datadog_lambda.metric import lambda_metric
from datadog_lambda.wrapper import datadog_lambda_wrapper
from ddtrace import tracer
from ddtrace.internal.writer import LogWriter
tracer.writer = LogWriter()
with_plugin = os.getenv("WITH_PLUGIN", False)
@conditional_decorator(datadog_lambda_wrapper, with_plugin)
def handle(event, context):
lambda_metric("hello.dog", 1, tags=["team:serverless", "role:hello"])
lambda_metric(
"tests.integration.count", 21, tags=["test:integration", "role:hello"]
)
requests.get("https://httpstat.us/400/")
return {"statusCode": 200, "body": {"message": "hello, dog!"}}