Skip to content

Commit e29d611

Browse files
vanroguclaude
andauthored
Remove unused Correlation and Transaction from Tracing (#26)
The correlation and transaction fields were written to event tags (x-correlation, x-transaction) but never read back or consumed by any code. Tracing.readFrom() was never called, and neither .correlation() nor .transaction() were accessed on any Tracing instance. Remove both record types and their associated tag constants, builder methods, and constructor parameters. https://claude.ai/code/session_011LFvcrknJvPNu6Q3umNe8f Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8b666a3 commit e29d611

File tree

3 files changed

+14
-98
lines changed

3 files changed

+14
-98
lines changed

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/events/Correlation.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/events/Tracing.java

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
import org.sliceworkz.eventstore.events.Tag;
2727
import org.sliceworkz.eventstore.events.Tags;
2828

29-
public record Tracing ( Instance instance, Correlation correlation, Transaction transaction, String actor, String channel ) {
29+
public record Tracing ( Instance instance, String actor, String channel ) {
3030

3131
public static final String UNKNOWN_ACTOR = null;
3232
public static final String UNKNOWN_CHANNEL = null;
33-
33+
3434
public static final String AUTOMATION_ACTOR = "automation";
3535
public static final String AUTOMATION_CHANNEL = "automation";
3636

@@ -41,51 +41,35 @@ public record Tracing ( Instance instance, Correlation correlation, Transaction
4141
private static final String TAG_INSTANCE_LOGICAL = "x-instance-logical";
4242
private static final String TAG_INSTANCE_PHYSICAL = "x-instance-physical";
4343
private static final String TAG_INSTANCE_PROCESS = "x-instance-process";
44-
private static final String TAG_CORRELATION = "x-correlation";
45-
private static final String TAG_TRANSACTION = "x-transaction";
4644
private static final String TAG_CHANNEL = "x-channel";
4745
private static final String TAG_ACTOR = "x-actor";
4846

49-
private static ThreadLocal<Tracing> tracingPerThread = new ThreadLocal<Tracing>();
50-
51-
public Tracing correlation ( Correlation correlation ) {
52-
return new Tracing ( instance, correlation, transaction, actor, channel );
53-
}
54-
55-
public Tracing transaction ( Transaction transaction ) {
56-
return new Tracing ( instance, correlation, transaction, actor, channel );
57-
}
58-
5947
public Tracing actor ( String actor ) {
60-
return new Tracing ( instance, correlation, transaction, actor, channel );
48+
return new Tracing ( instance, actor, channel );
6149
}
62-
50+
6351
public Tracing channel ( String channel ) {
64-
return new Tracing ( instance, correlation, transaction, actor, channel );
65-
}
66-
67-
public Tracing newTransaction ( ) {
68-
return transaction(Transaction.create());
52+
return new Tracing ( instance, actor, channel );
6953
}
70-
54+
7155
public static final Tracing init ( Instance instance ) {
72-
return new Tracing(instance, Correlation.create(), Transaction.create(), UNKNOWN_ACTOR, UNKNOWN_CHANNEL);
56+
return new Tracing(instance, UNKNOWN_ACTOR, UNKNOWN_CHANNEL);
7357
}
74-
58+
7559
public Tracing instance ( Instance instance ) {
76-
return new Tracing(instance, correlation, transaction, actor, channel);
60+
return new Tracing(instance, actor, channel);
7761
}
7862

7963
public static final Tracing actorAndChannel ( String actor, String channel ) {
80-
return new Tracing ( null, null, null, actor, channel);
64+
return new Tracing ( null, actor, channel);
8165
}
8266

8367
public static final Tracing automation ( Instance instance ) {
84-
return new Tracing(instance, Correlation.create(), Transaction.create(), AUTOMATION_ACTOR, AUTOMATION_CHANNEL);
68+
return new Tracing(instance, AUTOMATION_ACTOR, AUTOMATION_CHANNEL);
8569
}
8670

8771
public static final Tracing kernel ( Instance instance ) {
88-
return new Tracing(instance, Correlation.create(), Transaction.create(), KERNEL_ACTOR, KERNEL_CHANNEL);
72+
return new Tracing(instance, KERNEL_ACTOR, KERNEL_CHANNEL);
8973
}
9074

9175
public static final <T> Event<T> removeFrom ( Event<T> event ) {
@@ -100,12 +84,10 @@ public static final Tracing readFrom ( Event<?> event ) {
10084
tagValue(event, TAG_INSTANCE_PHYSICAL).orElse(null),
10185
tagValue(event, TAG_INSTANCE_PROCESS).orElse(null)
10286
);
103-
Transaction transaction = tagValue(event, TAG_TRANSACTION).map(Transaction::of).orElse(null);
104-
Correlation correlation = tagValue(event, TAG_CORRELATION).map(Correlation::of).orElse(null);
10587
String actor = tagValue(event, TAG_ACTOR).orElse(null);
10688
String channel = tagValue(event, TAG_CHANNEL).orElse(null);
107-
108-
return new Tracing(instance, correlation, transaction, actor, channel);
89+
90+
return new Tracing(instance, actor, channel);
10991
}
11092

11193
private static final Optional<String> tagValue ( Event<?> event, String tagName ) {
@@ -126,8 +108,6 @@ public final <T> EphemeralEvent<T> storeOn ( EphemeralEvent<? extends T> event )
126108
addTag(tags, TAG_INSTANCE_PHYSICAL, instance.physical());
127109
addTag(tags, TAG_INSTANCE_PROCESS, instance.process());
128110
}
129-
addTag(tags, TAG_CORRELATION, correlation == null ? null: correlation.id());
130-
addTag(tags, TAG_TRANSACTION, transaction == null ? null: transaction.id());
131111
addTag(tags, TAG_CHANNEL, channel);
132112
addTag(tags, TAG_ACTOR, actor);
133113

sliceworkz-eventmodeling-api/src/main/java/org/sliceworkz/eventmodeling/events/Transaction.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)