Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
aa64eb85
Commit
aa64eb85
authored
Jun 24, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sanity checks for user-defined bucket settings
parent
f5948795
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
libcaf_core/caf/telemetry/histogram.hpp
libcaf_core/caf/telemetry/histogram.hpp
+5
-0
libcaf_core/caf/telemetry/metric_registry.hpp
libcaf_core/caf/telemetry/metric_registry.hpp
+14
-5
No files found.
libcaf_core/caf/telemetry/histogram.hpp
View file @
aa64eb85
...
...
@@ -129,6 +129,11 @@ private:
for
(
const
auto
&
lbl
:
labels
)
{
if
(
auto
ptr
=
get_if
<
settings
>
(
cfg
,
lbl
.
str
()))
{
if
(
auto
bounds
=
get_if
<
std
::
vector
<
value_type
>>
(
ptr
,
"buckets"
))
{
std
::
sort
(
bounds
->
begin
(),
bounds
->
end
());
bounds
->
erase
(
std
::
unique
(
bounds
->
begin
(),
bounds
->
end
()),
bounds
->
end
());
if
(
bounds
->
empty
())
return
false
;
init_buckets
(
*
bounds
);
return
true
;
}
...
...
libcaf_core/caf/telemetry/metric_registry.hpp
View file @
aa64eb85
...
...
@@ -18,6 +18,7 @@
#pragma once
#include <algorithm>
#include <initializer_list>
#include <map>
#include <memory>
...
...
@@ -362,11 +363,19 @@ public:
}
const
settings
*
sub_settings
=
nullptr
;
upper_bounds_list
upper_bounds
;
if
(
config_
!=
nullptr
)
if
(
auto
grp
=
get_if
<
settings
>
(
config_
,
prefix
))
if
(
sub_settings
=
get_if
<
settings
>
(
grp
,
name
);
sub_settings
!=
nullptr
)
if
(
auto
lst
=
get_if
<
upper_bounds_list
>
(
sub_settings
,
"buckets"
))
upper_bounds
=
std
::
move
(
*
lst
);
if
(
config_
!=
nullptr
)
{
if
(
auto
grp
=
get_if
<
settings
>
(
config_
,
prefix
))
{
if
(
sub_settings
=
get_if
<
settings
>
(
grp
,
name
);
sub_settings
!=
nullptr
)
{
if
(
auto
lst
=
get_if
<
upper_bounds_list
>
(
sub_settings
,
"buckets"
))
{
std
::
sort
(
lst
->
begin
(),
lst
->
end
());
lst
->
erase
(
std
::
unique
(
lst
->
begin
(),
lst
->
end
()),
lst
->
end
());
if
(
!
lst
->
empty
())
upper_bounds
=
std
::
move
(
*
lst
);
}
}
}
}
if
(
upper_bounds
.
empty
())
upper_bounds
.
assign
(
default_upper_bounds
.
begin
(),
default_upper_bounds
.
end
());
...
...
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