Skip to content

Commit 2978225

Browse files
prontclaude
andcommitted
fix(api): guard allocation tracing RPC behind cfg feature flag
The `get_allocation_tracing_status` RPC handler unconditionally called `is_allocation_tracing_enabled()`, which only exists behind the `allocation-tracing` feature gate. This broke builds on feature sets that lack it (e.g. `default-msvc`). Add cfg guards so the handler returns `false` when the feature is absent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f451948 commit 2978225

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/vector-top/src/metrics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,11 @@ pub async fn init_components(
573573

574574
#[cfg(feature = "allocation-tracing")]
575575
{
576+
// Allocation tracing is a compile-time + startup-time setting on the
577+
// server, so querying once per connection is sufficient. On error
578+
// (e.g. older server without this RPC) we default to false, matching
579+
// pre-existing behavior. This is re-evaluated on every reconnect via
580+
// the retry loop in `subscription()`.
576581
state.allocation_tracing_active = client
577582
.get_allocation_tracing_status()
578583
.await

src/api/grpc/service.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ impl observability::Service for ObservabilityService {
440440
&self,
441441
_request: Request<GetAllocationTracingStatusRequest>,
442442
) -> Result<Response<GetAllocationTracingStatusResponse>, Status> {
443+
#[cfg(feature = "allocation-tracing")]
443444
let enabled = crate::internal_telemetry::allocations::is_allocation_tracing_enabled();
445+
#[cfg(not(feature = "allocation-tracing"))]
446+
let enabled = false;
444447
Ok(Response::new(GetAllocationTracingStatusResponse {
445448
enabled,
446449
}))

0 commit comments

Comments
 (0)