Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

The opentelemetry-otlp crate declared tracing as a direct dependency but never used it in its source code. The dependency was only needed transitively via opentelemetry and opentelemetry_sdk when their internal-logs features are enabled.

Changes

  • Removed direct tracing dependency from opentelemetry-otlp/Cargo.toml
  • Updated internal-logs feature to only pass through to opentelemetry and opentelemetry_sdk:
    # Before
    internal-logs = ["tracing", "opentelemetry_sdk/internal-logs", "opentelemetry/internal-logs"]
    
    # After
    internal-logs = ["opentelemetry_sdk/internal-logs", "opentelemetry/internal-logs"]

The tracing crate remains available when internal-logs is enabled through transitive dependencies. No functional or API changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor internal-logs feature in opentelemetry-otlp to reduce unnecessary dependencies</issue_title>
<issue_description>

Discussed in #3191

Originally posted by houseme October 3, 2025

Summary

The internal-logs feature in the opentelemetry-otlp crate currently enables "opentelemetry-http/internal-logs". However, since opentelemetry-http itself depends on "opentelemetry/internal-logs", this indirection introduces an unnecessary dependency on opentelemetry-http when using grpc-tonic without default or http features.

Current Behavior

In opentelemetry-otlp/Cargo.toml:

[features]
internal-logs = ["tracing", "opentelemetry_sdk/internal-logs", "opentelemetry-http/internal-logs"]

This forces users to depend on opentelemetry-http even when:

  • Using grpc-tonic transport
  • Not using http or default features
  • Only needing internal-logs functionality

Proposed Change

Directly depend on "opentelemetry/internal-logs" instead:

[features]
internal-logs = ["tracing", "opentelemetry_sdk/internal-logs", "opentelemetry/internal-logs"]

Benefits

  1. Eliminates unnecessary dependencies
    Removes forced opentelemetry-http dependency for grpc-tonic users
  2. Aligns with dependency hierarchy
    Since opentelemetry-http already depends on opentelemetry/internal-logs, this change respects the existing dependency chain
  3. Improves compile times
    Particularly for projects using grpc-tonic with default-features = false
  4. Maintains compatibility
    No breaking changes - all existing functionality preserved

Verification Steps

  1. Check opentelemetry-http/Cargo.toml confirms:
    [features]
    internal-logs = ["opentelemetry/internal-logs"]
  2. Test with:
    opentelemetry-otlp = { version = "*", default-features = false, features = ["grpc-tonic", "internal-logs"] }
    Should not pull opentelemetry-http

Additional Context

This micro-optimization supports the project's goal of maintaining a lean dependency tree, especially important for users carefully managing their dependency footprint in performance-sensitive applications.


Would you like me to submit a PR for this change?
I can prepare a minimal PR updating the feature flag if the maintainers agree this is a welcome optimization.

cc @lalitb @bantonsson

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Refactor internal-logs feature to reduce unnecessary dependencies Remove unused tracing dependency from opentelemetry-otlp Nov 24, 2025
Copilot AI requested a review from cijothomas November 24, 2025 17:25
Copilot finished work on behalf of cijothomas November 24, 2025 17:25
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.

Refactor internal-logs feature in opentelemetry-otlp to reduce unnecessary dependencies

2 participants