Skip to content

fix: duplicate OTel schema#391

Merged
gilescope merged 3 commits intomainfrom
389-error-on-otel-setup
Mar 13, 2026
Merged

fix: duplicate OTel schema#391
gilescope merged 3 commits intomainfrom
389-error-on-otel-setup

Conversation

@janishorsts
Copy link
Copy Markdown
Collaborator

@janishorsts janishorsts commented Mar 11, 2026

This fixes the duplicate OTel attributes, including the schema one.

The resource.Default() already returns these attributes.

@janishorsts janishorsts self-assigned this Mar 11, 2026
@janishorsts janishorsts requested a review from a team as a code owner March 11, 2026 21:08
@janishorsts janishorsts requested review from kmannislands and removed request for a team March 11, 2026 21:08
@janishorsts janishorsts linked an issue Mar 11, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

➖ Are we earthbuild yet?

No change in "earthly" occurrences

📈 Overall Progress

Branch Total Count
main 5619
This PR 5619
Difference +0

Keep up the great work migrating from Earthly to Earthbuild! 🚀

💡 Tips for finding more occurrences

Run locally to see detailed breakdown:

./.github/scripts/count-earthly.sh

Note that the goal is not to reach 0.
There is anticipated to be at least some occurences of earthly in the source code due to backwards compatibility with config files and language constructs.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 addresses an issue where OpenTelemetry resource attributes were being duplicated due to redundant configuration options. By removing these unnecessary options, the change ensures that telemetry data is correctly and cleanly generated, preventing potential misinterpretations or inefficiencies in observability.

Highlights

  • Removed redundant OpenTelemetry resource options: The resource.WithSchemaURL, resource.WithFromEnv, and resource.WithTelemetrySDK options were removed from the newOTelResource function call. These options were causing duplicate OpenTelemetry attributes, including the schema URL, leading to cleaner and more accurate telemetry data.
Changelog
  • internal/telemetry/telemetry.go
    • Removed redundant OpenTelemetry resource configuration options from the newOTelResource function.
Activity
  • No activity has been recorded for this pull request yet.
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
Copy Markdown

@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 correctly removes redundant OpenTelemetry resource options (WithSchemaURL, WithFromEnv, and WithTelemetrySDK) from the resource.New call. These options are already covered when merging with resource.Default(), so this change correctly prevents duplicate attributes.

While reviewing the resource handling, I noticed a related issue in the same file: the otelResource is not applied to the logger provider. The setupLoggerProvider function does not accept the resource, and sdklog.NewLoggerProvider is called without sdklog.WithResource(res). This will result in logs missing important resource attributes like service.name.

To fix this, I recommend the following changes:

  1. Update the setupLoggerProvider function signature to accept a *resource.Resource.
  2. In the Setup function, pass the otelResource to setupLoggerProvider.
  3. Inside setupLoggerProvider, use sdklog.WithResource(res) when creating the loggerProvider.

This will ensure that logs have the same resource attributes as traces and metrics, providing consistent telemetry data.

@gilescope gilescope enabled auto-merge (squash) March 13, 2026 10:48
@gilescope gilescope merged commit 9bc0da1 into main Mar 13, 2026
201 of 204 checks passed
@gilescope gilescope deleted the 389-error-on-otel-setup branch March 13, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error on OTEL setup

2 participants