Skip to content

Commit 82efe3f

Browse files
eyalkorenfelixbarny
authored andcommitted
Fix transaction id copy (#288)
1 parent 279d8b4 commit 82efe3f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

apm-agent-core/src/main/java/co/elastic/apm/impl/transaction/TraceContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ public void copyFrom(TraceContext other) {
344344
traceId.copyFrom(other.traceId);
345345
id.copyFrom(other.id);
346346
parentId.copyFrom(other.parentId);
347+
transactionId.copyFrom(other.transactionId);
347348
outgoingHeader.append(other.outgoingHeader);
348349
flags = other.flags;
349350
clock.init(other.clock);

apm-agent-core/src/main/resources/schema/transactions/span.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
"description": "ID for the parent (transaction or span), hex encoded 64 random bits",
1919
"pattern": "^[a-fA-F0-9]{16}$"
2020
},
21+
"transaction_id": {
22+
"type": "string",
23+
"description": "ID for the transaction this span belongs to, hex encoded 64 random bits",
24+
"pattern": "^[a-fA-F0-9]{16}$"
25+
},
2126
"timestamp": {
2227
"type": ["string", "integer"],
2328
"description": "Recorded time of the span, UTC based and formatted as YYYY-MM-DDTHH:mm:ss.sssZ"
@@ -87,5 +92,5 @@
8792
"required": ["id"]
8893
}
8994
},
90-
"required": ["duration", "name", "type", "timestamp"]
95+
"required": ["duration", "name", "type", "timestamp", "transaction_id"]
9196
}

apm-opentracing/src/test/java/co/elastic/apm/opentracing/OpenTracingBridgeTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ void testCreateNonActiveTransactionAsChildOf() {
148148
transaction.finish();
149149
assertThat(reporter.getTransactions()).hasSize(1);
150150
assertThat(reporter.getSpans()).hasSize(1);
151+
assertThat(reporter.getFirstSpan().getTraceContext().getTransactionId().isEmpty()).isFalse();
151152
}
152153

153154
@Test

0 commit comments

Comments
 (0)