Skip to content

Commit

Permalink
[OTel C++] Deprecate SetTargetAttributeFilter method on OpenTelemetry…
Browse files Browse the repository at this point in the history
…PluginBuilder (#36567)

Implements the change in grpc/proposal#431 and documents the current working of the `SetTargetAttributeFilter` method on `OpenTelemetryPluginBuilder`

Closes #36567

COPYBARA_INTEGRATE_REVIEW=#36567 from yashykt:DeprecateTargetAttributeFilter f3f2fef
PiperOrigin-RevId: 633330427
  • Loading branch information
yashykt authored and Copybara-Service committed May 13, 2024
1 parent 29f2dc1 commit 27b82ca
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions include/grpcpp/ext/otel_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,25 @@ class OpenTelemetryPluginBuilder {
/// If `SetMeterProvider()` is not called, no metrics are collected.
OpenTelemetryPluginBuilder& SetMeterProvider(
std::shared_ptr<opentelemetry::metrics::MeterProvider> 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<bool(absl::string_view /*target*/) const>
target_attribute_filter);
Expand Down

0 comments on commit 27b82ca

Please sign in to comment.