oslometrics(1)

OSLOMETRICS(1) oslo.metrics OSLOMETRICS(1)

NAME

oslometrics - oslo.metrics 0.13.0

This Oslo metrics API supports collecting metrics data from other Oslo libraries and exposing the metrics data to monitoring system.

CONTENTS

Installation

At the command line:

$ pip install oslo.metrics


Contributing

If you would like to contribute to the development of OpenStack, you must follow the steps in this page:

https://docs.openstack.org/infra/manual/developers.html


Once those steps have been completed, changes to OpenStack should be submitted for review via the Gerrit tool, following the workflow documented at:

https://docs.openstack.org/infra/manual/developers.html#development-workflow


Pull requests submitted through GitHub will be ignored.

Bugs should be filed on Launchpad, not GitHub:

https://bugs.launchpad.net/oslo.metrics


oslo_metrics

oslo_metrics package

Subpackages

oslo_metrics.metrics package

Submodules

oslo_metrics.metrics.oslo_messaging module

Module contents

Submodules

oslo_metrics.message_router module

class oslo_metrics.message_router.MessageRouter
Bases: object
dispatch(metric)

process(raw_string)


oslo_metrics.message_type module

class oslo_metrics.message_type.Metric(module, name, action, **labels)
Bases: object
classmethod from_json(encoded)

to_json()


class oslo_metrics.message_type.MetricAction(action, value)
Bases: object
actions = ['inc', 'observe']

classmethod from_dict(metric_action_dict)

classmethod validate(metric_action_dict)


exception oslo_metrics.message_type.MetricValidationError(message=None)
Bases: Exception

exception oslo_metrics.message_type.UnSupportedMetricActionError(message=None)
Bases: Exception

Module contents

Using oslo.metrics

Usage

A simple example of oslo.metrics in use:

$ oslo-metrics
2020-06-11 15:59:53.459 5435 INFO oslo.metrics.__main__ [-] Start oslo.metrics


Testing with DevStack

This section describes how to test out oslo.metrics and collect oslo.messaging metric data using Devstack.

Download DevStack

$ git clone https://opendev.org/openstack/devstack
$ cd devstack


The devstack repo contains a script that installs OpenStack and templates for configuration files.

Create a local.conf

Create a local.conf file with four passwords preset at the root of the devstack git repo.

