hyperlane-plugin-metrics 23.3.2

A lock-free atomic Prometheus/OpenMetrics observability plugin for the Hyperlane framework with built-in HTTP request counters, in-flight gauges, latency histograms, custom user metric registration, and a scrapeable /metrics endpoint.
Documentation
<div align="center">

<img src="https://devhub.vip/pages/docs/img/hyperlane.png" alt="hyperlane-plugin-metrics logo" height="120">

# hyperlane-plugin-metrics

**Lock-Free Atomic Prometheus & OpenMetrics Observability Plugin**

[![Crates.io Version](https://flat.badgen.net/crates/v/hyperlane-plugin-metrics)](https://crates.io/crates/hyperlane-plugin-metrics)
[![Docs.rs](https://img.shields.io/docsrs/hyperlane-plugin-metrics?style=flat-square)](https://docs.rs/hyperlane-plugin-metrics)
[![CI Status](https://img.shields.io/github/actions/workflow/status/hyperlane-dev/hyperlane/rust.yml?branch=master&style=flat-square&label=CI)](https://github.com/hyperlane-dev/hyperlane/actions/workflows/rust.yml)
[![Rust 2024](https://img.shields.io/badge/edition-2024-orange.svg?style=flat-square)](https://www.rust-lang.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](../../LICENSE)

[Workspace Overview](../../README.md) · [Plugin Catalog](../README.md) · [API Docs](https://docs.rs/hyperlane-plugin-metrics/latest/)

</div>

---

## Overview

`hyperlane-plugin-metrics` instruments [`hyperlane`](../../README.md) servers with lock-free atomic HTTP request counters, in-flight gauges, latency histograms, and a Prometheus OpenMetrics `/metrics` scrape endpoint (hook order `-115` / `95`). It is opt-in and transparent (`Status::Continue`) when unconfigured.

## Installation

```sh
cargo add hyperlane-plugin-metrics
```

## Usage

```rust
use hyperlane_plugin_metrics::{MetricsConfig, MetricsPlugin};

fn setup_metrics() {
    MetricsPlugin::init(MetricsConfig::default());
}
```

## Verification

```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-metrics --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-metrics --all-features
```

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.

## Contact

For inquiries, please contact the author at [root@devhub.vip](mailto:root@devhub.vip).