Skip to content

Commit c1c71d1

Browse files
committed
chore: move trace builders to the correct location
1 parent 92df461 commit c1c71d1

File tree

3 files changed

+41
-36
lines changed

3 files changed

+41
-36
lines changed

tests/e2e/utils/data_builder/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
build_metric_name,
66
build_metric_query_data,
77
build_multiple_add_metric_input,
8+
)
9+
from tests.e2e.utils.data_builder.traces import (
810
build_put_annotations_input,
911
build_put_metadata_input,
12+
build_trace_default_query,
1013
)
11-
from tests.e2e.utils.data_builder.traces import build_trace_default_query

tests/e2e/utils/data_builder/metrics.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional
1+
from typing import Dict, List, Optional
22

33
from mypy_boto3_cloudwatch.type_defs import DimensionTypeDef, MetricDataQueryTypeDef
44

@@ -112,39 +112,5 @@ def build_add_dimensions_input(**dimensions) -> List[DimensionTypeDef]:
112112
return [{"Name": name, "Value": value} for name, value in dimensions.items()]
113113

114114

115-
def build_put_annotations_input(**annotations: str) -> List[Dict]:
116-
"""Create trace annotations input to be used with Tracer.put_annotation()
117-
118-
Parameters
119-
----------
120-
annotations : str
121-
annotations in key=value form
122-
123-
Returns
124-
-------
125-
List[Dict]
126-
List of put annotations input
127-
"""
128-
return [{"key": key, "value": value} for key, value in annotations.items()]
129-
130-
131-
def build_put_metadata_input(namespace: Optional[str] = None, **metadata: Any) -> List[Dict]:
132-
"""Create trace metadata input to be used with Tracer.put_metadata()
133-
134-
All metadata will be under `test` namespace
135-
136-
Parameters
137-
----------
138-
metadata : Any
139-
metadata in key=value form
140-
141-
Returns
142-
-------
143-
List[Dict]
144-
List of put metadata input
145-
"""
146-
return [{"key": key, "value": value, "namespace": namespace} for key, value in metadata.items()]
147-
148-
149115
def build_metric_name() -> str:
150116
return f"test_metric{build_random_value()}"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1+
from typing import Any, Dict, List, Optional
2+
3+
14
def build_trace_default_query(function_name: str) -> str:
25
return f'service("{function_name}")'
6+
7+
8+
def build_put_annotations_input(**annotations: str) -> List[Dict]:
9+
"""Create trace annotations input to be used with Tracer.put_annotation()
10+
11+
Parameters
12+
----------
13+
annotations : str
14+
annotations in key=value form
15+
16+
Returns
17+
-------
18+
List[Dict]
19+
List of put annotations input
20+
"""
21+
return [{"key": key, "value": value} for key, value in annotations.items()]
22+
23+
24+
def build_put_metadata_input(namespace: Optional[str] = None, **metadata: Any) -> List[Dict]:
25+
"""Create trace metadata input to be used with Tracer.put_metadata()
26+
27+
All metadata will be under `test` namespace
28+
29+
Parameters
30+
----------
31+
metadata : Any
32+
metadata in key=value form
33+
34+
Returns
35+
-------
36+
List[Dict]
37+
List of put metadata input
38+
"""
39+
return [{"key": key, "value": value, "namespace": namespace} for key, value in metadata.items()]

0 commit comments

Comments
 (0)