{"id":27858428,"url":"https://github.com/roboplc/metrics-exporter-scope","last_synced_at":"2025-08-26T20:06:49.200Z","repository":{"id":254336395,"uuid":"846205936","full_name":"roboplc/metrics-exporter-scope","owner":"roboplc","description":"An oscilloscope for the Rust metrics ecosystem","archived":false,"fork":false,"pushed_at":"2024-11-10T20:04:01.000Z","size":2071,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T14:09:57.560Z","etag":null,"topics":["metrics","real-time","rust"],"latest_commit_sha":null,"homepage":"https://www.roboplc.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roboplc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-22T18:23:54.000Z","updated_at":"2024-11-10T20:04:05.000Z","dependencies_parsed_at":"2024-10-17T10:14:33.680Z","dependency_job_id":null,"html_url":"https://github.com/roboplc/metrics-exporter-scope","commit_stats":null,"previous_names":["roboplc/metrics-exporter-scope"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Fmetrics-exporter-scope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Fmetrics-exporter-scope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Fmetrics-exporter-scope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboplc%2Fmetrics-exporter-scope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roboplc","download_url":"https://codeload.github.com/roboplc/metrics-exporter-scope/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252344577,"owners_count":21732981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","real-time","rust"],"created_at":"2025-05-04T14:10:01.646Z","updated_at":"2025-05-04T14:10:02.222Z","avatar_url":"https://github.com/roboplc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2\u003e\n  metrics-exporter-scope\n  \u003ca href=\"https://crates.io/crates/metrics-exporter-scope\"\u003e\u003cimg alt=\"crates.io page\" src=\"https://img.shields.io/crates/v/metrics-exporter-scope.svg\"\u003e\u003c/img\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.rs/metrics-exporter-scope\"\u003e\u003cimg alt=\"docs.rs page\" src=\"https://docs.rs/metrics-exporter-scope/badge.svg\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003c/h2\u003e\n\nAn oscilloscope for the Rust [metrics\necosystem](https://github.com/metrics-rs/metrics).\n\n# Introduction\n\n`metrics-exporter-scope` is an exporter for\n[metrics](https://crates.io/crates/metrics) which is designed to output\nfrequently changed metrics as snapshots. The functionality pretty is similar to\na classic oscilloscope and use cases are similar as well: the crate is\ndeveloped to sample metrics with high (1Hz+) frequencies and is mostly used to\ndisplay real-time data from embedded systems, industrial automation\ncontrollers, robotics, network devices, etc.\n\n\u003cimg src=\"https://raw.githubusercontent.com/roboplc/metrics-exporter-scope/main/scope.gif\"\nwidth=\"400\" /\u003e\n\n`metrics-exporter-scope` is a part of the [RoboPLC](https://roboplc.com)\nproject.\n\n## Usage\n\n### Setup\n\nInstalling the exporter with the default settings (binds to `0.0.0.0:5001`):\n\n```rust,no_run\nmetrics_exporter_scope::ScopeBuilder::new().install().unwrap();\n```\n\n### Defining metrics\n\n**The exporter works with `Gauge` metrics only**.\n\nThe crate is designed as a secondary metrics exporter, all scope-metrics, must\nbe prefixed with `~` char. Metrics without the prefix are either ignored or\nexported by the primary program exporter.\n\n```rust,no_run\nuse metrics::gauge;\n\ngauge!(\"~my_metric\").set(42.0);\n```\n\n### Metric labels\n\nMetrics can have additional labels, some are used by the client program to\nconfigure plots using `plot` label key.\n\n```rust,no_run\nuse metrics::gauge;\n\ngauge!(\"~my_metric\", \"plot\" =\u003e \"plot1\").set(42.0);\ngauge!(\"~my_metric2\", \"plot\" =\u003e \"plot1\").set(42.0);\n```\n\nThe above example groups two metrics into the same plot.\n\n### Metric colors\n\n`color` label key is used as a hint for the client program to set the color of\na plot line the metric is associated with.\n\n```rust,no_run\nuse metrics::gauge;\n\ngauge!(\"~my_metric\", \"color\" =\u003e \"blue\").set(42.0);\ngauge!(\"~my_metric2\", \"color\" =\u003e \"#99ccff\").set(42.0);\n```\n\nColors, supported by the client program are: `red`, `green`, `blue`, `yellow`,\n`cyan`, `magenta`, `orange`, `white`, `black`. A color also can be set as a\nRGB, using either `#RRGGBB` or `#RGB` format.\n\n### Falling back to the primary exporter\n\nIf a metric is not prefixed with `~`, it is processed by the primary exporter.\n\n```rust,ignore\nlet primary_recorder = SomePrimaryMetricsRecorder::new().build();\n\nmetrics_exporter_scope::ScopeBuilder::new()\n    .with_fallback(Box::new(primary_recorder))\n    .install()\n    .unwrap();\n```\n\nA fall-back example can be found in\n[examples/with-fallback.rs](https://github.com/roboplc/metrics-exporter-scope/blob/main/examples/with-fallback.rs).\n\n## Client installation\n\nThe repository contains a client implementation for the oscilloscope, which is\navailable for all major desktop platforms:\n\n```shell\ncargo install metrics-scope\n```\n\nClient features:\n\n* Real-time data visualization\n\n* Multiple metrics support\n\n* Simple moving averages\n\n* Triggers\n\nNavigation:\n\n* `L` - toggle chart legends\n\n* `F5` - reset chart views and clear active trigger events\n\n* `P` - pause/resume chart updates\n\n* `Mouse click + drag` - move chart view (X-axis is moved for all charts)\n\n* `Ctrl + mouse wheel` - zoom charts in/out\n\n* `Mouse double click` - reset chart view\n\n## Real-time safety\n\nThe exporter does not contain any locks and is safe to be used in real-time\nprograms. It is recommended to install the server in a dedicated thread.\n\n## MSRV\n\nBy default, the crate supports the latest `metrics` version, follow the\n[metrics README](https://github.com/metrics-rs/metrics) for the actual minimum\nsupported Rust version details.\n\nThe crate also can be built to support MSRV 1.68.0, by disabling the default\nfeatures and enabling the `msrv` feature:\n\n```toml\n[dependencies]\nmetrics-exporter-scope = { version = \"0.1\", default-features = false, features = [\"msrv\"] }\n```\n\nIf set, `metrics` version 0.22 is used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboplc%2Fmetrics-exporter-scope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froboplc%2Fmetrics-exporter-scope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboplc%2Fmetrics-exporter-scope/lists"}