This RFC patch series introduces a framework to organize and
present OVS metrics in a generic way. The first implementation
generates Prometheus metrics. An ovs-exporter service is made
available as part of an OVS distribution, that serves the
generated metrics as a prometheus endpoint.

Motivation
----------

OVS exporters exist today in several implementations as
third-party projects.

There are issues with this approach:

  * The exposed metrics can differ between projects,
    making it more difficult to integrate those in
    dashboards and analysis tools.

  * Some projects assume that OVS runs the kernel
    datapath, creating friction (losing all or part
    of observability) when switching to the userspace
    datapath.

  * OVS developers are best suited to select the more
    relevant metrics for their users.

  * Introducing new metrics means integrating those several
    times in different exporter projects.

This framework aims to align metrics generation with OVS.

Proposed solution
-----------------

This proposal introduces a generic framework.
It should be powerful enough to integrate easily with different
OVS modules, able to describe the selected metrics and generic
enough to allow multiple data models.

To reach this target, this framework uses a tree representation
of metrics, in which intermediate nodes are used to describe the
structure of OVS modules, and leaves represents the metrics that
are emitted.

The intermediate nodes describe:

  * Subsystems
  * Collections
  * Conditionals
  * Labels

which are used to represent the structure of OVS modules,
e.g. collections of DPIF, collections of interfaces, conditional
access to hw-offload metrics, etc. Those nodes are interpreted into
their respective access patterns to the leaves that are linked to it.

Then leaves describe the emitted value types:

  * Counters (value only goes up)
  * Gauges (value varies up or down)
  * Histograms (Distribution of counters over pre-defined buckets)

Notably, those types are already existing today in OVS, this framework
only exposes them in a standard representation.

>From the prometheus data model, two types are missing which are
"summaries" and "info". Summaries consume a lot of resources to generate
(although using approximations can help) and were not implemented
until now in the native OVS metrics, so they were not made part of this
initial version of the framework. "Info" types are late additions to
the Prometheus model that will be implemented in the future.

Finally, the framework is used to emit metrics that are then served
by a new configurable service "ovs-exporter", distributed with OVS.

Path series
-----------

The series is organized in three steps:

  * Preparation work:

    Relevant types (histogram) are exposed to be broadly available,
    some counters are exposed to be usable by the framework.

  * Framework

    The library is added along with generic metrics implemented with it.
    Additional specialized metrics are added.

  * Exporter

    The ovs-exporter service is then introduced.

