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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ apitally:
client-id: "your-client-id"
env: "dev" # or "prod" etc.

# Optional: configure request logging and tracing
# Optional: configure request logging
request-logging:
enabled: true
request-headers-included: true
request-body-included: true
response-body-included: true
log-capture-enabled: true
tracing-enabled: true
```

For further instructions, see our
Expand Down
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@
<artifactId>oshi-core</artifactId>
<version>6.9.3</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>1.58.0</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/io/apitally/common/ApitallyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public enum HubRequestStatus {

public final RequestCounter requestCounter;
public final RequestLogger requestLogger;
public final SpanCollector spanCollector;
public final ValidationErrorCounter validationErrorCounter;
public final ServerErrorCounter serverErrorCounter;
public final ConsumerRegistry consumerRegistry;
Expand All @@ -84,8 +83,6 @@ public ApitallyClient(String clientId, String env, RequestLoggingConfig requestL

this.requestCounter = new RequestCounter();
this.requestLogger = new RequestLogger(requestLoggingConfig);
this.spanCollector =
new SpanCollector(requestLoggingConfig.isEnabled() && requestLoggingConfig.isTracingEnabled());
this.validationErrorCounter = new ValidationErrorCounter();
this.serverErrorCounter = new ServerErrorCounter();
this.consumerRegistry = new ConsumerRegistry();
Expand Down
22 changes: 2 additions & 20 deletions src/main/java/io/apitally/common/RequestLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.apitally.common.dto.Request;
import io.apitally.common.dto.RequestLogItem;
import io.apitally.common.dto.Response;
import io.apitally.common.dto.SpanData;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -127,13 +126,7 @@ public void setSuspendUntil(long timestamp) {
this.suspendUntil = timestamp;
}

public void logRequest(
Request request,
Response response,
Exception exception,
List<LogRecord> logs,
List<SpanData> spans,
String traceId) {
public void logRequest(Request request, Response response, Exception exception, List<LogRecord> logs) {
if (!enabled || suspendUntil != null && suspendUntil > System.currentTimeMillis()) {
return;
}
Expand Down Expand Up @@ -171,12 +164,7 @@ public void logRequest(
logs = null;
}

if (!config.isTracingEnabled()) {
spans = null;
traceId = null;
}

RequestLogItem item = new RequestLogItem(request, response, exceptionDto, logs, spans, traceId);
RequestLogItem item = new RequestLogItem(request, response, exceptionDto, logs);
pendingWrites.add(item);

if (pendingWrites.size() > MAX_PENDING_WRITES) {
Expand Down Expand Up @@ -284,12 +272,6 @@ public void writeToFile() throws IOException {
if (item.getLogs() != null && !item.getLogs().isEmpty()) {
itemNode.set("logs", objectMapper.valueToTree(item.getLogs()));
}
if (item.getSpans() != null && !item.getSpans().isEmpty()) {
itemNode.set("spans", objectMapper.valueToTree(item.getSpans()));
}
if (item.getTraceId() != null && !item.getTraceId().isEmpty()) {
itemNode.put("trace_id", item.getTraceId());
}

String serializedItem = objectMapper.writeValueAsString(itemNode);
currentFile.writeLine(serializedItem.getBytes(StandardCharsets.UTF_8));
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/io/apitally/common/RequestLoggingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class RequestLoggingConfig {
private boolean responseBodyIncluded = false;
private boolean exceptionIncluded = true;
private boolean logCaptureEnabled = false;
private boolean tracingEnabled = false;
private List<String> queryParamMaskPatterns = new ArrayList<>();
private List<String> headerMaskPatterns = new ArrayList<>();
private List<String> bodyFieldMaskPatterns = new ArrayList<>();
Expand Down Expand Up @@ -83,14 +82,6 @@ public void setLogCaptureEnabled(boolean logCaptureEnabled) {
this.logCaptureEnabled = logCaptureEnabled;
}

public boolean isTracingEnabled() {
return tracingEnabled;
}

public void setTracingEnabled(boolean tracingEnabled) {
this.tracingEnabled = tracingEnabled;
}

public List<String> getQueryParamMaskPatterns() {
return queryParamMaskPatterns;
}
Expand Down
178 changes: 0 additions & 178 deletions src/main/java/io/apitally/common/SpanCollector.java

This file was deleted.

22 changes: 1 addition & 21 deletions src/main/java/io/apitally/common/dto/RequestLogItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,13 @@ public class RequestLogItem extends BaseDto {
private final Response response;
private final ExceptionDto exception;
private final List<LogRecord> logs;
private final List<SpanData> spans;
private final String traceId;

public RequestLogItem(
Request request,
Response response,
ExceptionDto exception,
List<LogRecord> logs,
List<SpanData> spans,
String traceId) {
public RequestLogItem(Request request, Response response, ExceptionDto exception, List<LogRecord> logs) {
this.uuid = UUID.randomUUID().toString();
this.request = request;
this.response = response;
this.exception = exception;
this.logs = logs;
this.spans = spans;
this.traceId = traceId;
}

@JsonProperty("uuid")
Expand All @@ -53,14 +43,4 @@ public ExceptionDto getException() {
public List<LogRecord> getLogs() {
return logs;
}

@JsonProperty("spans")
public List<SpanData> getSpans() {
return spans;
}

@JsonProperty("trace_id")
public String getTraceId() {
return traceId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public ApitallyClient apitallyClient(
&& properties.getRequestLogging().isLogCaptureEnabled()) {
LogAppender.register();
}
if (properties.getRequestLogging().isEnabled()
&& properties.getRequestLogging().isTracingEnabled()) {
ApitallySpanCollector.getInstance().setDelegate(client.spanCollector);
}

return client;
}
Expand Down
Loading