Skip to main content

STScI Metrics Logger

CI Powered by STScI Badge codecov

The metrics logger is a simple decorator intended to provide standardized logging for annotated pytest methods with tags to identify associated build requirements. As this is a generic utility, any method can be decorated and any type of tagging can be provided.

Log messages will follow a format that will provide:

  • METRIC - A static tag that will mark the beginning of the message.
  • Tags - A comma delimited list of the provided tags to the decorator.
  • Method - The decorated method name.
  • Result - FAIL if the method raises an exception and PASS otherwise.

The above will be delimited with a spaced hyphen: -

Note
Hyphens in the provided tags are supported.

Installation

The metrics_logger utility is not currently available in PyPi. To include it in a Conda environment, you can refer to it directly in your conda environment file in the pip section as follows:

dependencies:
  - pip
  - pip:
    metrics_logger https://github.com/spacetelescope/romancal.git

Development

metrics_logger development can be done with Conda.

Create and activate the environment

$ conda env create --file conda-env.yml
$ conda activate metrics-logger

Update the requirements

$ conda activate metrics-logger
$ conda env update --file conda-env.yml

Usage

Import the metrics_logger utility and insert it above the method to be annotated providing a list of tags as arguments. Each time the method is invoked, it will result in a log line being emitted to a logger named "metrics_logger".

Example:

from metrics_logger.decorators import metrics_logger

@metrics_logger('DMS86', 'DMS-129')
def test_some_functional_thing():
    assert True

Will result in the following log line (depending on log format):

2023-06-14 16:09:28,947 - stpipe - INFO - DMS86, DMS129 - test_some_functional_thing - PASS

Similarly:

@metrics_logger('DMS86', 'DMS-129')
def test_some_functional_thing():
    raise Exception("Oops!")

Will result in:

2023-06-14 16:10:09,221 - stpipe - INFO - DMS86, DMS129 - test_some_functional_thing - FAIL

Metadata

Release files for metrics-logger 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metrics-logger 0.1.0
File Size Uploaded Provenance Actions
metrics_logger-0.1.0.tar.gz 4.8 kB Without provenance Details for metrics_logger-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metrics-logger 0.1.0
File Interpreter ABI Platform Actions
metrics_logger-0.1.0-py3-none-any.whl Python 3 none any Details for metrics_logger-0.1.0-py3-none-any.whl

Total release size: 8.4 kB

Release files / metrics_logger-0.1.0.tar.gz

Download URL metrics_logger-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
02729240858639ccee404eb707782979d6b2b961bd0885be8411f5b31e0031bb
BLAKE2b-256 checksum
How to use checksums
37578178414e1fdfd68c0c41ed3de1b8b33345f951c4553c3505bd2eb38a5f9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / metrics_logger-0.1.0-py3-none-any.whl

Download URL metrics_logger-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9087d29f73620eeedf8acc0cee087c20cad6a12d317338e61bdddaf23a868f5
BLAKE2b-256 checksum
How to use checksums
10a283e243cab868279af8f46f7bc0ad41e1734768a281402c5bd9abaf00f21f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for metrics-logger 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page