From 27b82ca0ef528b0286077e31bb9dc9e5a0100f39 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 13 May 2024 14:20:05 -0700 Subject: [PATCH] [OTel C++] Deprecate SetTargetAttributeFilter method on OpenTelemetryPluginBuilder (#36567) Implements the change in https://github.com/grpc/proposal/pull/431 and documents the current working of the `SetTargetAttributeFilter` method on `OpenTelemetryPluginBuilder` Closes #36567 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36567 from yashykt:DeprecateTargetAttributeFilter f3f2fef8cb6143690fc0c076157af3b1b850d160 PiperOrigin-RevId: 633330427 --- include/grpcpp/ext/otel_plugin.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/include/grpcpp/ext/otel_plugin.h b/include/grpcpp/ext/otel_plugin.h index c9327d68d09..1b6bb9eb762 100644 --- a/include/grpcpp/ext/otel_plugin.h +++ b/include/grpcpp/ext/otel_plugin.h @@ -88,11 +88,25 @@ class OpenTelemetryPluginBuilder { /// If `SetMeterProvider()` is not called, no metrics are collected. OpenTelemetryPluginBuilder& SetMeterProvider( std::shared_ptr meter_provider); - /// If set, \a target_attribute_filter is called per channel to decide whether - /// to record the target attribute on client or to replace it with "other". - /// This helps reduce the cardinality on metrics in cases where many channels - /// are created with different targets in the same binary (which might happen - /// for example, if the channel target string uses IP addresses directly). + /// DEPRECATED: If set, \a target_attribute_filter is called per channel to + /// decide whether to record the target attribute on client or to replace it + /// with "other". This helps reduce the cardinality on metrics in cases where + /// many channels are created with different targets in the same binary (which + /// might happen for example, if the channel target string uses IP addresses + /// directly). + /// This filtration only works for the per-call metrics - + /// grpc.client.attempt.started + /// grpc.client.attempt.duration + /// grpc.client.attempt.sent_total_compressed_message_size + /// grpc.client.attempt.rcvd_total_compressed_message_size + /// For example, the grpc.target attribute on pick first lb policy metrics + /// defined in + /// https://github.com/grpc/proposal/blob/master/A78-grpc-metrics-wrr-pf-xds.md + /// will not be filtered. Please contact the grpc team if this filtration is + /// of interest to you. + GRPC_DEPRECATED( + "Does not work as expected. Please raise an issue on " + "https://github.com/grpc/grpc if this would be of use to you.") OpenTelemetryPluginBuilder& SetTargetAttributeFilter( absl::AnyInvocable target_attribute_filter);