Class KafkaStructuredLoggingService<L>

    • Method Summary

      Modifier and Type Method Description
      protected void close()  
      static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(String bootstrapServers, String topic, com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder)
      Creates a decorator which provides StructuredLoggingService with default Producer and defaulting key to null.
      static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(String bootstrapServers, String topic, com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder, KafkaStructuredLoggingService.KeySelector<L> keySelector)
      Creates a decorator which provides StructuredLoggingService with default Producer.
      static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(Producer<byte[],​L> producer, String topic, com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder)
      Creates a decorator which provides StructuredLoggingService with defaulting key to null.
      static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(Producer<byte[],​L> producer, String topic, com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder, KafkaStructuredLoggingService.KeySelector<L> keySelector)
      Creates a decorator which provides StructuredLoggingService with full set of arguments.
      protected void writeLog​(com.linecorp.armeria.common.logging.RequestLog log, L structuredLog)  
      • Methods inherited from class com.linecorp.armeria.server.logging.structured.StructuredLoggingService

        serve, serviceAdded
      • Methods inherited from class com.linecorp.armeria.server.DecoratingService

        shouldCachePath
      • Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable

        as, delegate, toString
      • Methods inherited from interface com.linecorp.armeria.server.HttpService

        decorate, decorate
      • Methods inherited from interface com.linecorp.armeria.server.Service

        as, decorate, shouldCachePath
    • Method Detail

      • newDecorator

        public static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(Producer<byte[],​L> producer,
                                                                                                                                                                                  String topic,
                                                                                                                                                                                  com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder,
                                                                                                                                                                                  @Nullable
                                                                                                                                                                                  KafkaStructuredLoggingService.KeySelector<L> keySelector)
        Creates a decorator which provides StructuredLoggingService with full set of arguments.
        Type Parameters:
        L - the type of the structured log representation
        Parameters:
        producer - a kafka Producer producer which is used to send logs to Kafka
        topic - a name of topic which is used to send logs
        logBuilder - an instance of StructuredLogBuilder which is used to construct a log entry
        keySelector - a KafkaStructuredLoggingService.KeySelector which is used to decide what key to use for the log
        Returns:
        a service decorator which adds structured logging support integrated to Kafka
      • newDecorator

        public static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(Producer<byte[],​L> producer,
                                                                                                                                                                                  String topic,
                                                                                                                                                                                  com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder)
        Creates a decorator which provides StructuredLoggingService with defaulting key to null.
        Type Parameters:
        L - the type of the structured log representation
        Parameters:
        producer - a kafka Producer producer which is used to send logs to Kafka
        topic - a name of topic which is used to send logs
        logBuilder - an instance of StructuredLogBuilder which is used to construct a log entry
        Returns:
        a service decorator which adds structured logging support integrated to Kafka
      • newDecorator

        public static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(String bootstrapServers,
                                                                                                                                                                                  String topic,
                                                                                                                                                                                  com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder,
                                                                                                                                                                                  @Nullable
                                                                                                                                                                                  KafkaStructuredLoggingService.KeySelector<L> keySelector)
        Creates a decorator which provides StructuredLoggingService with default Producer.
        Type Parameters:
        L - the type of the structured log representation
        Parameters:
        bootstrapServers - a bootstrap.servers config to specify destination Kafka cluster
        topic - a name of topic which is used to send logs
        logBuilder - an instance of StructuredLogBuilder which is used to construct a log entry
        keySelector - a KafkaStructuredLoggingService.KeySelector which is used to decide what key to use for the log
        Returns:
        a service decorator which adds structured logging support integrated to Kafka
      • newDecorator

        public static <L> Function<? super com.linecorp.armeria.server.HttpService,​com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>> newDecorator​(String bootstrapServers,
                                                                                                                                                                                  String topic,
                                                                                                                                                                                  com.linecorp.armeria.server.logging.structured.StructuredLogBuilder<L> logBuilder)
        Creates a decorator which provides StructuredLoggingService with default Producer and defaulting key to null.
        Type Parameters:
        L - the type of the structured log representation
        Parameters:
        bootstrapServers - a bootstrap.servers config to specify destination Kafka cluster
        topic - a name of topic which is used to send logs
        logBuilder - an instance of StructuredLogBuilder which is used to construct a log entry
        Returns:
        a service decorator which adds structured logging support integrated to Kafka
      • writeLog

        protected void writeLog​(com.linecorp.armeria.common.logging.RequestLog log,
                                L structuredLog)
        Specified by:
        writeLog in class com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>
      • close

        protected void close()
        Overrides:
        close in class com.linecorp.armeria.server.logging.structured.StructuredLoggingService<L>