Skip to content

Commit 2c3b9ed

Browse files
migrate scrubbing logic to lumigo-core (#275)
* migrate scrubbing logic to core
1 parent a250f23 commit 2c3b9ed

18 files changed

+109
-545
lines changed

.secrets.baseline

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -109,66 +109,41 @@
109109
}
110110
],
111111
"results": {
112-
"src/lumigo_tracer/lumigo_utils.py": [
113-
{
114-
"type": "Secret Keyword",
115-
"filename": "src/lumigo_tracer/lumigo_utils.py",
116-
"hashed_secret": "116b0dcbb1dfb3f19c902ebfc29f35d908cec6a4",
117-
"is_verified": false,
118-
"line_number": 48
119-
},
120-
{
121-
"type": "Secret Keyword",
122-
"filename": "src/lumigo_tracer/lumigo_utils.py",
123-
"hashed_secret": "2a93870f6e6a2158cb9631b349e75d8f65fd81af",
124-
"is_verified": false,
125-
"line_number": 49
126-
}
127-
],
128112
"src/test/unit/event/test_event_dumper.py": [
129113
{
130114
"type": "Base64 High Entropy String",
131115
"filename": "src/test/unit/event/test_event_dumper.py",
132116
"hashed_secret": "885bb9903f72e004ff2974807b70e7c970d3e6d5",
133117
"is_verified": false,
134-
"line_number": 207
118+
"line_number": 208
135119
},
136120
{
137121
"type": "Base64 High Entropy String",
138122
"filename": "src/test/unit/event/test_event_dumper.py",
139123
"hashed_secret": "0c47032b03ad0916df339b9c21b194ad8b2ed7b1",
140124
"is_verified": false,
141-
"line_number": 209
125+
"line_number": 210
142126
},
143127
{
144128
"type": "Hex High Entropy String",
145129
"filename": "src/test/unit/event/test_event_dumper.py",
146130
"hashed_secret": "5e55d44082c01c474ac9d6101d9f88c0a66ae558",
147131
"is_verified": false,
148-
"line_number": 373
132+
"line_number": 374
149133
},
150134
{
151135
"type": "Hex High Entropy String",
152136
"filename": "src/test/unit/event/test_event_dumper.py",
153137
"hashed_secret": "0615ba62fbaec0ee83b8a181ff49afc60cb043f5",
154138
"is_verified": false,
155-
"line_number": 557
139+
"line_number": 558
156140
},
157141
{
158142
"type": "Hex High Entropy String",
159143
"filename": "src/test/unit/event/test_event_dumper.py",
160144
"hashed_secret": "5bbac409dd4ddefe2ffc72ce9fc42932d8a238c1",
161145
"is_verified": false,
162-
"line_number": 558
163-
}
164-
],
165-
"src/test/unit/test_lumigo_utils.py": [
166-
{
167-
"type": "Secret Keyword",
168-
"filename": "src/test/unit/test_lumigo_utils.py",
169-
"hashed_secret": "f32b67c7e26342af42efabc674d441dca0a281c5",
170-
"is_verified": false,
171-
"line_number": 199
146+
"line_number": 559
172147
}
173148
],
174149
"src/test/unit/test_tracer.py": [
@@ -200,9 +175,9 @@
200175
"filename": "src/test/unit/wrappers/http/test_http_parser.py",
201176
"hashed_secret": "cb9b8f5ecaf7f26b7c608b0ec05b46d73d220c78",
202177
"is_verified": false,
203-
"line_number": 152
178+
"line_number": 144
204179
}
205180
]
206181
},
207-
"generated_at": "2023-04-02T13:58:53Z"
182+
"generated_at": "2023-04-09T21:14:02Z"
208183
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
url="https://github.com/lumigo-io/python_tracer.git",
1515
package_dir={"": "src"},
1616
packages=setuptools.find_packages("src"),
17-
install_requires=["lumigo_core==0.0.5"],
17+
install_requires=["lumigo_core==0.0.6"],
1818
license="Apache License 2.0",
1919
classifiers=["Programming Language :: Python :: 3", "Operating System :: OS Independent"],
2020
long_description=open("README.md").read(),

src/lumigo_tracer/event/event_dumper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from collections import OrderedDict
55
from typing import Dict, List, Optional
66

7+
from lumigo_core.configuration import CoreConfiguration
78
from lumigo_core.logger import get_logger
89
from lumigo_core.parsing_utils import safe_get, str_to_list
910

1011
from lumigo_tracer.lumigo_utils import (
11-
Configuration,
1212
aws_dump,
1313
is_api_gw_event,
1414
lumigo_dumps,
@@ -251,7 +251,7 @@ class EventDumper:
251251
def dump_event(
252252
event: Dict, handlers: List[EventParseHandler] = None, has_error: bool = False # type: ignore[type-arg]
253253
) -> str:
254-
max_size = Configuration.get_max_entry_size(has_error)
254+
max_size = CoreConfiguration.get_max_entry_size(has_error)
255255
if should_use_tracer_extension():
256256
return aws_dump(event)
257257
handlers = handlers or [

src/lumigo_tracer/lambda_tracer/lambda_reporter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from pathlib import Path
1111
from typing import Any, Dict, List, Optional, Union
1212

13+
from lumigo_core.configuration import CoreConfiguration
14+
1315
from lumigo_tracer.lumigo_utils import (
1416
EDGE_HOST,
1517
Configuration,
@@ -111,7 +113,7 @@ def report_json(
111113
if not should_report_to_edge():
112114
get_logger().info("Skip sending messages due to previous timeout")
113115
return 0
114-
if not Configuration.should_report:
116+
if not CoreConfiguration.should_report:
115117
return 0
116118
get_logger().info(f"reporting the messages: {msgs[:10]}")
117119
try:

src/lumigo_tracer/lambda_tracer/spans_container.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
from datetime import datetime
88
from typing import Callable, Dict, List, Optional, Set, Union
99

10+
from lumigo_core.configuration import CoreConfiguration
1011
from lumigo_core.parsing_utils import (
1112
parse_trace_id,
1213
recursive_json_join,
1314
safe_split_get,
1415
)
16+
from lumigo_core.scrubbing import EXECUTION_TAGS_KEY, MANUAL_TRACES_KEY
1517
from lumigo_core.triggers.event_trigger import parse_triggers
1618

1719
from lumigo_tracer.event.event_dumper import EventDumper
1820
from lumigo_tracer.lambda_tracer import lambda_reporter
1921
from lumigo_tracer.lumigo_utils import (
20-
EXECUTION_TAGS_KEY,
2122
LUMIGO_EVENT_KEY,
22-
MANUAL_TRACES_KEY,
2323
STEP_FUNCTION_UID_KEY,
2424
Configuration,
2525
create_step_function_span,
@@ -423,5 +423,5 @@ def is_activated(): # type: ignore[no-untyped-def]
423423

424424
def _get_envs_for_span(has_error: bool = False) -> str:
425425
return lumigo_dumps_with_context(
426-
"environment", dict(os.environ), Configuration.get_max_entry_size(has_error)
426+
"environment", dict(os.environ), CoreConfiguration.get_max_entry_size(has_error)
427427
)

0 commit comments

Comments
 (0)