GRPC C++  1.78.1
metrics.h
Go to the documentation of this file.
1 // Copyright 2024 The gRPC Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_SUPPORT_METRICS_H
16 #define GRPC_SUPPORT_METRICS_H
17 
19 
20 #include "absl/strings/string_view.h"
21 
22 // Forward declaration for EndpointConfig
23 namespace grpc_event_engine {
24 namespace experimental {
25 class EndpointConfig; // Forward declaration
26 } // namespace experimental
27 } // namespace grpc_event_engine
28 
29 namespace grpc_core {
30 namespace experimental {
31 
32 // Configuration (scope) for a specific client channel to be used for stats
33 // plugins. For some components like XdsClient where the same XdsClient instance
34 // can be shared across multiple channels that share the same target name but
35 // have different default authority and channel arguments, the component uses
36 // the configuration from the first channel that uses this XdsClient instance to
37 // determine StatsPluginChannelScope.
39  public:
41  absl::string_view target, absl::string_view default_authority,
43  : target_(target), default_authority_(default_authority), args_(args) {}
44 
48  absl::string_view target() const { return target_; }
50  absl::string_view default_authority() const { return default_authority_; }
52  // TODO(roth, ctiller, yashkt): Find a better representation for
53  // channel args before de-experimentalizing this API.
55  const {
56  return args_;
57  }
58 
59  private:
60  // Disable copy constructor and copy-assignment operator.
62  StatsPluginChannelScope& operator=(const StatsPluginChannelScope&) = delete;
63 
64  absl::string_view target_;
65  absl::string_view default_authority_;
67 };
68 
69 } // namespace experimental
70 } // namespace grpc_core
71 
72 #endif /* GRPC_SUPPORT_METRICS_H */
grpc_core
Definition: grpc_audit_logging.h:31
grpc_event_engine::experimental::EndpointConfig
Collection of parameters used to configure client and server endpoints.
Definition: endpoint_config.h:31
grpc_core::experimental::StatsPluginChannelScope::experimental_args
const grpc_event_engine::experimental::EndpointConfig & experimental_args() const
Returns channel arguments. THIS METHOD IS EXPERIMENTAL.
Definition: metrics.h:54
grpc_core::experimental::StatsPluginChannelScope::target
absl::string_view target() const
Returns the target used for creating the channel in the canonical form.
Definition: metrics.h:48
grpc_core::experimental::StatsPluginChannelScope::StatsPluginChannelScope
StatsPluginChannelScope(absl::string_view target, absl::string_view default_authority, const grpc_event_engine::experimental::EndpointConfig &args)
Definition: metrics.h:40
grpc_event_engine
Definition: endpoint_config.h:24
grpc_core::experimental::StatsPluginChannelScope
Definition: metrics.h:38
grpc_core::experimental::StatsPluginChannelScope::default_authority
absl::string_view default_authority() const
Returns the default authority for the channel.
Definition: metrics.h:50
port_platform.h