Skip to content

Commit 4cced58

Browse files
authored
app: Rename Metrics types as InboundMetrics and OutboundMetrics (#2376)
This helps avoid a bug with rust-analyzer and is generally clearer.
1 parent 846ce1b commit 4cced58

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

linkerd/app/admin/src/stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl Config {
7676
policy: impl inbound::policy::GetPolicy,
7777
identity: identity::Server,
7878
report: R,
79-
metrics: inbound::Metrics,
79+
metrics: inbound::InboundMetrics,
8080
trace: trace::Handle,
8181
drain: drain::Watch,
8282
shutdown: mpsc::UnboundedSender<()>,

linkerd/app/inbound/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod server;
1717
#[cfg(any(test, feature = "test-util", fuzzing))]
1818
pub mod test_util;
1919

20-
pub use self::{metrics::Metrics, policy::DefaultPolicy};
20+
pub use self::{metrics::InboundMetrics, policy::DefaultPolicy};
2121
use linkerd_app_core::{
2222
config::{ConnectConfig, ProxyConfig, QueueConfig},
2323
drain,
@@ -63,7 +63,7 @@ pub struct Inbound<S> {
6363

6464
#[derive(Clone)]
6565
struct Runtime {
66-
metrics: Metrics,
66+
metrics: InboundMetrics,
6767
identity: identity::creds::Receiver,
6868
tap: tap::Registry,
6969
span_sink: OpenCensusSink,
@@ -150,7 +150,7 @@ impl<S> Inbound<S> {
150150
impl Inbound<()> {
151151
pub fn new(config: Config, runtime: ProxyRuntime) -> Self {
152152
let runtime = Runtime {
153-
metrics: Metrics::new(runtime.metrics),
153+
metrics: InboundMetrics::new(runtime.metrics),
154154
identity: runtime.identity,
155155
tap: runtime.tap,
156156
span_sink: runtime.span_sink,
@@ -170,7 +170,7 @@ impl Inbound<()> {
170170
(this, drain)
171171
}
172172

173-
pub fn metrics(&self) -> Metrics {
173+
pub fn metrics(&self) -> InboundMetrics {
174174
self.runtime.metrics.clone()
175175
}
176176

linkerd/app/inbound/src/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use linkerd_app_core::metrics::*;
1515

1616
/// Holds outbound proxy metrics.
1717
#[derive(Clone, Debug)]
18-
pub struct Metrics {
18+
pub struct InboundMetrics {
1919
pub http_authz: authz::HttpAuthzMetrics,
2020
pub http_errors: error::HttpErrorMetrics,
2121

@@ -27,7 +27,7 @@ pub struct Metrics {
2727
pub proxy: Proxy,
2828
}
2929

30-
impl Metrics {
30+
impl InboundMetrics {
3131
pub(crate) fn new(proxy: Proxy) -> Self {
3232
Self {
3333
http_authz: authz::HttpAuthzMetrics::default(),
@@ -39,7 +39,7 @@ impl Metrics {
3939
}
4040
}
4141

42-
impl FmtMetrics for Metrics {
42+
impl FmtMetrics for InboundMetrics {
4343
fn fmt_metrics(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4444
self.http_authz.fmt_metrics(f)?;
4545
self.http_errors.fmt_metrics(f)?;

linkerd/app/outbound/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub mod test_util;
4646

4747
pub use self::{
4848
discover::{spawn_synthesized_profile_policy, synthesize_forward_policy, Discovery},
49-
metrics::Metrics,
49+
metrics::OutboundMetrics,
5050
};
5151

5252
#[derive(Clone, Debug)]
@@ -91,7 +91,7 @@ pub struct Outbound<S> {
9191

9292
#[derive(Clone, Debug)]
9393
struct Runtime {
94-
metrics: Metrics,
94+
metrics: OutboundMetrics,
9595
identity: identity::NewClient,
9696
tap: tap::Registry,
9797
span_sink: OpenCensusSink,
@@ -105,7 +105,7 @@ pub type ConnectMeta = tls::ConnectMeta<Local<ClientAddr>>;
105105
impl Outbound<()> {
106106
pub fn new(config: Config, runtime: ProxyRuntime) -> Self {
107107
let runtime = Runtime {
108-
metrics: Metrics::new(runtime.metrics),
108+
metrics: OutboundMetrics::new(runtime.metrics),
109109
identity: runtime.identity.new_client(),
110110
tap: runtime.tap,
111111
span_sink: runtime.span_sink,
@@ -156,7 +156,7 @@ impl<S> Outbound<S> {
156156
&mut self.config
157157
}
158158

159-
pub fn metrics(&self) -> Metrics {
159+
pub fn metrics(&self) -> OutboundMetrics {
160160
self.runtime.metrics.clone()
161161
}
162162

linkerd/app/outbound/src/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use linkerd_app_core::metrics::*;
1414

1515
/// Holds outbound proxy metrics.
1616
#[derive(Clone, Debug)]
17-
pub struct Metrics {
17+
pub struct OutboundMetrics {
1818
pub(crate) http_errors: error::Http,
1919
pub(crate) tcp_errors: error::Tcp,
2020

@@ -23,7 +23,7 @@ pub struct Metrics {
2323
pub(crate) proxy: Proxy,
2424
}
2525

26-
impl Metrics {
26+
impl OutboundMetrics {
2727
pub(crate) fn new(proxy: Proxy) -> Self {
2828
Self {
2929
http_errors: error::Http::default(),
@@ -33,7 +33,7 @@ impl Metrics {
3333
}
3434
}
3535

36-
impl FmtMetrics for Metrics {
36+
impl FmtMetrics for OutboundMetrics {
3737
fn fmt_metrics(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3838
self.http_errors.fmt_metrics(f)?;
3939
self.tcp_errors.fmt_metrics(f)?;

0 commit comments

Comments
 (0)