Skip to content

feat(telemetry): add OTel logger initialization#573

Merged
dpasiukevich merged 2 commits intogoogle:mainfrom
pawel-maciejczek:feature/telemetry-logging-sdk-config
Feb 23, 2026
Merged

feat(telemetry): add OTel logger initialization#573
dpasiukevich merged 2 commits intogoogle:mainfrom
pawel-maciejczek:feature/telemetry-logging-sdk-config

Conversation

@pawel-maciejczek
Copy link
Contributor

@pawel-maciejczek pawel-maciejczek commented Feb 16, 2026

This PR extends the telemetry configuration package to support OpenTelemetry logging.

It allows users to configure log exporters, processors, and providers, similarly to TracerProvider.

It also adds new tests for the exporters configured with otel_to_cloud and OTel env variables

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pawel-maciejczek, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the existing telemetry system by integrating OpenTelemetry logging. It establishes a robust framework for collecting and exporting logs, mirroring the current tracing implementation. This change allows for more comprehensive observability by enabling structured logging alongside distributed tracing, providing a unified approach to monitoring application behavior.

Highlights

  • OpenTelemetry Logging Integration: Added comprehensive OpenTelemetry logging capabilities, including new configuration options and a logger provider, to enhance observability.
  • Dependency Updates: Updated various Go module dependencies, including OpenTelemetry, gRPC, and protobuf, and incorporated new OpenTelemetry logging packages.
  • Logger Provider Initialization: Implemented logic to initialize and configure OpenTelemetry log exporters, supporting configuration via environment variables like OTEL_EXPORTER_OTLP_LOGS_ENDPOINT.
  • Graceful Shutdown: Extended the telemetry shutdown process to gracefully close the OpenTelemetry logger provider, ensuring proper resource management.
  • Unit Test Coverage: Introduced new unit tests to validate the correct initialization, configuration, and shutdown of the OpenTelemetry logger provider and its integration with various exporters.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • go.mod
    • Updated several Go module dependencies to newer versions.
    • Added new OpenTelemetry logging-related dependencies, such as go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp and go.opentelemetry.io/otel/sdk/log.
  • go.sum
    • Updated module checksums to reflect the dependency changes in go.mod.
  • telemetry/config.go
    • Introduced 'logProcessors' and 'loggerProvider' fields to the 'config' struct.
    • Added 'WithLogRecordProcessors' and 'WithLoggerProvider' options for configuring log processing and providers.
  • telemetry/setup_otel.go
    • Imported necessary OpenTelemetry logging packages like otlploghttp and sdklog.
    • Modified the 'configure' function to return both span and log processors.
    • Implemented the 'initLoggerProvider' function to create and configure an OpenTelemetry LoggerProvider.
    • Updated 'configureExporters' to handle 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT' environment variable for OTLP log exporters.
  • telemetry/telemetry.go
    • Modified the 'Providers' struct to include a 'LoggerProvider'.
    • Updated the 'Shutdown' method to ensure proper closure of the 'LoggerProvider' alongside the 'TracerProvider'.
  • telemetry/telemetry_test.go
    • Added imports for 'log' and 'sdklog' packages.
    • Modified 'TestTelemetrySmoke' to include a log exporter and verify log record processing.
    • Introduced 'TestTelemetryCustomLoggerProvider' to test custom logger provider configuration.
    • Added 'inMemoryLogExporter' struct for testing log export functionality.
    • Implemented 'TestConfigureEnvVarsExporters' to validate environment variable-based configuration for log exporters.
Activity
  • No specific activity (comments, reviews, progress) was provided in the pull request context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds OpenTelemetry logger initialization, which is a great feature. The implementation is mostly solid and follows the existing patterns for trace initialization. I've found a couple of areas for improvement: one is an omission in setting the global logger provider, and the other is an incorrect test case that doesn't match the implementation. Please see my detailed comments.

@pawel-maciejczek pawel-maciejczek force-pushed the feature/telemetry-logging-sdk-config branch 4 times, most recently from 031d7c1 to 50a5967 Compare February 19, 2026 17:39
@pawel-maciejczek pawel-maciejczek marked this pull request as ready for review February 19, 2026 17:39
@pawel-maciejczek pawel-maciejczek force-pushed the feature/telemetry-logging-sdk-config branch 3 times, most recently from b6ea337 to e38a9b5 Compare February 20, 2026 11:42
@pawel-maciejczek pawel-maciejczek force-pushed the feature/telemetry-logging-sdk-config branch from e38a9b5 to 8816c78 Compare February 20, 2026 13:26
@dpasiukevich dpasiukevich merged commit 4490347 into google:main Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants