Reviewer comments

pull/36787/head
Yash Tibrewal 6 months ago
parent 7ccb51e2ea
commit f62cf1eabd
  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

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

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

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

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

Loading…
Cancel
Save