Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7c127a3
add logic to extract traceID from _datadog header
avedmala Oct 29, 2024
8658dea
rename test
avedmala Oct 29, 2024
3eccb20
fix type
avedmala Oct 29, 2024
97b189a
added root arn case
avedmala Oct 30, 2024
eaa09f3
trigger ci
avedmala Oct 30, 2024
2baec69
Add `http.route` tags for API Gateway (#524)
nhulston Oct 29, 2024
3c4014b
feat: [SVLS-5677] DynamoDB Stream event span pointers (#522)
apiarian-datadog Oct 30, 2024
6f54a00
trigger ci
avedmala Oct 30, 2024
4e0afdb
Merge remote-tracking branch 'origin/main' into avedmala/sfn-span-link
avedmala Oct 31, 2024
25780a8
use default propagator.extract
avedmala Nov 4, 2024
85a157f
lint
avedmala Nov 4, 2024
aad3cd8
lint
avedmala Nov 4, 2024
c3681de
updated to use trace/parent hash from _datadog
avedmala Nov 6, 2024
7d1d475
lint
avedmala Nov 6, 2024
e9a7d46
skip is context complete check
avedmala Nov 6, 2024
a6464b4
remove unused import
avedmala Nov 6, 2024
068c2fc
fix legacy lambda parsing with new header
avedmala Nov 11, 2024
00850d8
using context object instead of pre-hashed values
avedmala Nov 12, 2024
c23911d
Merge branch 'main' into avedmala/sfn-span-link-no-hash
avedmala Nov 12, 2024
832ae1b
fixed trigger tags and tests
avedmala Nov 12, 2024
e2e732b
pull sfn trace id generation out into a helper
avedmala Nov 13, 2024
3bfc1e7
added unit tests
avedmala Nov 13, 2024
6abb3f3
update test data
avedmala Nov 13, 2024
cae62b1
rename stepfunctions to states
avedmala Nov 13, 2024
49dbaf2
update current serverless version to v1
avedmala Nov 14, 2024
c47fc62
Update trigger comment
avedmala Nov 14, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed trigger tags and tests
  • Loading branch information
avedmala committed Nov 12, 2024
commit 832ae1bf0babd753cfe129fa7bff1192f2e44cf9
7 changes: 4 additions & 3 deletions datadog_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ def extract_context_from_step_functions(event, lambda_context):

if dd_data and dd_data.get("serverless-version") == "v2":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between v1 and v2? Should we start from version v2 or v1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no v1, I think we can start from v1 instead if we want

I think @kimi-p suggested v2, maybe because the "legacy" context is implied to be v1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, "V2" may be somewhat confusing to customers because there is no explicit reference to "V1" at all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm!

if "x-datadog-trace-id" in dd_data: # lambda root
trace_id = dd_data.get("x-datadog-trace-id")
high_64_bit_trace_id = _parse_high_64_bits(dd_data.get("x-datadog-tags"))
trace_id = int(dd_data.get("x-datadog-trace-id"))
high_64_bit_trace_id = _parse_high_64_bits(
dd_data.get("x-datadog-tags")
)
if high_64_bit_trace_id:
meta["_dd.p.tid"] = high_64_bit_trace_id
else: # sfn root
Expand Down Expand Up @@ -709,7 +711,6 @@ def create_inferred_span(
event_source: _EventSource = None,
decode_authorizer_context: bool = True,
):
logger.debug("abhinav event %s", event)
if event_source is None:
event_source = parse_event_source(event)
try:
Expand Down
8 changes: 8 additions & 0 deletions datadog_lambda/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ def parse_event_source_arn(source: _EventSource, event: dict, context: Any) -> s
if source.event_type == EventTypes.CLOUDWATCH_EVENTS and event.get("resources"):
return event.get("resources")[0]

# todo: testme
# e.g. arn:aws:states:us-east-1:123456789012:stateMachine:stateMachineName
if source.event_type == EventTypes.STEPFUNCTIONS:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will parse the ARN so we we get trigger tags like this
Screenshot 2024-11-13 at 1 11 23 PM

context = event
if "_datadog" in event:
context = event.get("_datadog")
return context.get("StateMachine").get("Id")


def get_event_source_arn(source: _EventSource, event: dict, context: Any) -> str:
event_source_arn = event.get("eventSourceARN") or event.get("eventSourceArn")
Expand Down
Loading