summaryrefslogtreecommitdiff
path: root/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java')
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java
index ef31bcc..dbd035c 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java
@@ -7,10 +7,39 @@ import java.util.Collection;
*
* <p>Any CDI beans registered under this class are applied to each log entry that is logged.
*
+ * <p><strong>Example:</strong>
+ *
+ * <pre>{@code
+ * @Singleton
+ * @Unremovable
+ * public final class RequestIdLabelProvider implements LabelProvider {
+ *
+ * @Override
+ * public Collection<Label> getLabels() {
+ * return List.of(Label.of("requestId", RequestContext.current().getRequestId()));
+ * }
+ * }
+ * }</pre>
+ *
+ * Result:
+ *
+ * <pre>{@code
+ * {
+ * "textPayload": "Request rejected: unauthorized.",
+ * "labels": {
+ * "requestId": "123"
+ * }
+ * }
+ * }</pre>
+ *
* @see StructuredParameterProvider
*/
public interface LabelProvider {
- /** Provides a collection of {@link Label}s to add to each log entry that is logged. */
+ /**
+ * Provides a collection of {@link Label}s to add to each log entry that is logged.
+ *
+ * @return a collection of {@link Label}s to add to each log entry that is logged.
+ */
Collection<Label> getLabels();
}