-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prometheus metrics to resource cache (#1774)
* Add prometheus metrics to resource cache * Make resource cache tests more consistent when running single threaded
- Loading branch information
1 parent
617596f
commit f930a08
Showing
8 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (C) 2021 Bosutech XXI S.L. | ||
// | ||
// nucliadb is offered under the AGPL v3.0 and as commercial software. | ||
// For commercial licensing, contact us at [email protected]. | ||
// | ||
// AGPL: | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use prometheus_client::metrics::counter::Counter; | ||
use prometheus_client::metrics::family::Family; | ||
use prometheus_client::metrics::gauge::Gauge; | ||
use prometheus_client::registry::Registry; | ||
|
||
pub type OpenShardsMetric = Family<(), Gauge>; | ||
|
||
pub fn register_open_shards_metric(registry: &mut Registry) -> OpenShardsMetric { | ||
let open_shards = OpenShardsMetric::default(); | ||
registry.register( | ||
"nucliadb_shard_cache_open", | ||
"Open shards", | ||
open_shards.clone(), | ||
); | ||
open_shards | ||
} | ||
|
||
pub type EvictedShardsMetric = Family<(), Counter>; | ||
|
||
pub fn register_evicted_shards_metric(registry: &mut Registry) -> EvictedShardsMetric { | ||
let evicted_shards = EvictedShardsMetric::default(); | ||
registry.register( | ||
"nucliadb_shard_cache_evicted", | ||
"Evicted shards", | ||
evicted_shards.clone(), | ||
); | ||
evicted_shards | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f930a08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error
12967.225074848006
iter/sec (stddev: 2.2817610124921905e-7
)13028.533525895236
iter/sec (stddev: 4.192637045977425e-7
)1.00
This comment was automatically generated by workflow using github-action-benchmark.
f930a08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error
12888.267496857517
iter/sec (stddev: 5.867173056171454e-7
)13028.533525895236
iter/sec (stddev: 4.192637045977425e-7
)1.01
This comment was automatically generated by workflow using github-action-benchmark.
f930a08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error
13149.090243804827
iter/sec (stddev: 8.766350580772966e-7
)13028.533525895236
iter/sec (stddev: 4.192637045977425e-7
)0.99
This comment was automatically generated by workflow using github-action-benchmark.