Skip to content

Commit a2df47f

Browse files
jchrostek-ddclaude
andcommitted
refactor(otlp): rename enablement functions for clarity
Rename should_enable_http → should_enable_otlp_http Rename should_enable_grpc → should_enable_otlp_grpc 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 99b8809 commit a2df47f

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

bottlecap/src/bin/bottlecap/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ use bottlecap::{
5353
flusher::LogsFlusher,
5454
},
5555
otlp::{
56-
agent::Agent as OtlpAgent, grpc_agent::GrpcAgent as OtlpGrpcAgent, should_enable_grpc,
57-
should_enable_http,
56+
agent::Agent as OtlpAgent, grpc_agent::GrpcAgent as OtlpGrpcAgent, should_enable_otlp_grpc,
57+
should_enable_otlp_http,
5858
},
5959
proxy::{interceptor, should_start_proxy},
6060
secrets::decrypt,
@@ -1357,8 +1357,8 @@ fn start_otlp_agent(
13571357
trace_tx: Sender<SendDataBuilderInfo>,
13581358
stats_concentrator: StatsConcentratorHandle,
13591359
) -> Option<CancellationToken> {
1360-
let http_enabled = should_enable_http(config);
1361-
let grpc_enabled = should_enable_grpc(config);
1360+
let http_enabled = should_enable_otlp_http(config);
1361+
let grpc_enabled = should_enable_otlp_grpc(config);
13621362

13631363
if !http_enabled && !grpc_enabled {
13641364
return None;

bottlecap/src/otlp/mod.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ pub mod grpc_agent;
77
pub mod processor;
88
pub mod transform;
99

10-
/// Check if the HTTP OTLP agent should be enabled.
1110
#[must_use]
12-
pub fn should_enable_http(config: &Arc<Config>) -> bool {
11+
pub fn should_enable_otlp_http(config: &Arc<Config>) -> bool {
1312
config.otlp_config_traces_enabled
1413
&& config
1514
.otlp_config_receiver_protocols_http_endpoint
1615
.is_some()
1716
}
1817

19-
/// Check if the gRPC OTLP agent should be enabled.
2018
#[must_use]
21-
pub fn should_enable_grpc(config: &Arc<Config>) -> bool {
19+
pub fn should_enable_otlp_grpc(config: &Arc<Config>) -> bool {
2220
config.otlp_config_traces_enabled
2321
&& config
2422
.otlp_config_receiver_protocols_grpc_endpoint
@@ -34,7 +32,7 @@ mod tests {
3432
use crate::config::get_config;
3533

3634
#[test]
37-
fn test_should_enable_http_from_yaml() {
35+
fn test_should_enable_otlp_http_from_yaml() {
3836
figment::Jail::expect_with(|jail| {
3937
jail.clear_env();
4038
jail.create_file(
@@ -50,15 +48,15 @@ mod tests {
5048

5149
let config = Arc::new(get_config(Path::new("")));
5250

53-
assert!(should_enable_http(&config));
54-
assert!(!should_enable_grpc(&config));
51+
assert!(should_enable_otlp_http(&config));
52+
assert!(!should_enable_otlp_grpc(&config));
5553

5654
Ok(())
5755
});
5856
}
5957

6058
#[test]
61-
fn test_should_enable_http_from_env_vars() {
59+
fn test_should_enable_otlp_http_from_env_vars() {
6260
figment::Jail::expect_with(|jail| {
6361
jail.clear_env();
6462
jail.set_env(
@@ -68,8 +66,8 @@ mod tests {
6866

6967
let config = Arc::new(get_config(Path::new("")));
7068

71-
assert!(should_enable_http(&config));
72-
assert!(!should_enable_grpc(&config));
69+
assert!(should_enable_otlp_http(&config));
70+
assert!(!should_enable_otlp_grpc(&config));
7371

7472
Ok(())
7573
});
@@ -87,14 +85,14 @@ mod tests {
8785

8886
let config = Arc::new(get_config(Path::new("")));
8987

90-
assert!(!should_enable_http(&config));
88+
assert!(!should_enable_otlp_http(&config));
9189

9290
Ok(())
9391
});
9492
}
9593

9694
#[test]
97-
fn test_should_enable_grpc_from_env_vars() {
95+
fn test_should_enable_otlp_grpc_from_env_vars() {
9896
figment::Jail::expect_with(|jail| {
9997
jail.clear_env();
10098
jail.set_env(
@@ -104,8 +102,8 @@ mod tests {
104102

105103
let config = Arc::new(get_config(Path::new("")));
106104

107-
assert!(should_enable_grpc(&config));
108-
assert!(!should_enable_http(&config));
105+
assert!(should_enable_otlp_grpc(&config));
106+
assert!(!should_enable_otlp_http(&config));
109107

110108
Ok(())
111109
});
@@ -126,8 +124,8 @@ mod tests {
126124

127125
let config = Arc::new(get_config(Path::new("")));
128126

129-
assert!(should_enable_http(&config));
130-
assert!(should_enable_grpc(&config));
127+
assert!(should_enable_otlp_http(&config));
128+
assert!(should_enable_otlp_grpc(&config));
131129

132130
Ok(())
133131
});
@@ -145,7 +143,7 @@ mod tests {
145143

146144
let config = Arc::new(get_config(Path::new("")));
147145

148-
assert!(!should_enable_grpc(&config));
146+
assert!(!should_enable_otlp_grpc(&config));
149147

150148
Ok(())
151149
});

0 commit comments

Comments
 (0)