[StatsPlugin] Reviewer comments from #36757 (#36787)

Copybara missed the last commit on #36757

Closes #36787

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36787 from yashykt:36757Follow f62cf1eabd
PiperOrigin-RevId: 639933826
pull/36807/head
Yash Tibrewal 6 months ago committed by Copybara-Service
parent 9b1bb788aa
commit d623f31d97
  1. 4
      src/core/telemetry/metrics.h
  2. 2
      src/cpp/ext/otel/otel_plugin.cc
  3. 2
      src/cpp/ext/otel/otel_plugin.h
  4. 2
      test/core/test_util/fake_stats_plugin.h

@ -330,7 +330,7 @@ class StatsPlugin {
virtual void RemoveCallback(RegisteredMetricCallback* callback) = 0;
// Returns true if instrument \a handle is enabled.
virtual bool IsInstrumentEnabled(
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) = 0;
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) const = 0;
// Gets a ClientCallTracer associated with this stats plugin which can be used
// in a call.
@ -429,7 +429,7 @@ class GlobalStatsPluginRegistry {
// Returns true if any of the stats plugins in the group have enabled \a
// handle.
bool IsInstrumentEnabled(
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) {
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) const {
for (auto& state : plugins_state_) {
if (state.plugin->IsInstrumentEnabled(handle)) {
return true;

@ -914,7 +914,7 @@ grpc_core::ServerCallTracer* OpenTelemetryPlugin::GetServerCallTracer(
}
bool OpenTelemetryPlugin::IsInstrumentEnabled(
grpc_core::GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) {
grpc_core::GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) const {
return !absl::holds_alternative<Disabled>(
instruments_data_.at(handle.index).instrument);
}

@ -406,7 +406,7 @@ class OpenTelemetryPlugin : public grpc_core::StatsPlugin {
override;
bool IsInstrumentEnabled(
grpc_core::GlobalInstrumentsRegistry::GlobalInstrumentHandle handle)
override;
const override;
const absl::AnyInvocable<bool(const grpc_core::ChannelArgs& /*args*/) const>&
server_selector() const {

@ -361,7 +361,7 @@ class FakeStatsPlugin : public StatsPlugin {
return nullptr;
}
bool IsInstrumentEnabled(
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) override {
GlobalInstrumentsRegistry::GlobalInstrumentHandle handle) const override {
const auto& descriptor =
GlobalInstrumentsRegistry::GetInstrumentDescriptor(handle);
return use_disabled_by_default_metrics_ || descriptor.enable_by_default;

Loading…
Cancel
Save