Skip to content

Commit a6b99bc

Browse files
jchrostek-ddclaude
andcommitted
chore(otlp): remove redundant comments
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a2df47f commit a6b99bc

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

bottlecap/src/otlp/agent.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,9 @@ impl Agent {
204204
}
205205
}
206206

207-
// This needs to be after process_traces() because process_traces()
208-
// performs obfuscation, and we need to compute stats on the obfuscated traces.
209207
if compute_trace_stats_on_extension
210208
&& let Err(err) = stats_generator.send(&processed_traces)
211209
{
212-
// Just log the error. We don't think trace stats are critical, so we don't want to
213-
// return an error if only stats fail to send.
214210
error!("OTLP | Error sending traces to the stats concentrator: {err}");
215211
}
216212

@@ -307,7 +303,6 @@ mod tests {
307303

308304
#[test]
309305
fn test_parse_port_with_valid_endpoint() {
310-
// Test with a valid endpoint containing a port
311306
let endpoint = Some("localhost:8080".to_string());
312307
assert_eq!(
313308
Agent::parse_port(endpoint.as_ref(), OTLP_AGENT_HTTP_PORT),
@@ -317,7 +312,6 @@ mod tests {
317312

318313
#[test]
319314
fn test_parse_port_with_invalid_port_format() {
320-
// Test with an endpoint containing an invalid port format
321315
let endpoint = Some("localhost:invalid".to_string());
322316
assert_eq!(
323317
Agent::parse_port(endpoint.as_ref(), OTLP_AGENT_HTTP_PORT),
@@ -327,7 +321,6 @@ mod tests {
327321

328322
#[test]
329323
fn test_parse_port_with_missing_port() {
330-
// Test with an endpoint missing a port
331324
let endpoint = Some("localhost".to_string());
332325
assert_eq!(
333326
Agent::parse_port(endpoint.as_ref(), OTLP_AGENT_HTTP_PORT),
@@ -337,7 +330,6 @@ mod tests {
337330

338331
#[test]
339332
fn test_parse_port_with_none_endpoint() {
340-
// Test with None endpoint
341333
let endpoint: Option<String> = None;
342334
assert_eq!(
343335
Agent::parse_port(endpoint.as_ref(), OTLP_AGENT_HTTP_PORT),
@@ -347,7 +339,6 @@ mod tests {
347339

348340
#[test]
349341
fn test_parse_port_with_empty_endpoint() {
350-
// Test with an empty endpoint
351342
let endpoint = Some(String::new());
352343
assert_eq!(
353344
Agent::parse_port(endpoint.as_ref(), OTLP_AGENT_HTTP_PORT),

bottlecap/src/otlp/grpc_agent.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ impl TraceService for OtlpGrpcService {
4141
request: Request<ExportTraceServiceRequest>,
4242
) -> Result<Response<ExportTraceServiceResponse>, Status> {
4343
let inner_request = request.into_inner();
44-
45-
// Capture encoded size before processing for metrics
4644
let body_size = inner_request.encoded_len();
4745

4846
let traces = match self.processor.process_request(inner_request) {
@@ -53,7 +51,6 @@ impl TraceService for OtlpGrpcService {
5351
}
5452
};
5553

56-
// Check if processor returned any actual traces
5754
if traces.iter().all(Vec::is_empty) {
5855
error!("OTLP gRPC | Not sending traces, processor returned empty data");
5956
return Err(Status::internal(
@@ -83,11 +80,9 @@ impl TraceService for OtlpGrpcService {
8380
debug!("OTLP gRPC | Successfully buffered traces to be aggregated.");
8481
}
8582

86-
// Compute trace stats after process_traces() which performs obfuscation
8783
if compute_trace_stats_on_extension
8884
&& let Err(err) = self.stats_generator.send(&processed_traces)
8985
{
90-
// Just log the error. Stats are not critical.
9186
error!("OTLP gRPC | Error sending traces to the stats concentrator: {err}");
9287
}
9388

@@ -136,15 +131,13 @@ impl GrpcAgent {
136131

137132
fn parse_port(endpoint: Option<&String>, default_port: u16) -> u16 {
138133
if let Some(endpoint) = endpoint {
139-
// Strip scheme if present (e.g., "http://localhost:4317" -> "localhost:4317")
140134
let without_scheme = endpoint
141135
.strip_prefix("http://")
142136
.or_else(|| endpoint.strip_prefix("https://"))
143137
.unwrap_or(endpoint);
144138

145-
// Use rsplit to get port from the last colon (handles IPv6 like [::1]:4317)
139+
// rsplit handles IPv6 like [::1]:4317
146140
if let Some(port_str) = without_scheme.rsplit(':').next() {
147-
// Ensure we got a port, not part of IPv6 address
148141
if let Ok(port) = port_str.parse::<u16>() {
149142
return port;
150143
}

0 commit comments

Comments
 (0)