[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
LIBS_FROM_GIT=oslo.messaging
[[post-config|$NOVA_CONF]]
[oslo_messaging_metrics]
metrics_enabled = True


This is the minimum required config to get started with Devstack including oslo.metrics.

Start the install

$ ./stack.sh


This will take a 15 - 20 minutes, largely depending on the speed of your internet connection. Many git trees and packages will be installed during this process.

Start the Metrics Server

$ oslo-metrics


This command will start oslo.metrics server and start collecting oslo.messaging metrics sending from OpenStack services.

oslo.metrics exporter will serve on port 3000 by default.

Example Output

An example of oslo.metrics collecting metrics from Nova:

ubuntu@devstack:~/devstack$ oslo-metrics
2021-06-12 14:32:26.091 466289 INFO oslo.metrics.__main__ [-] Start oslo.metrics
2021-06-12 14:57:50.632 466289 DEBUG oslo.metrics.__main__ [-] wait for socket.recv serve /usr/local/lib/python3.8/dist-packages/oslo_metrics/__main__.py:73
2021-06-12 14:57:50.632 466289 DEBUG oslo.metrics.__main__ [-] got message serve /usr/local/lib/python3.8/dist-packages/oslo_metrics/__main__.py:76
2021-06-12 14:57:50.633 466289 INFO oslo.metrics.message_router [-] Get labels with rpc_client_processing_seconds: {'call_type': 'call', 'exchange': None, 'topic': 'conductor', 'namespace': 'baseapi', 'version': '1.0', 'server': None, 'fanout': None, 'method': 'ping', 'timeout': None, 'process': ''}
2021-06-12 14:57:50.633 466289 INFO oslo.metrics.message_router [-] Perform action observe for rpc_client_processing_seconds metrics
2021-06-12 14:57:50.633 466289 DEBUG oslo.metrics.__main__ [-] wait for socket.recv serve /usr/local/lib/python3.8/dist-packages/oslo_metrics/__main__.py:73
2021-06-12 14:57:50.633 466289 DEBUG oslo.metrics.__main__ [-] got message serve /usr/local/lib/python3.8/dist-packages/oslo_metrics/__main__.py:76
2021-06-12 14:57:50.633 466289 INFO oslo.metrics.message_router [-] Get labels with rpc_client_invocation_end_total: {'call_type': 'call', 'exchange': None, 'topic': 'conductor', 'namespace': 'baseapi', 'version': '1.0', 'server': None, 'fanout': None, 'method': 'ping', 'timeout': None, 'process': ''}
2021-06-12 14:57:50.633 466289 INFO oslo.metrics.message_router [-] Perform action inc for rpc_client_invocation_end_total metrics`


Gathering Metrics

To gather metrics from oslo.metrics, configure Prometheus to scrape from port 3000 where oslo.metrics is running.

CHANGES

0.13.0

add pyproject.toml to support pip 23.1

0.12.0

  • tox: Remove basepython
  • Update master for stable/2025.1
  • feat: add option to set chmod to socket

0.11.0

  • Skip installation to speed up pep8
  • Restore group permissions to unix socket file
  • Run pyupgrade to clean up Python 2 syntaxes
  • Introduce pre-commit

0.10.1

  • reno: Update master for unmaintained/2023.1
  • Set log level to debug when dispatching metrics

0.10.0

  • Add note about requirements lower bounds
  • Remove Python 3.8 support
  • Drop unnecessary 'x' bit from doc config file
  • Use PortOpt for prometheus_port
  • Declare Python 3.12 support
  • Update master for stable/2024.2

0.9.0

  • reno: Update master for unmaintained/zed
  • Remove old excludes
  • Update master for stable/2024.1
  • reno: Update master for unmaintained/xena
  • reno: Update master for unmaintained/wallaby

0.8.0

  • reno: Update master for unmaintained/yoga
  • Bump hacking
  • Update python classifier in setup.cfg
  • Update master for stable/2023.2

0.7.0

  • Bump bandit and make oslo.metrics compatible with latest rules
  • Revert "Moves supported python runtimes from version 3.8 to 3.10"
  • Moves supported python runtimes from version 3.8 to 3.10
  • Update master for stable/2023.1

0.6.0

  • Fix logging labales --> labels
  • Add Python3 antelope unit tests
  • Update master for stable/zed

0.5.0

  • Drop python3.6/3.7 support in testing runtime
  • Remove unnecessary unicode prefixes
  • Update master for stable/yoga

0.4.0

  • Limit metrics_socket_file permissions
  • Update master for stable/xena
  • Changed minversion in tox to 3.18.0

0.3.0

  • setup.cfg: Replace dashes with underscores
  • Enable Test Coverage and Add New Test
  • Fix Heading Characters
  • Enable bandit
  • Make Expose Port Configurable
  • Add Devstack Installation Guide
  • Use py3 as the default runtime for tox
  • Dropping lower constraints testing
  • Update master for stable/wallaby

0.2.1

Add timeout, method to RPC Client Label

0.2.0

  • Update Metric Naming
  • Handle Sigterm Properly

0.1.0

  • Improve Socket for oslo.metrics
  • bump py37 to py38 in tox.ini
  • Add basic tests for message processing
  • Add a basic test framework for oslo.metrics
  • Configure zuul
  • add lower-constraints
  • fix pep8 issues
  • Add releasenotes
  • Add project documentation
  • Setup base test environment
  • Add an entrypoints to launch oslo.metrics
  • Add a couple of gitignore rules
  • Sample oslo.metrics codes
  • Trivial change to test replication
  • Add date for expected initial code drop
  • Base content, waiting for initial code drop
  • Added .gitreview

RELEASE NOTES

Read also the oslo.metrics Release Notes.

INDICES AND TABLES

  • Index
  • Module Index
  • Search Page

AUTHOR

Author name not set

COPYRIGHT

2014, OpenStack Foundation

October 24, 2025 0.13.0