oslo_reports.models package

Submodules

oslo_reports.models.base module

Provides the base report model

This module defines a class representing the basic report data model from which all data models should inherit (or at least implement similar functionality). Data models store unserialized data generated by generators during the report serialization process.

class oslo_reports.models.base.ReportModel(data=None, attached_view=None)

Bases: collections.abc.MutableMapping

A Report Data Model

A report data model contains data generated by some generator method or class. Data may be read or written using dictionary-style access, and may be read (but not written) using object-member-style access. Additionally, a data model may have an associated view. This view is used to serialize the model when str() is called on the model. An appropriate object for a view is callable with a single parameter: the model to be serialized.

If present, the object passed in as data will be transformed into a standard python dict. For mappings, this is fairly straightforward. For sequences, the indices become keys and the items become values.

Parameters
  • data – a sequence or mapping of data to associate with the model

  • attached_view – a view object to attach to this model

set_current_view_type(tp, visited=None)

Set the current view type

This method attempts to set the current view type for this model and all submodels by calling itself recursively on all values, traversing intervening sequences and mappings when possible, and ignoring all other objects.

Parameters
  • tp – the type of the view (‘text’, ‘json’, ‘xml’, etc)

  • visited – a set of object ids for which the corresponding objects have already had their view type set

oslo_reports.models.conf module

Provides OpenStack Configuration Model

This module defines a class representing the data model for oslo_config configuration options

class oslo_reports.models.conf.ConfigModel(conf_obj)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Configuration Options Model

This model holds data about a set of configuration options from oslo_config. It supports both the default group of options and named option groups.

Parameters

conf_obj (oslo_config.cfg.ConfigOpts) – a configuration object

oslo_reports.models.process module

Provides a process model

This module defines a class representing a process, potentially with subprocesses.

class oslo_reports.models.process.ProcessModel(process)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Process Model

This model holds data about a process, including references to any subprocesses

Parameters

process – a psutil.Process object

oslo_reports.models.threading module

Provides threading and stack-trace models

This module defines classes representing thread, green thread, and stack trace data models

class oslo_reports.models.threading.GreenThreadModel(stack)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Green Thread Model

This model holds data for information about an individual thread. Unlike the thread model, it holds just a stack trace, since green threads do not have thread ids.

See also

Class StackTraceModel

Parameters

stack – the python stack state for the green thread

class oslo_reports.models.threading.StackTraceModel(stack_state)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Stack Trace Model

This model holds data from a python stack trace, commonly extracted from running thread information

Parameters

stack_state – the python stack_state object

class oslo_reports.models.threading.ThreadModel(thread_id, stack)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Thread Model

This model holds data for information about an individual thread. It holds both a thread id, as well as a stack trace for the thread

See also

Class StackTraceModel

Parameters
  • thread_id (int) – the id of the thread

  • stack – the python stack state for the current thread

oslo_reports.models.version module

Provides OpenStack Version Info Model

This module defines a class representing the data model for OpenStack package and version information

class oslo_reports.models.version.PackageModel(vendor, product, version)

Bases: oslo_reports.models.with_default_views.ModelWithDefaultViews

A Package Information Model

This model holds information about the current package. It contains vendor, product, and version information.

Parameters
  • vendor (str) – the product vendor

  • product (str) – the product name

  • version (str) – the product version

oslo_reports.models.with_default_views module

class oslo_reports.models.with_default_views.ModelWithDefaultViews(*args, **kwargs)

Bases: oslo_reports.models.base.ReportModel

A Model With Default Views of Various Types

A model with default views has several predefined views, each associated with a given type. This is often used for when a submodel should have an attached view, but the view differs depending on the serialization format

Parameters are as the superclass, except for any parameters ending in ‘_view’: these parameters get stored as default views.

The default ‘default views’ are

text

oslo_reports.views.text.generic.KeyValueView

xml

oslo_reports.views.xml.generic.KeyValueView

json

oslo_reports.views.json.generic.KeyValueView

to_type()

(‘type’ is one of the ‘default views’ defined for this model) Serializes this model using the default view for ‘type’

Return type

str

Returns

this model serialized as ‘type’

set_current_view_type(tp, visited=None)

Set the current view type

This method attempts to set the current view type for this model and all submodels by calling itself recursively on all values, traversing intervening sequences and mappings when possible, and ignoring all other objects.

Parameters
  • tp – the type of the view (‘text’, ‘json’, ‘xml’, etc)

  • visited – a set of object ids for which the corresponding objects have already had their view type set

Module contents

Provides data models

This module provides both the base data model, as well as several predefined specific data models to be used in reports.