Skip to content

Commit fb650da

Browse files
fix: missing safe execute blocks can cause customer code crash (#811)
* fix: missing safe execute blocks can cause customer code crash * fix: pin pip3 version required by fastapi old versions * ci: fix old circle ci flow fails when building lambda java tracer
1 parent b6807be commit fb650da

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

.circleci/config.yml

+14-20
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,44 @@ workflows:
3333
- lumigo-orb/be-deploy:
3434
context: common
3535
skip_on_auto_test_update: true
36+
save_project_folder: false
3637
requires:
3738
- lumigo-orb/is_environment_available
3839

39-
- lumigo-orb/pre_build_artifacts:
40+
- lumigo-orb/prep-it-resources:
4041
context: common
41-
skip_on_auto_test_update: true
4242
requires:
4343
- lumigo-orb/is_environment_available
4444

45-
- lumigo-orb/integration-test-prep:
45+
- lumigo-orb/prep-k8s-and-operator:
4646
context: common
47-
pre_builds_available: true
48-
run_test_cleanup: false
49-
skip_on_auto_test_update: true
5047
requires:
51-
- lumigo-orb/be-deploy
52-
- lumigo-orb/pre_build_artifacts
48+
- lumigo-orb/is_environment_available
5349

54-
- lumigo-orb/integration-test-cleanup:
55-
name: pre-test-cleanup
50+
- lumigo-orb/integration-test-parallel:
5651
context: common
52+
run_test_cleanup: false
5753
skip_on_auto_test_update: true
5854
requires:
59-
- lumigo-orb/integration-test-prep
55+
- lumigo-orb/be-deploy
56+
- lumigo-orb/prep-it-resources
57+
- lumigo-orb/prep-k8s-and-operator
6058

61-
- lumigo-orb/integration-test-parallel:
59+
- lumigo-orb/e2e-test:
6260
context: common
63-
run_test_cleanup: false
6461
skip_on_auto_test_update: true
6562
requires:
66-
- pre-test-cleanup
63+
- lumigo-orb/be-deploy
64+
- lumigo-orb/prep-it-resources
65+
- lumigo-orb/prep-k8s-and-operator
6766

6867
- lumigo-orb/integration-test-cleanup:
6968
name: post-test-cleanup
7069
context: common
7170
skip_on_auto_test_update: true
7271
requires:
7372
- lumigo-orb/integration-test-parallel
74-
75-
- lumigo-orb/e2e-test:
76-
context: common
77-
skip_on_auto_test_update: true
78-
requires:
79-
- pre-test-cleanup
73+
- lumigo-orb/e2e-test
8074

8175
- lumigo-orb/workflow-completed-successfully:
8276
context: common

noxfile.py

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def integration_tests_fastapi(
347347
fastapi_version,
348348
uvicorn_version,
349349
):
350+
install_package("pip", "24.0", session)
350351
install_package("uvicorn", uvicorn_version, session)
351352
install_package("fastapi", fastapi_version, session)
352353

src/lumigo_opentelemetry/instrumentations/kafka_python/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def _produce_hook(span: Span, args: List[Any], kwargs: Dict[Any, Any]) -> None:
3030
def _consume_hook(
3131
span: Span, record: ABCRecord, args: List[Any], kwargs: Dict[Any, Any]
3232
) -> None:
33-
add_body_attribute(span, record.value, "messaging.consume.body")
33+
with lumigo_safe_execute("kafka _consume_hook"):
34+
add_body_attribute(span, record.value, "messaging.consume.body")
3435

3536
KafkaInstrumentor().instrument(
3637
produce_hook=_produce_hook, consume_hook=_consume_hook

src/lumigo_opentelemetry/instrumentations/pika/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from lumigo_opentelemetry.instrumentations.instrumentation_utils import (
44
add_body_attribute,
55
)
6+
from lumigo_opentelemetry.libs.general_utils import lumigo_safe_execute
67

78

89
class PikaInstrumentor(AbstractInstrumentor):
@@ -17,10 +18,12 @@ def install_instrumentation(self) -> None:
1718
from pika.spec import BasicProperties
1819

1920
def publish_hook(span: Span, body: bytes, properties: BasicProperties) -> None:
20-
add_body_attribute(span, body, "messaging.publish.body")
21+
with lumigo_safe_execute("pika_publish_hook"):
22+
add_body_attribute(span, body, "messaging.publish.body")
2123

2224
def consume_hook(span: Span, body: bytes, properties: BasicProperties) -> None:
23-
add_body_attribute(span, body, "messaging.consume.body")
25+
with lumigo_safe_execute("pika_consume_hook"):
26+
add_body_attribute(span, body, "messaging.consume.body")
2427

2528
PikaInstrumentor().instrument(
2629
publish_hook=publish_hook,

src/lumigo_opentelemetry/instrumentations/redis/__init__.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from lumigo_opentelemetry.instrumentations.instrumentation_utils import (
77
add_body_attribute,
88
)
9+
from lumigo_opentelemetry.libs.general_utils import lumigo_safe_execute
910

1011

1112
class RedisInstrumentor(AbstractInstrumentor):
@@ -22,13 +23,15 @@ def install_instrumentation(self) -> None:
2223
def request_hook(
2324
span: Span, instance: Connection, args: List[Any], kwargs: Dict[Any, Any]
2425
) -> None:
25-
# a db.statement attribute is automatically added by the RedisInstrumentor
26-
# when this hook is called, but only includes the command name for some
27-
# versions so we need to set it ourselves.
28-
add_body_attribute(span, " ".join(args), "db.statement")
26+
with lumigo_safe_execute("redis_request_hook"):
27+
# a db.statement attribute is automatically added by the RedisInstrumentor
28+
# when this hook is called, but only includes the command name for some
29+
# versions so we need to set it ourselves.
30+
add_body_attribute(span, " ".join(args), "db.statement")
2931

3032
def response_hook(span: Span, instance: Connection, response: Any) -> None:
31-
add_body_attribute(span, response, "db.response.body")
33+
with lumigo_safe_execute("redis_response_hook"):
34+
add_body_attribute(span, response, "db.response.body")
3235

3336
RedisInstrumentor().instrument(
3437
request_hook=request_hook,

0 commit comments

Comments
 (0)