Skip to content

Commit

Permalink
Add option to create custom timestamp value (micrometer-metrics#1330)
Browse files Browse the repository at this point in the history
  • Loading branch information
malex211 authored and shakuzen committed Jun 29, 2019
1 parent 6d0a8c1 commit d41fbf5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,14 @@ Optional<String> writeMeter(Meter meter) {
}));
}

protected String generateTimestamp() {
return TIMESTAMP_FORMATTER.format(Instant.ofEpochMilli(config().clock().wallTime()));
}

// VisibleForTesting
String writeDocument(Meter meter, Consumer<StringBuilder> consumer) {
StringBuilder sb = new StringBuilder(indexLine);
String timestamp = TIMESTAMP_FORMATTER.format(Instant.ofEpochMilli(config().clock().wallTime()));
String timestamp = generateTimestamp();
String name = getConventionName(meter.getId());
String type = meter.getId().getType().toString().toLowerCase();
sb.append("{\"").append(config.timestampFieldName()).append("\":\"").append(timestamp).append('"')
Expand Down

0 comments on commit d41fbf5

Please sign in to comment.