summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-08-30 12:14:43 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-08-30 12:14:43 +0200
commit596486a432f4552b6c66b61af60f2474a4ff767e (patch)
tree2f0d92ea12e5406dd6126e3371e287c0ba9daf6f
parentde386a8e1c0ae7d4eb0771c818757dfdce66e734 (diff)
LogEntry: Change JSON field names to match Google documentation.
Change-Id: I007fd1f7164d2572c49da170945d435a22319b54
-rw-r--r--.gitignore1
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java13
2 files changed, 8 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 0390997..a7f8234 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/.gradle
/.idea
build/
diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java
index 2be17a2..d108c81 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java
@@ -15,8 +15,9 @@ import javax.json.JsonObjectBuilder;
* href="https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry">LogEntry</a>
* structure.
*
- * <p>A few of the fields are treated specially by the fluentd instance running in Google Kubernetes
- * Engine. All other fields end up in the jsonPayload field on the Google Cloud Logging side.
+ * <p>A few of the fields are <a href="https://cloud.google.com/logging/docs/structured-logging">
+ * treated specially</a> by the fluentd instance running in Google Kubernetes Engine. All other
+ * fields end up in the jsonPayload field on the Google Cloud Logging side.
*/
final class LogEntry {
@@ -111,11 +112,11 @@ final class LogEntry {
var b = Json.createObjectBuilder();
if (trace != null) {
- b.add("trace", trace);
+ b.add("logging.googleapis.com/trace", trace);
}
if (spanId != null) {
- b.add("spanId", spanId);
+ b.add("logging.googleapis.com/spanId", spanId);
}
if (nestedDiagnosticContext != null && !nestedDiagnosticContext.isEmpty()) {
@@ -123,7 +124,7 @@ final class LogEntry {
}
if (!labels.isEmpty()) {
- b.add("labels", jsonOfStringMap(labels));
+ b.add("logging.googleapis.com/labels", jsonOfStringMap(labels));
}
if (type != null) {
@@ -133,7 +134,7 @@ final class LogEntry {
return b.add("message", message)
.add("severity", severity)
.add("timestamp", timestamp.json())
- .add("sourceLocation", sourceLocation.json())
+ .add("logging.googleapis.com/sourceLocation", sourceLocation.json())
.addAll(jsonOfStringMap(mappedDiagnosticContext))
.addAll(jsonOfParameterMap(parameters));
}