Skip to content

Commit

Permalink
fix: handle exceptions in _sendEarlySpans and check span attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
povilasv committed Jan 2, 2025
1 parent ecd46b8 commit 7abcc63
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -658,17 +658,19 @@ def _instrumented_lambda_handler_call( # noqa pylint: disable=too-many-branches
kind=span_kind,
)
invocationSpan.set_attribute("cx.internal.span.role", "invocation")

_sendEarlySpans(
flush_timeout,
tracer,
tracer_provider,
meter_provider,
trigger_parent_context=upstream_context,
trigger_span=triggerSpan,
invocation_parent_context=invocation_parent_context,
invocation_span=invocationSpan,
)
try:
_sendEarlySpans(
flush_timeout,
tracer,
tracer_provider,
meter_provider,
trigger_parent_context=upstream_context,
trigger_span=triggerSpan,
invocation_parent_context=invocation_parent_context,
invocation_span=invocationSpan,
)
except Exception as ex:
pass

with use_span(
span=invocationSpan,
Expand Down Expand Up @@ -870,15 +872,15 @@ def _sendEarlySpans(
invocation_parent_context: Context,
invocation_span: Span,
) -> None:
if trigger_span is not None:
if trigger_span is not None and hasattr(trigger_span, 'name'):
early_trigger = _createEarlySpan(
tracer,
parent_context=trigger_parent_context,
span=trigger_span
)
early_trigger.end()

if invocation_span is not None:
if invocation_span is not None and hasattr(invocation_span, 'name'):
early_invocation = _createEarlySpan(
tracer,
parent_context=invocation_parent_context,
Expand Down

0 comments on commit 7abcc63

Please sign in to comment.