userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.37k stars 275 forks source link

feat logs: fix for issue#676 separate otlp config for logs and traces #679

Closed TertiumOrganum1 closed 1 week ago

TertiumOrganum1 commented 2 weeks ago

This is a proposal how to solve issue#676: Separate otlp config for logs and traces.

Motivation: in Kubernetes (while traces are sent efficiently through the push model) applications typically write their logs to stdout/stderr so that they are available for log collectors (they are stored in files on k8s nodes). This way, even in case of application failure, logs will be available.

A new send-logs option is added to the otlp-logger configuration. This option allows the user to control whether logs are sent via gRPC using the OTLP protocol or through the default logger from the logging component.

By default, send-logs is set to true. In this case, the OTLP logger will behave as before, sending both logs and traces using gRPC through the OTLP protocol.

If send-logs is set to false, the OTLP logger will try to use the 'default' logger from the logging component for logs.

Documentation for the new send-logs option and handling of exceptions for both cases were added as well.