Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
a3f7a39f
Unverified
Commit
a3f7a39f
authored
Aug 07, 2025
by
Graham King
Committed by
GitHub
Aug 07, 2025
Browse files
chore(metrics): Remove the Arc (#2357)
parent
bd4fe1a7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
163 deletions
+51
-163
lib/runtime/examples/Cargo.lock
lib/runtime/examples/Cargo.lock
+23
-110
lib/runtime/examples/system_metrics/Cargo.toml
lib/runtime/examples/system_metrics/Cargo.toml
+1
-12
lib/runtime/examples/system_metrics/src/lib.rs
lib/runtime/examples/system_metrics/src/lib.rs
+4
-18
lib/runtime/src/metrics.rs
lib/runtime/src/metrics.rs
+10
-10
lib/runtime/src/metrics_server.rs
lib/runtime/src/metrics_server.rs
+1
-1
lib/runtime/src/pipeline/network/ingress/push_handler.rs
lib/runtime/src/pipeline/network/ingress/push_handler.rs
+12
-12
No files found.
lib/runtime/examples/Cargo.lock
View file @
a3f7a39f
...
@@ -175,40 +175,13 @@ version = "1.4.0"
...
@@ -175,40 +175,13 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "axum"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
dependencies = [
"async-trait",
"axum-core 0.4.5",
"bytes",
"futures-util",
"http",
"http-body",
"http-body-util",
"itoa",
"matchit 0.7.3",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tower 0.5.2",
"tower-layer",
"tower-service",
]
[[package]]
[[package]]
name = "axum"
name = "axum"
version = "0.8.4"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
dependencies = [
dependencies = [
"axum-core
0.5.2
",
"axum-core",
"bytes",
"bytes",
"form_urlencoded",
"form_urlencoded",
"futures-util",
"futures-util",
...
@@ -218,7 +191,7 @@ dependencies = [
...
@@ -218,7 +191,7 @@ dependencies = [
"hyper",
"hyper",
"hyper-util",
"hyper-util",
"itoa",
"itoa",
"matchit
0.8.4
",
"matchit",
"memchr",
"memchr",
"mime",
"mime",
"percent-encoding",
"percent-encoding",
...
@@ -230,32 +203,12 @@ dependencies = [
...
@@ -230,32 +203,12 @@ dependencies = [
"serde_urlencoded",
"serde_urlencoded",
"sync_wrapper",
"sync_wrapper",
"tokio",
"tokio",
"tower
0.5.2
",
"tower",
"tower-layer",
"tower-layer",
"tower-service",
"tower-service",
"tracing",
"tracing",
]
]
[[package]]
name = "axum-core"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http",
"http-body",
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper",
"tower-layer",
"tower-service",
]
[[package]]
[[package]]
name = "axum-core"
name = "axum-core"
version = "0.5.2"
version = "0.5.2"
...
@@ -692,7 +645,7 @@ dependencies = [
...
@@ -692,7 +645,7 @@ dependencies = [
"async-stream",
"async-stream",
"async-trait",
"async-trait",
"async_zmq",
"async_zmq",
"axum
0.8.4
",
"axum",
"blake3",
"blake3",
"bytes",
"bytes",
"chrono",
"chrono",
...
@@ -809,9 +762,9 @@ dependencies = [
...
@@ -809,9 +762,9 @@ dependencies = [
[[package]]
[[package]]
name = "etcd-client"
name = "etcd-client"
version = "0.1
4
.1"
version = "0.1
6
.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
fc0452bcc559431b16f472b7ab86e2f9ccd5f3c2da3795afbd6b773665e047fe
"
checksum = "
88365f1a5671eb2f7fc240adb216786bc6494b38ce15f1d26ad6eaa303d5e822
"
dependencies = [
dependencies = [
"http",
"http",
"prost",
"prost",
...
@@ -819,7 +772,7 @@ dependencies = [
...
@@ -819,7 +772,7 @@ dependencies = [
"tokio-stream",
"tokio-stream",
"tonic",
"tonic",
"tonic-build",
"tonic-build",
"tower
0.4.13
",
"tower",
"tower-service",
"tower-service",
]
]
...
@@ -1033,19 +986,13 @@ dependencies = [
...
@@ -1033,19 +986,13 @@ dependencies = [
"futures-core",
"futures-core",
"futures-sink",
"futures-sink",
"http",
"http",
"indexmap
2.9.0
",
"indexmap",
"slab",
"slab",
"tokio",
"tokio",
"tokio-util",
"tokio-util",
"tracing",
"tracing",
]
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
[[package]]
name = "hashbrown"
name = "hashbrown"
version = "0.15.2"
version = "0.15.2"
...
@@ -1361,16 +1308,6 @@ dependencies = [
...
@@ -1361,16 +1308,6 @@ dependencies = [
"icu_properties",
"icu_properties",
]
]
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
]
[[package]]
[[package]]
name = "indexmap"
name = "indexmap"
version = "2.9.0"
version = "2.9.0"
...
@@ -1378,7 +1315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
...
@@ -1378,7 +1315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
dependencies = [
dependencies = [
"equivalent",
"equivalent",
"hashbrown
0.15.2
",
"hashbrown",
]
]
[[package]]
[[package]]
...
@@ -1534,12 +1471,6 @@ dependencies = [
...
@@ -1534,12 +1471,6 @@ dependencies = [
"regex-automata 0.1.10",
"regex-automata 0.1.10",
]
]
[[package]]
name = "matchit"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
[[package]]
name = "matchit"
name = "matchit"
version = "0.8.4"
version = "0.8.4"
...
@@ -1827,7 +1758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
...
@@ -1827,7 +1758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772"
checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772"
dependencies = [
dependencies = [
"fixedbitset",
"fixedbitset",
"indexmap
2.9.0
",
"indexmap",
]
]
[[package]]
[[package]]
...
@@ -2272,7 +2203,7 @@ dependencies = [
...
@@ -2272,7 +2203,7 @@ dependencies = [
"tokio",
"tokio",
"tokio-rustls",
"tokio-rustls",
"tokio-util",
"tokio-util",
"tower
0.5.2
",
"tower",
"tower-http",
"tower-http",
"tower-service",
"tower-service",
"url",
"url",
...
@@ -2726,6 +2657,7 @@ dependencies = [
...
@@ -2726,6 +2657,7 @@ dependencies = [
name = "system_metrics"
name = "system_metrics"
version = "0.4.0"
version = "0.4.0"
dependencies = [
dependencies = [
"anyhow",
"dynamo-runtime",
"dynamo-runtime",
"futures",
"futures",
"prometheus",
"prometheus",
...
@@ -2988,7 +2920,7 @@ version = "0.22.25"
...
@@ -2988,7 +2920,7 @@ version = "0.22.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10558ed0bd2a1562e630926a2d1f0b98c827da99fabd3fe20920a59642504485"
checksum = "10558ed0bd2a1562e630926a2d1f0b98c827da99fabd3fe20920a59642504485"
dependencies = [
dependencies = [
"indexmap
2.9.0
",
"indexmap",
"serde",
"serde",
"serde_spanned",
"serde_spanned",
"toml_datetime",
"toml_datetime",
...
@@ -3004,13 +2936,12 @@ checksum = "28391a4201ba7eb1984cfeb6862c0b3ea2cfe23332298967c749dddc0d6cd976"
...
@@ -3004,13 +2936,12 @@ checksum = "28391a4201ba7eb1984cfeb6862c0b3ea2cfe23332298967c749dddc0d6cd976"
[[package]]
[[package]]
name = "tonic"
name = "tonic"
version = "0.1
2.3
"
version = "0.1
3.1
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
877c5b330756d856ffcc4
55
3
ab
34a5684481ade925ecc54bcd1bf02b1d0d4d52
"
checksum = "
7e581ba15a835f4d9ea06c
55ab
1bd4dce26fc53752c69a04aac00703bfb49ba9
"
dependencies = [
dependencies = [
"async-stream",
"async-trait",
"async-trait",
"axum
0.7.9
",
"axum",
"base64",
"base64",
"bytes",
"bytes",
"h2",
"h2",
...
@@ -3023,12 +2954,11 @@ dependencies = [
...
@@ -3023,12 +2954,11 @@ dependencies = [
"percent-encoding",
"percent-encoding",
"pin-project",
"pin-project",
"prost",
"prost",
"rustls-pemfile",
"socket2",
"socket2",
"tokio",
"tokio",
"tokio-rustls",
"tokio-rustls",
"tokio-stream",
"tokio-stream",
"tower
0.4.13
",
"tower",
"tower-layer",
"tower-layer",
"tower-service",
"tower-service",
"tracing",
"tracing",
...
@@ -3036,9 +2966,9 @@ dependencies = [
...
@@ -3036,9 +2966,9 @@ dependencies = [
[[package]]
[[package]]
name = "tonic-build"
name = "tonic-build"
version = "0.1
2.3
"
version = "0.1
3.1
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11
"
checksum = "
eac6f67be712d12f0b41328db3137e0d0757645d8904b4cb7d51cd9c2279e847
"
dependencies = [
dependencies = [
"prettyplease",
"prettyplease",
"proc-macro2",
"proc-macro2",
...
@@ -3048,26 +2978,6 @@ dependencies = [
...
@@ -3048,26 +2978,6 @@ dependencies = [
"syn 2.0.100",
"syn 2.0.100",
]
]
[[package]]
name = "tower"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
"indexmap 1.9.3",
"pin-project",
"pin-project-lite",
"rand 0.8.5",
"slab",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
[[package]]
name = "tower"
name = "tower"
version = "0.5.2"
version = "0.5.2"
...
@@ -3076,9 +2986,12 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
...
@@ -3076,9 +2986,12 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
dependencies = [
"futures-core",
"futures-core",
"futures-util",
"futures-util",
"indexmap",
"pin-project-lite",
"pin-project-lite",
"slab",
"sync_wrapper",
"sync_wrapper",
"tokio",
"tokio",
"tokio-util",
"tower-layer",
"tower-layer",
"tower-service",
"tower-service",
"tracing",
"tracing",
...
@@ -3097,7 +3010,7 @@ dependencies = [
...
@@ -3097,7 +3010,7 @@ dependencies = [
"http-body",
"http-body",
"iri-string",
"iri-string",
"pin-project-lite",
"pin-project-lite",
"tower
0.5.2
",
"tower",
"tower-layer",
"tower-layer",
"tower-service",
"tower-service",
]
]
...
...
lib/runtime/examples/system_metrics/Cargo.toml
View file @
a3f7a39f
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[package]
[package]
name
=
"system_metrics"
name
=
"system_metrics"
...
@@ -27,6 +15,7 @@ default = []
...
@@ -27,6 +15,7 @@ default = []
integration
=
[]
# Integration tests that require NATS
integration
=
[]
# Integration tests that require NATS
[dependencies]
[dependencies]
anyhow
=
"*"
dynamo-runtime
=
{
workspace
=
true
}
dynamo-runtime
=
{
workspace
=
true
}
# third-party
# third-party
...
...
lib/runtime/examples/system_metrics/src/lib.rs
View file @
a3f7a39f
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use
dynamo_runtime
::{
use
dynamo_runtime
::{
metrics
::
MetricsRegistry
,
metrics
::
MetricsRegistry
,
...
@@ -39,13 +27,11 @@ pub struct MyStats {
...
@@ -39,13 +27,11 @@ pub struct MyStats {
/// Custom metrics for system stats with data bytes tracking
/// Custom metrics for system stats with data bytes tracking
#[derive(Clone,
Debug)]
#[derive(Clone,
Debug)]
pub
struct
MySystemStatsMetrics
{
pub
struct
MySystemStatsMetrics
{
pub
data_bytes_processed
:
Arc
<
IntCounter
>
,
pub
data_bytes_processed
:
IntCounter
,
}
}
impl
MySystemStatsMetrics
{
impl
MySystemStatsMetrics
{
pub
fn
from_endpoint
(
pub
fn
from_endpoint
(
endpoint
:
&
dynamo_runtime
::
component
::
Endpoint
)
->
anyhow
::
Result
<
Self
>
{
endpoint
:
&
dynamo_runtime
::
component
::
Endpoint
,
)
->
Result
<
Self
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
let
data_bytes_processed
=
endpoint
.create_intcounter
(
let
data_bytes_processed
=
endpoint
.create_intcounter
(
"my_custom_bytes_processed_total"
,
"my_custom_bytes_processed_total"
,
"Example of a custom metric. Total number of data bytes processed by system handler"
,
"Example of a custom metric. Total number of data bytes processed by system handler"
,
...
@@ -60,7 +46,7 @@ impl MySystemStatsMetrics {
...
@@ -60,7 +46,7 @@ impl MySystemStatsMetrics {
#[derive(Clone)]
#[derive(Clone)]
pub
struct
RequestHandler
{
pub
struct
RequestHandler
{
metrics
:
Option
<
Arc
<
MySystemStatsMetrics
>
>
,
metrics
:
Option
<
MySystemStatsMetrics
>
,
}
}
impl
RequestHandler
{
impl
RequestHandler
{
...
@@ -70,7 +56,7 @@ impl RequestHandler {
...
@@ -70,7 +56,7 @@ impl RequestHandler {
pub
fn
with_metrics
(
metrics
:
MySystemStatsMetrics
)
->
Arc
<
Self
>
{
pub
fn
with_metrics
(
metrics
:
MySystemStatsMetrics
)
->
Arc
<
Self
>
{
Arc
::
new
(
Self
{
Arc
::
new
(
Self
{
metrics
:
Some
(
Arc
::
new
(
metrics
)
)
,
metrics
:
Some
(
metrics
),
})
})
}
}
}
}
...
...
lib/runtime/src/metrics.rs
View file @
a3f7a39f
...
@@ -194,7 +194,7 @@ fn create_metric<T: PrometheusMetric, R: MetricsRegistry + ?Sized>(
...
@@ -194,7 +194,7 @@ fn create_metric<T: PrometheusMetric, R: MetricsRegistry + ?Sized>(
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
buckets
:
Option
<
Vec
<
f64
>>
,
buckets
:
Option
<
Vec
<
f64
>>
,
const_labels
:
Option
<&
[
&
str
]
>
,
const_labels
:
Option
<&
[
&
str
]
>
,
)
->
anyhow
::
Result
<
Arc
<
T
>
>
{
)
->
anyhow
::
Result
<
T
>
{
// Validate that user-provided labels don't have duplicate keys
// Validate that user-provided labels don't have duplicate keys
let
mut
seen_keys
=
std
::
collections
::
HashSet
::
new
();
let
mut
seen_keys
=
std
::
collections
::
HashSet
::
new
();
...
@@ -376,7 +376,7 @@ fn create_metric<T: PrometheusMetric, R: MetricsRegistry + ?Sized>(
...
@@ -376,7 +376,7 @@ fn create_metric<T: PrometheusMetric, R: MetricsRegistry + ?Sized>(
.register
(
collector
);
.register
(
collector
);
}
}
Ok
(
Arc
::
new
(
metric
)
)
Ok
(
metric
)
}
}
/// This trait should be implemented by all metric registries, including Prometheus, Envy, OpenTelemetry, and others.
/// This trait should be implemented by all metric registries, including Prometheus, Envy, OpenTelemetry, and others.
...
@@ -423,7 +423,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -423,7 +423,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
name
:
&
str
,
name
:
&
str
,
description
:
&
str
,
description
:
&
str
,
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
Counter
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
Counter
>
{
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
}
}
...
@@ -434,7 +434,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -434,7 +434,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
description
:
&
str
,
description
:
&
str
,
const_labels
:
&
[
&
str
],
const_labels
:
&
[
&
str
],
const_label_values
:
&
[(
&
str
,
&
str
)],
const_label_values
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
CounterVec
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
CounterVec
>
{
create_metric
(
create_metric
(
self
,
self
,
name
,
name
,
...
@@ -451,7 +451,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -451,7 +451,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
name
:
&
str
,
name
:
&
str
,
description
:
&
str
,
description
:
&
str
,
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
Gauge
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
Gauge
>
{
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
}
}
...
@@ -462,7 +462,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -462,7 +462,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
description
:
&
str
,
description
:
&
str
,
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
buckets
:
Option
<
Vec
<
f64
>>
,
buckets
:
Option
<
Vec
<
f64
>>
,
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
Histogram
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
Histogram
>
{
create_metric
(
self
,
name
,
description
,
labels
,
buckets
,
None
)
create_metric
(
self
,
name
,
description
,
labels
,
buckets
,
None
)
}
}
...
@@ -472,7 +472,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -472,7 +472,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
name
:
&
str
,
name
:
&
str
,
description
:
&
str
,
description
:
&
str
,
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
IntCounter
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
IntCounter
>
{
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
}
}
...
@@ -483,7 +483,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -483,7 +483,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
description
:
&
str
,
description
:
&
str
,
const_labels
:
&
[
&
str
],
const_labels
:
&
[
&
str
],
const_label_values
:
&
[(
&
str
,
&
str
)],
const_label_values
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
IntCounterVec
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
IntCounterVec
>
{
create_metric
(
create_metric
(
self
,
self
,
name
,
name
,
...
@@ -500,7 +500,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -500,7 +500,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
name
:
&
str
,
name
:
&
str
,
description
:
&
str
,
description
:
&
str
,
labels
:
&
[(
&
str
,
&
str
)],
labels
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
IntGauge
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
IntGauge
>
{
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
create_metric
(
self
,
name
,
description
,
labels
,
None
,
None
)
}
}
...
@@ -511,7 +511,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
...
@@ -511,7 +511,7 @@ pub trait MetricsRegistry: Send + Sync + crate::traits::DistributedRuntimeProvid
description
:
&
str
,
description
:
&
str
,
const_labels
:
&
[
&
str
],
const_labels
:
&
[
&
str
],
const_label_values
:
&
[(
&
str
,
&
str
)],
const_label_values
:
&
[(
&
str
,
&
str
)],
)
->
anyhow
::
Result
<
Arc
<
prometheus
::
IntGaugeVec
>
>
{
)
->
anyhow
::
Result
<
prometheus
::
IntGaugeVec
>
{
create_metric
(
create_metric
(
self
,
self
,
name
,
name
,
...
...
lib/runtime/src/metrics_server.rs
View file @
a3f7a39f
...
@@ -71,7 +71,7 @@ pub struct MetricsServerState {
...
@@ -71,7 +71,7 @@ pub struct MetricsServerState {
// global drt registry is for printing out the entire Prometheus format output
// global drt registry is for printing out the entire Prometheus format output
root_drt
:
Arc
<
crate
::
DistributedRuntime
>
,
root_drt
:
Arc
<
crate
::
DistributedRuntime
>
,
start_time
:
OnceLock
<
Instant
>
,
start_time
:
OnceLock
<
Instant
>
,
uptime_gauge
:
Arc
<
prometheus
::
Gauge
>
,
uptime_gauge
:
prometheus
::
Gauge
,
}
}
impl
MetricsServerState
{
impl
MetricsServerState
{
...
...
lib/runtime/src/pipeline/network/ingress/push_handler.rs
View file @
a3f7a39f
...
@@ -24,22 +24,22 @@ use tracing::Instrument;
...
@@ -24,22 +24,22 @@ use tracing::Instrument;
/// Metrics configuration for profiling work handlers
/// Metrics configuration for profiling work handlers
#[derive(Clone,
Debug)]
#[derive(Clone,
Debug)]
pub
struct
WorkHandlerMetrics
{
pub
struct
WorkHandlerMetrics
{
pub
request_counter
:
Arc
<
IntCounter
>
,
pub
request_counter
:
IntCounter
,
pub
request_duration
:
Arc
<
Histogram
>
,
pub
request_duration
:
Histogram
,
pub
concurrent_requests
:
Arc
<
IntGauge
>
,
pub
concurrent_requests
:
IntGauge
,
pub
request_bytes
:
Arc
<
IntCounter
>
,
pub
request_bytes
:
IntCounter
,
pub
response_bytes
:
Arc
<
IntCounter
>
,
pub
response_bytes
:
IntCounter
,
pub
error_counter
:
Arc
<
IntCounterVec
>
,
pub
error_counter
:
IntCounterVec
,
}
}
impl
WorkHandlerMetrics
{
impl
WorkHandlerMetrics
{
pub
fn
new
(
pub
fn
new
(
request_counter
:
Arc
<
IntCounter
>
,
request_counter
:
IntCounter
,
request_duration
:
Arc
<
Histogram
>
,
request_duration
:
Histogram
,
concurrent_requests
:
Arc
<
IntGauge
>
,
concurrent_requests
:
IntGauge
,
request_bytes
:
Arc
<
IntCounter
>
,
request_bytes
:
IntCounter
,
response_bytes
:
Arc
<
IntCounter
>
,
response_bytes
:
IntCounter
,
error_counter
:
Arc
<
IntCounterVec
>
,
error_counter
:
IntCounterVec
,
)
->
Self
{
)
->
Self
{
Self
{
Self
{
request_counter
,
request_counter
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment