Class GcpLogSink

  • All Implemented Interfaces:
    Sink

    @Internal
    public class GcpLogSink
    extends java.lang.Object
    implements Sink
    Sink for Google Cloud Logging.
    • Constructor Summary

      Constructors 
      Constructor Description
      GcpLogSink​(java.lang.String projectId, ObservabilityConfig config, java.util.Collection<java.lang.String> servicesToExclude, TraceLoggingHelper traceLoggingHelper)
      Retrieves a single instance of GcpLogSink.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes Cloud Logging Client.
      void write​(GrpcLogRecord logProto, io.opencensus.trace.SpanContext spanContext)
      Writes logs to GCP Cloud Logging.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GcpLogSink

        public GcpLogSink​(java.lang.String projectId,
                          ObservabilityConfig config,
                          java.util.Collection<java.lang.String> servicesToExclude,
                          TraceLoggingHelper traceLoggingHelper)
        Retrieves a single instance of GcpLogSink.
        Parameters:
        projectId - GCP project id to write logs
        servicesToExclude - service names for which log entries should not be generated
    • Method Detail

      • write

        public void write​(GrpcLogRecord logProto,
                          io.opencensus.trace.SpanContext spanContext)
        Writes logs to GCP Cloud Logging.
        Specified by:
        write in interface Sink
        Parameters:
        logProto - gRPC logging proto containing the message to be logged
      • close

        public void close()
        Closes Cloud Logging Client.
        Specified by:
        close in interface Sink