Skip to content

Commit 945263a

Browse files
authored
Remove tracing (#60)
* Remove span collector * Fix * Fix formatting
1 parent ec68a5d commit 945263a

16 files changed

Lines changed: 15 additions & 552 deletions

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,13 @@ apitally:
9191
client-id: "your-client-id"
9292
env: "dev" # or "prod" etc.
9393

94-
# Optional: configure request logging and tracing
94+
# Optional: configure request logging
9595
request-logging:
9696
enabled: true
9797
request-headers-included: true
9898
request-body-included: true
9999
response-body-included: true
100100
log-capture-enabled: true
101-
tracing-enabled: true
102101
```
103102
104103
For further instructions, see our

pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454
<artifactId>oshi-core</artifactId>
5555
<version>6.9.3</version>
5656
</dependency>
57-
<dependency>
58-
<groupId>io.opentelemetry</groupId>
59-
<artifactId>opentelemetry-sdk</artifactId>
60-
<version>1.58.0</version>
61-
</dependency>
6257
<dependency>
6358
<groupId>com.github.spotbugs</groupId>
6459
<artifactId>spotbugs-annotations</artifactId>

src/main/java/io/apitally/common/ApitallyClient.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public enum HubRequestStatus {
6767

6868
public final RequestCounter requestCounter;
6969
public final RequestLogger requestLogger;
70-
public final SpanCollector spanCollector;
7170
public final ValidationErrorCounter validationErrorCounter;
7271
public final ServerErrorCounter serverErrorCounter;
7372
public final ConsumerRegistry consumerRegistry;
@@ -84,8 +83,6 @@ public ApitallyClient(String clientId, String env, RequestLoggingConfig requestL
8483

8584
this.requestCounter = new RequestCounter();
8685
this.requestLogger = new RequestLogger(requestLoggingConfig);
87-
this.spanCollector =
88-
new SpanCollector(requestLoggingConfig.isEnabled() && requestLoggingConfig.isTracingEnabled());
8986
this.validationErrorCounter = new ValidationErrorCounter();
9087
this.serverErrorCounter = new ServerErrorCounter();
9188
this.consumerRegistry = new ConsumerRegistry();

src/main/java/io/apitally/common/RequestLogger.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import io.apitally.common.dto.Request;
1010
import io.apitally.common.dto.RequestLogItem;
1111
import io.apitally.common.dto.Response;
12-
import io.apitally.common.dto.SpanData;
1312
import java.io.IOException;
1413
import java.net.MalformedURLException;
1514
import java.net.URL;
@@ -127,13 +126,7 @@ public void setSuspendUntil(long timestamp) {
127126
this.suspendUntil = timestamp;
128127
}
129128

130-
public void logRequest(
131-
Request request,
132-
Response response,
133-
Exception exception,
134-
List<LogRecord> logs,
135-
List<SpanData> spans,
136-
String traceId) {
129+
public void logRequest(Request request, Response response, Exception exception, List<LogRecord> logs) {
137130
if (!enabled || suspendUntil != null && suspendUntil > System.currentTimeMillis()) {
138131
return;
139132
}
@@ -171,12 +164,7 @@ public void logRequest(
171164
logs = null;
172165
}
173166

174-
if (!config.isTracingEnabled()) {
175-
spans = null;
176-
traceId = null;
177-
}
178-
179-
RequestLogItem item = new RequestLogItem(request, response, exceptionDto, logs, spans, traceId);
167+
RequestLogItem item = new RequestLogItem(request, response, exceptionDto, logs);
180168
pendingWrites.add(item);
181169

182170
if (pendingWrites.size() > MAX_PENDING_WRITES) {
@@ -284,12 +272,6 @@ public void writeToFile() throws IOException {
284272
if (item.getLogs() != null && !item.getLogs().isEmpty()) {
285273
itemNode.set("logs", objectMapper.valueToTree(item.getLogs()));
286274
}
287-
if (item.getSpans() != null && !item.getSpans().isEmpty()) {
288-
itemNode.set("spans", objectMapper.valueToTree(item.getSpans()));
289-
}
290-
if (item.getTraceId() != null && !item.getTraceId().isEmpty()) {
291-
itemNode.put("trace_id", item.getTraceId());
292-
}
293275

294276
String serializedItem = objectMapper.writeValueAsString(itemNode);
295277
currentFile.writeLine(serializedItem.getBytes(StandardCharsets.UTF_8));

src/main/java/io/apitally/common/RequestLoggingConfig.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class RequestLoggingConfig {
1212
private boolean responseBodyIncluded = false;
1313
private boolean exceptionIncluded = true;
1414
private boolean logCaptureEnabled = false;
15-
private boolean tracingEnabled = false;
1615
private List<String> queryParamMaskPatterns = new ArrayList<>();
1716
private List<String> headerMaskPatterns = new ArrayList<>();
1817
private List<String> bodyFieldMaskPatterns = new ArrayList<>();
@@ -83,14 +82,6 @@ public void setLogCaptureEnabled(boolean logCaptureEnabled) {
8382
this.logCaptureEnabled = logCaptureEnabled;
8483
}
8584

86-
public boolean isTracingEnabled() {
87-
return tracingEnabled;
88-
}
89-
90-
public void setTracingEnabled(boolean tracingEnabled) {
91-
this.tracingEnabled = tracingEnabled;
92-
}
93-
9485
public List<String> getQueryParamMaskPatterns() {
9586
return queryParamMaskPatterns;
9687
}

src/main/java/io/apitally/common/SpanCollector.java

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

src/main/java/io/apitally/common/dto/RequestLogItem.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,13 @@ public class RequestLogItem extends BaseDto {
1010
private final Response response;
1111
private final ExceptionDto exception;
1212
private final List<LogRecord> logs;
13-
private final List<SpanData> spans;
14-
private final String traceId;
1513

16-
public RequestLogItem(
17-
Request request,
18-
Response response,
19-
ExceptionDto exception,
20-
List<LogRecord> logs,
21-
List<SpanData> spans,
22-
String traceId) {
14+
public RequestLogItem(Request request, Response response, ExceptionDto exception, List<LogRecord> logs) {
2315
this.uuid = UUID.randomUUID().toString();
2416
this.request = request;
2517
this.response = response;
2618
this.exception = exception;
2719
this.logs = logs;
28-
this.spans = spans;
29-
this.traceId = traceId;
3020
}
3121

3222
@JsonProperty("uuid")
@@ -53,14 +43,4 @@ public ExceptionDto getException() {
5343
public List<LogRecord> getLogs() {
5444
return logs;
5545
}
56-
57-
@JsonProperty("spans")
58-
public List<SpanData> getSpans() {
59-
return spans;
60-
}
61-
62-
@JsonProperty("trace_id")
63-
public String getTraceId() {
64-
return traceId;
65-
}
6646
}

src/main/java/io/apitally/spring/ApitallyAutoConfiguration.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ public ApitallyClient apitallyClient(
2929
&& properties.getRequestLogging().isLogCaptureEnabled()) {
3030
LogAppender.register();
3131
}
32-
if (properties.getRequestLogging().isEnabled()
33-
&& properties.getRequestLogging().isTracingEnabled()) {
34-
ApitallySpanCollector.getInstance().setDelegate(client.spanCollector);
35-
}
3632

3733
return client;
3834
}

0 commit comments

Comments
 (0)