Gaetan Rivet (12):
  dpif-netdev-perf: Fix histogram initialization
  histogram: Refactor code to a standalone module
  histogram: Store sum of all measures
  util: Add safe u64 arithmetic operations
  ofproto: Add ofproto packet stats function
  ofproto: Add ofproto output packet stats
  netdev: Add netdev_get_policing
  dpdk: Add helper to access hugepage memory statistics.
  metrics: Introduce metrics framework.
  dpif-netdev: Add poll threads metrics
  coverage: Add metrics entries for all counters.
  ovs-exporter: Introduce an HTTP metrics server.

 Documentation/automake.mk                     |   2 +
 Documentation/conf.py                         |   4 +
 Documentation/ref/index.rst                   |   2 +
 Documentation/ref/ovs-exporter.8.rst          |  78 +++
 Documentation/ref/ovs-metrics.8.rst           |  56 ++
 debian/automake.mk                            |   2 +
 debian/openvswitch-switch.install             |   5 +
 debian/openvswitch-switch.ovs-exporter.conf   |   4 +
 .../openvswitch-switch.ovs-exporter.service   |  18 +
 debian/rules                                  |   2 +
 lib/automake.mk                               |  13 +
 lib/coverage-metrics.c                        |  65 +++
 lib/coverage-private.h                        |  31 ++
 lib/coverage.c                                |  10 +-
 lib/dpdk-stub.c                               |   8 +
 lib/dpdk.c                                    |  38 ++
 lib/dpdk.h                                    |   9 +
 lib/dpif-metrics.c                            | 112 ++++
 lib/dpif-metrics.h                            |  28 +
 lib/dpif-netdev-perf.c                        |  69 +--
 lib/dpif-netdev-perf.h                        |  31 +-
 lib/dpif-netdev.c                             | 249 +++++++++
 lib/dpif.c                                    |   2 +
 lib/dpif.h                                    |   1 +
 lib/histogram.c                               |  95 ++++
 lib/histogram.h                               |  66 +++
 lib/memory.c                                  | 132 +++++
 lib/metrics-array.c                           | 112 ++++
 lib/metrics-histogram.c                       | 134 +++++
 lib/metrics-private.h                         | 148 ++++++
 lib/metrics-unixctl.c                         | 105 ++++
 lib/metrics-visitor.c                         | 477 ++++++++++++++++++
 lib/metrics.c                                 | 300 +++++++++++
 lib/metrics.h                                 | 448 ++++++++++++++++
 lib/netdev-dpdk.c                             |  20 +
 lib/netdev-linux.c                            |  20 +
 lib/netdev-provider.h                         |   5 +
 lib/netdev.c                                  |  18 +
 lib/netdev.h                                  |   4 +
 lib/util.h                                    |  25 +
 ofproto/automake.mk                           |   3 +
 ofproto/ofproto-dpif-metrics.c                | 183 +++++++
 ofproto/ofproto-dpif-upcall.c                 | 121 +++++
 ofproto/ofproto-dpif.c                        |  11 +-
 ofproto/ofproto-dpif.h                        |   9 +
 ofproto/ofproto-metrics.c                     | 365 ++++++++++++++
 ofproto/ofproto-private.h                     |  20 +
 ofproto/ofproto-provider.h                    |  54 +-
 ofproto/ofproto.c                             | 110 +++-
 ofproto/ofproto.h                             |   2 +
 python/automake.mk                            |   1 +
 python/ovs/metrics.py                         | 184 +++++++
 python/ovs/util.py                            |  22 +
 python/setup.py.template                      |   2 +-
 rhel/automake.mk                              |   2 +
 rhel/etc_openvswitch_ovs-exporter.conf        |   4 +
 rhel/openvswitch-fedora.spec.in               |  11 +-
 rhel/openvswitch.spec.in                      |   2 +
 ...sr_lib_systemd_system_ovs-exporter.service |  18 +
 tests/automake.mk                             |   2 +
 tests/library.at                              |  14 +
 tests/test-histogram.c                        | 155 ++++++
 tests/test-metrics.c                          | 401 +++++++++++++++
 tests/test-util.c                             |  65 +++
 utilities/.gitignore                          |   2 +
 utilities/automake.mk                         |   6 +
 utilities/ovs-ctl.in                          |  22 +
 utilities/ovs-exporter.in                     | 216 ++++++++
 utilities/ovs-metrics.in                      | 328 ++++++++++++
 vswitchd/ovs-vswitchd.c                       |   3 +
 70 files changed, 5167 insertions(+), 119 deletions(-)
 create mode 100644 Documentation/ref/ovs-exporter.8.rst
 create mode 100644 Documentation/ref/ovs-metrics.8.rst
 create mode 100644 debian/openvswitch-switch.ovs-exporter.conf
 create mode 100644 debian/openvswitch-switch.ovs-exporter.service
 create mode 100644 lib/coverage-metrics.c
 create mode 100644 lib/coverage-private.h
 create mode 100644 lib/dpif-metrics.c
 create mode 100644 lib/dpif-metrics.h
 create mode 100644 lib/histogram.c
 create mode 100644 lib/histogram.h
 create mode 100644 lib/metrics-array.c
 create mode 100644 lib/metrics-histogram.c
 create mode 100644 lib/metrics-private.h
 create mode 100644 lib/metrics-unixctl.c
 create mode 100644 lib/metrics-visitor.c
 create mode 100644 lib/metrics.c
 create mode 100644 lib/metrics.h
 create mode 100644 ofproto/ofproto-dpif-metrics.c
 create mode 100644 ofproto/ofproto-metrics.c
 create mode 100644 ofproto/ofproto-private.h
 create mode 100644 python/ovs/metrics.py
 create mode 100644 rhel/etc_openvswitch_ovs-exporter.conf
 create mode 100644 rhel/usr_lib_systemd_system_ovs-exporter.service
 create mode 100644 tests/test-histogram.c
 create mode 100644 tests/test-metrics.c
 create mode 100755 utilities/ovs-exporter.in
 create mode 100755 utilities/ovs-metrics.in

--
2.34.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to