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
0f92232c
Commit
0f92232c
authored
Jul 02, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add changelog and manual entries for the metrics
parent
08603f37
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
24 deletions
+126
-24
CHANGELOG.md
CHANGELOG.md
+10
-0
manual/Metrics.rst
manual/Metrics.rst
+116
-24
No files found.
CHANGELOG.md
View file @
0f92232c
...
@@ -44,6 +44,10 @@ is based on [Keep a Changelog](https://keepachangelog.com).
...
@@ -44,6 +44,10 @@ is based on [Keep a Changelog](https://keepachangelog.com).
RFC4122-compliant
`uuid`
class.
RFC4122-compliant
`uuid`
class.
-
The new trait class
`is_error_code_enum`
allows users to enable conversion of
-
The new trait class
`is_error_code_enum`
allows users to enable conversion of
custom error code enums to
`error`
and
`error_code`
.
custom error code enums to
`error`
and
`error_code`
.
-
CAF now enables users to tap into internal CAF metrics as well as adding their
own instrumentation! Since this addition is too large to cover in a changelog
entry, please have a look at the new
*Metrics*
Section of the manual to learn
more.
### Deprecated
### Deprecated
...
@@ -112,6 +116,12 @@ is based on [Keep a Changelog](https://keepachangelog.com).
...
@@ -112,6 +116,12 @@ is based on [Keep a Changelog](https://keepachangelog.com).
example:
`typed_actor<result<double>(double)>`
. We have reimplemented the
example:
`typed_actor<result<double>(double)>`
. We have reimplemented the
metaprogramming facilities
`racts_to<...>`
and
`replies_to<...>::with<...>`
metaprogramming facilities
`racts_to<...>`
and
`replies_to<...>::with<...>`
as an alternative way of writing the function signature.
as an alternative way of writing the function signature.
-
The returned string of
`name()`
must not change during the lifetime of an
actor. Hence,
`stateful_actor`
now only considers static
`name`
members in its
`State`
for overriding this function. CAF always assumed names belonging to
*types*
, but did not enforce it because the name was only used for logging.
Since the new metrics use this name for filtering now, we enforce static names
in order to help avoid hard-to-find issues with the filtering mechanism.
### Removed
### Removed
...
...
manual/Metrics.rst
View file @
0f92232c
...
@@ -349,23 +349,24 @@ Configuration Parameters
...
@@ -349,23 +349,24 @@ Configuration Parameters
Histograms use the actor system configuration to enable users to override
Histograms use the actor system configuration to enable users to override
hard-coded default bucket settings. On construction, the histogram family check
hard-coded default bucket settings. On construction, the histogram family check
whether a key ``
metrics.${prefix}.${name}.buckets`` exists. Further, the metric
whether a key ``
caf.metrics.${prefix}.${name}.buckets`` exists. Further, the
instance also checks on construction whether a more specific bucket setting for
metric instance also checks on construction whether a more specific bucket
one of its label dimensions exist.
setting for
one of its label dimensions exist.
For example, consider we add a histogram family with prefix ``http``, name
For example, consider we add a histogram family with prefix ``http``, name
``request-duration``, and label dimension ``method`` to the registry. The family
``request-duration``, and label dimension ``method`` to the registry. The family
first tries to read ``metrics.http.request-duration.buckets`` from the
first tries to read ``
caf.
metrics.http.request-duration.buckets`` from the
configuration and otherwise falls back to the hard-coded defaults. When creating
configuration and otherwise falls back to the hard-coded defaults. When creating
a histogram instance from the family with the label ``method=put``, the
a histogram instance from the family with the label ``method=put``, the
construct first tries to read
construct first tries to read
``
metrics.http.request-duration.method=put.buckets`` from the configuration and
``
caf.metrics.http.request-duration.method=put.buckets`` from the configuration
otherwise uses the default for the family.
and
otherwise uses the default for the family.
In a configuration file, users may provide bucket settings like this:
In a configuration file, users may provide bucket settings like this:
.. code-block:: none
.. code-block:: none
caf {
metrics {
metrics {
http {
http {
# measures the duration per HTTP request in seconds
# measures the duration per HTTP request in seconds
...
@@ -392,6 +393,7 @@ In a configuration file, users may provide bucket settings like this:
...
@@ -392,6 +393,7 @@ In a configuration file, users may provide bucket settings like this:
}
}
}
}
}
}
}
.. note::
.. note::
...
@@ -448,3 +450,93 @@ caf.rejected-messages
...
@@ -448,3 +450,93 @@ caf.rejected-messages
was closed or did not exist.
was closed or did not exist.
- **Type**: ``int_counter``
- **Type**: ``int_counter``
- **Label dimensions**: none.
- **Label dimensions**: none.
Actor Metrics and Filters
~~~~~~~~~~~~~~~~~~~~~~~~~
Unlike the base metrics, actor metrics are *off* by default. Applications can
spawn thousands of actors, with many only existing for a brief time. Hence,
blindly collecting data from all actors in the system can impact the performance
and also produce a lot of irrelevant noise.
To make sure CAF only collects actor metrics that are relevant to the user, the
actor system configuration provides two lists:
``caf.metrics-filters.actors.includes`` and
``caf.metrics-filters.actors.excludes``. CAF collects metrics for all actors
that have names that are selected by the ``includes`` list and are not selected
by the ``excludes`` list. Entries in the list can use glob-style syntax, in
particular ``*``-wildcards. For example:
.. code-block:: none
caf {
metrics-filters {
actors {
includes = [ "foo.*" ]
excludes = [ "foo.bar" ]
}
}
}
The configuration above would select all actors with names that start with
``foo.`` except for actors named ``foo.bar``.
.. note::
Names belong to actor *types*. CAF assigns default names such as
``user.scheduled-actor`` by default. To provide a custom name, either override
the member function ``const char* name() const`` when implementing class-based
actors or add a *static* member variable
``static inline const char* name = "..."`` to your state class when using
stateful actors.
CAF uses a hierarchical, hyphenated naming scheme with ``.`` as the separator
and all-lowercase name components. For example, ``caf.system.spawn-server``.
Users may follow this naming scheme for consistency, but CAF does not enforce
any structure on the names. However, we do recommend to avoid whitespaces and
special characters that the glob engine recognizes, such as ``*``, ``/``, etc.
For all actors that are selected by the user-defined filters, CAF collects this
set of metrics:
caf.processing-time
- Samples how long the actor needs to process messages.
- **Type**: ``dbl_histogram``
- **Unit**: ``seconds``
- **Label dimensions**: name.
caf.mailbox-time
- Samples how long messages wait in the mailbox before being processed.
- **Type**: ``dbl_histogram``
- **Unit**: ``seconds``
- **Label dimensions**: name.
caf.mailbox-size
- Counts how many messages are currently waiting in the mailbox.
- **Type**: ``int_gauge``
- **Label dimensions**: name.
Exporting Metrics to Prometheus
-------------------------------
The network module in CAF comes with builtin support for exporting metrics to
Prometheus via HTTP. However, this feature is off by default since CAF generally
avoids opening ports without explicit user input.
During startup, the middleman enables the export of metrics when the
configuration provides a valid value (0 to 65536) for
``caf.middleman.prometheus-http.port`` as shown in the example config file
below.
.. code-block:: none
caf {
middleman {
prometheus-http {
# listen for incoming HTTP requests on port 8080 (required parameter)
port = 8080
# the bind address (optional parameter; default is 0.0.0.0)
address = "0.0.0.0"
}
}
}
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