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 @@ -35,12 +35,13 @@ public void trackError(final Throwable error) {
}
}

public JsonArray getData() {
public JsonArray getData(final String buildId) {
final var report = new JsonArray(reports.size());

reports.forEach((hash, object) -> {
final var copy = object.deepCopy();
copy.addProperty("hash", hash);
copy.addProperty("buildId", buildId);
final var count = collected.getOrDefault(hash, 1);
if (count > 1) copy.addProperty("count", count);
report.add(copy);
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/dev/faststats/core/SimpleMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public abstract class SimpleMetrics implements Metrics {

private final String SDK_NAME;
private final String SDK_VERSION;
private final String BUILD_ID;

{
final var properties = new Properties();
Expand All @@ -60,6 +61,7 @@ public abstract class SimpleMetrics implements Metrics {
}
this.SDK_NAME = properties.getProperty("name", "unknown");
this.SDK_VERSION = properties.getProperty("version", "unknown");
this.BUILD_ID = properties.getProperty("build-id", "unknown");
}

@Contract(mutates = "io")
Expand Down Expand Up @@ -278,7 +280,7 @@ protected JsonObject createData() {
data.add("data", metrics);

getErrorTracker().map(SimpleErrorTracker.class::cast)
.map(SimpleErrorTracker::getData)
.map(tracker -> tracker.getData(BUILD_ID))
.filter(errors -> !errors.isEmpty())
.ifPresent(errors -> data.add("errors", errors));
return data;
Expand Down