Visitar URL original
Inject trace context into AWS Step Functions input by DylanLovesCoffee · Pull Request #7585 · DataDog/dd-trace-java · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7f8721d
inject step functions trace context
DylanLovesCoffee Sep 5, 2024
a974597
Merge branch 'master' into dylan/sfn-trace-ctx
DylanLovesCoffee Sep 9, 2024
7ecfa8c
remove previous logic
DylanLovesCoffee Sep 13, 2024
fa36832
aws sfn instrumentation
DylanLovesCoffee Sep 16, 2024
22c652b
Merge branch 'master' into dylan/sfn-trace-ctx
DylanLovesCoffee Sep 16, 2024
eb642b0
muzzle
DylanLovesCoffee Sep 16, 2024
0778f3d
single char
DylanLovesCoffee Sep 17, 2024
f9d0eea
Merge branch 'master' into dylan/sfn-trace-ctx
DylanLovesCoffee Oct 8, 2024
421856b
update muzzle
DylanLovesCoffee Oct 8, 2024
895341a
refactor input attr injector
DylanLovesCoffee Oct 8, 2024
9d76dec
refactor interceptor
DylanLovesCoffee Oct 9, 2024
aba1119
cleanup test
DylanLovesCoffee Oct 9, 2024
e56f2d3
Merge branch 'master' into dylan/sfn-trace-ctx
DylanLovesCoffee Oct 23, 2024
3039780
Merge branch 'master' into dylan/sfn-trace-ctx
DylanLovesCoffee Oct 23, 2024
370df6d
use JsonBuffer
DylanLovesCoffee Oct 24, 2024
a644a8b
catch exceptions
DylanLovesCoffee Oct 24, 2024
fc6e570
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Dec 3, 2024
ee83940
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 6, 2025
973cd79
add build.gradle comment
nhulston Feb 6, 2025
96f7f39
fix SfnClientInstrumentation class header
nhulston Feb 6, 2025
fdb01a2
update InputAttributeInjector to use `datadog.json` component https:/…
nhulston Feb 6, 2025
8417f6e
fix injection
nhulston Feb 6, 2025
0aac239
test edge cases
nhulston Feb 6, 2025
2992508
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 7, 2025
da7af0b
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 10, 2025
ca13195
improve `getModifiedInput`
nhulston Feb 11, 2025
2d4507d
test that tracer does not error on invalid json input
nhulston Feb 11, 2025
29a651c
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 11, 2025
a434846
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 12, 2025
1197c1d
don't throw, just return request
nhulston Feb 12, 2025
0f304c7
Merge branch 'master' into dylan/sfn-trace-ctx
nhulston Feb 18, 2025
File filter

Filter by extension

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
use JsonBuffer
  • Loading branch information
DylanLovesCoffee committed Oct 24, 2024
commit 370df6d8c800d31241ea104465d0015c5f71e59b
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
package datadog.trace.instrumentation.aws.v2.sfn;

import datadog.trace.bootstrap.JsonBuffer;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;

public class InputAttributeInjector {
public static String buildTraceContext(AgentSpan span) {
// Extract span tags
StringBuilder spanTagsJSON = new StringBuilder();
spanTagsJSON.append('{');
JsonBuffer spanTagsJSON = new JsonBuffer();
spanTagsJSON.beginObject();
span.getTags()
.forEach(
(tagKey, tagValue) ->
spanTagsJSON
.append('"')
.append(tagKey)
.append("\":\"")
.append(tagValue)
.append("\","));
spanTagsJSON.setLength(spanTagsJSON.length() - 1); // remove trailing comma
spanTagsJSON.append('}');
.forEach((tagKey, tagValue) -> spanTagsJSON.name(tagKey).value(tagValue.toString()));
spanTagsJSON.endObject();
Comment thread
nhulston marked this conversation as resolved.
Resolved

// Build DD trace context object
String ddTraceContextJSON =
String.format(
"\"_datadog\": { \"x-datadog-trace-id\": \"%s\",\"x-datadog-parent-id\":\"%s\", \"x-datadog-tags\": %s }",
span.getTraceId().toString(), span.getSpanId(), spanTagsJSON);
JsonBuffer ddTraceContextJSON = new JsonBuffer();
ddTraceContextJSON
.beginObject()
.name("_datadog")
.beginObject()
.name("x-datadog-trace-id")
.value(span.getTraceId().toString())
.name("x-datadog-parent-id")
.value(String.valueOf(span.getSpanId()))
.name("x-datadog-tags")
.value(spanTagsJSON)
.endObject()
.endObject();

return ddTraceContextJSON;
return ddTraceContextJSON.toString();
}

public static String getModifiedInput(String request, String ddTraceContextJSON) {
Expand Down