Skip to content

Commit 34ea256

Browse files
committed
Replace builtin json with faster ujson package.
1 parent 3414cfb commit 34ea256

File tree

8 files changed

+8
-7
lines changed

8 files changed

+8
-7
lines changed

datadog_lambda/metric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# Copyright 2019 Datadog, Inc.
55

66
import os
7-
import json
87
import time
98
import logging
9+
import ujson as json
1010

1111
from datadog_lambda.extension import should_use_extension
1212
from datadog_lambda.tags import get_enhanced_metrics_tags, dd_lambda_layer_tag

datadog_lambda/patch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# This product includes software developed at Datadog (https://www.datadoghq.com/).
44
# Copyright 2019 Datadog, Inc.
55

6-
import json
76
import os
87
import sys
98
import logging
109
import zlib
10+
import ujson as json
1111

1212
from wrapt import wrap_function_wrapper as wrap
1313
from wrapt.importer import when_imported

datadog_lambda/tag_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Copyright 2021 Datadog, Inc.
55

66
from decimal import Decimal
7-
import json
87
import logging
8+
import ujson as json
99

1010
redactable_keys = ["authorization", "x-authorization", "password", "token"]
1111
max_depth = 10

datadog_lambda/tracing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import hashlib
66
import logging
77
import os
8-
import json
98
import base64
9+
import ujson as json
1010
from datetime import datetime, timezone
1111
from typing import Optional, Dict
1212

datadog_lambda/trigger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import base64
77
import gzip
8-
import json
8+
import ujson as json
99
from io import BytesIO, BufferedReader
1010
from enum import Enum
1111
from typing import Any

datadog_lambda/wrapper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import os
77
import logging
88
import traceback
9+
import ujson as json
910
from importlib import import_module
10-
import json
1111
from time import time_ns
1212

1313
from datadog_lambda.extension import should_use_extension, flush_extension

datadog_lambda/xray.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22
import logging
3-
import json
43
import binascii
54
import time
65
import socket
6+
import ujson as json
77

88
from datadog_lambda.constants import XrayDaemon, XraySubsegment, TraceContextSource
99

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ python = ">=3.8.0,<4"
2828
datadog = ">=0.41.0,<1.0.0"
2929
wrapt = "^1.11.2"
3030
ddtrace = ">=2.7.2"
31+
ujson = ">=5.9.0"
3132
urllib3 = [
3233
{version = "<2.0.0", python = "<3.11", optional = true},
3334
{version = "<2.1.0", python = ">=3.11", optional = true},

0 commit comments

Comments
 (0)