chore: consolidate agent code for otlp#1132
Merged
duncanista merged 2 commits intomainfrom Mar 27, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Consolidates OTLP HTTP and gRPC agent implementations into a single Agent with a shared TracePipeline, removing the standalone grpc_agent.rs and reducing duplicated trace-processing logic.
Changes:
- Introduces
TracePipelineshared between HTTP and gRPC, including a unifiedprocess_and_send_tracespath. - Implements OTLP gRPC
TraceServicedirectly on the shared pipeline and updatesAgentto spawn HTTP, gRPC, or both based on config. - Replaces separate enablement helpers with
should_enable_otlp_agent, and simplifies OTLP agent startup inmain.rs.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
bottlecap/src/otlp/mod.rs |
Removes separate HTTP/gRPC enablement helpers in favor of should_enable_otlp_agent and updates tests. |
bottlecap/src/otlp/grpc_agent.rs |
Deletes the redundant gRPC agent implementation after consolidation. |
bottlecap/src/otlp/agent.rs |
Merges HTTP+gRPC handling into one agent with a shared pipeline; adds gRPC server startup and shared processing. |
bottlecap/src/bin/bottlecap/main.rs |
Switches OTLP startup to a single consolidated agent and enablement check. |
Comments suppressed due to low confidence (1)
bottlecap/src/otlp/agent.rs:388
- For Protobuf error responses you are encoding
tonic_types::Status(google.rpc.Status), butcodeis being set to the HTTP status code (e.g. 500). In OTLP, thiscodeshould be a gRPC/Google RPC code (e.g.INVALID_ARGUMENT,INTERNAL), not an HTTP status value. MapStatusCodeto an appropriatetonic::Code/google::rpc::Codenumeric value (or omit the Protobuf body on non-OTLP-protobuf errors).
let status = ProtoStatus {
code: i32::from(status_code.as_u16()),
message: message.clone(),
details: vec![],
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jchrostek-dd
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Consolidates the OTLP agent code by merging grpc_agent.rs into agent.rs, eliminating ~280 lines of duplicated code. A single Agent struct now owns a shared TracePipeline and starts HTTP, gRPC, or both servers based on config.
Changes
Bug fixes
Tests
Merged and deduplicated parse_port tests (gained scheme-handling coverage), consolidated enablement tests into should_enable_otlp_agent. All 28 OTLP tests pass, zero clippy warnings.