Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ public void onUserFunctionStart(UserFunctionStartInfo info) {
if (info.name() != null) {
spanBuilder.setAttribute(DURABLE_OPERATION_NAME, info.name());
}
if (info.subType() != null) {
spanBuilder.setAttribute(DURABLE_OPERATION_SUBTYPE, info.subType());
}
if (info.attempt() != null) {
spanBuilder.setAttribute(DURABLE_ATTEMPT_NUMBER, info.attempt().longValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,25 @@ void attemptSpan_childOfOperation_linkedToInvocation() {
"Attempt span must carry a link to the invocation span");
}

@Test
void attemptSpan_carriesOperationSubtype() {
plugin.onInvocationStart(new InvocationInfo("req-1", ARN, true, Instant.now()));
plugin.onUserFunctionStart(
new UserFunctionStartInfo("op-1", "process-order", "STEP", "Step", null, Instant.now(), false, 1));
plugin.onUserFunctionEnd(new UserFunctionEndInfo(
"op-1", "process-order", "STEP", "Step", null, Instant.now(), Instant.now(), false, 1, true, null));
plugin.onInvocationEnd(new InvocationEndInfo("req-1", ARN, true, InvocationStatus.SUCCEEDED, null));

var attemptSpan = spanExporter.getFinishedSpanItems().stream()
.filter(s -> s.getName().contains("process-order"))
.findFirst()
.orElseThrow();
assertEquals(
"Step",
attemptSpan.getAttributes().get(AttributeKey.stringKey("durable.operation.subtype")),
"Attempt span should carry durable.operation.subtype from the operation");
}

@Test
void childOperation_parentedToParentOperationSpan() {
plugin.onInvocationStart(new InvocationInfo("req-1", ARN, true, Instant.now()));
Expand Down