Add opt-in Prometheus metrics endpoint for connector health - #59
Merged
Conversation
leandropineda
force-pushed
the
feat/metrics-prom-otel
branch
from
April 30, 2026 20:34
eb9ff4a to
4b38e3b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in Prometheus metrics subsystem to the connector framework (via ConnectorConfig.metrics), including a /metrics HTTP endpoint plus Prometheus file_sd discovery output so host-side collectors can automatically find connector instances.
Changes:
- Introduces
MetricsConfiginConnectorConfigand wires framework-level OTEL/Prometheus setup + a metrics HTTP server into the connector lifecycle. - Adds framework health instruments (up/session connected/execution loop ticks+errors) and updates examples to demonstrate connector-specific metrics.
- Adds docs and deployment references (OTEL collector compose/config) and bumps
inorbit-edgedependency to include telemetry.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/test_models.py |
Adds unit tests for MetricsConfig defaults/validation and ConnectorConfig.metrics default. |
tests/test_metrics_setup.py |
Tests Prometheus meter provider setup behavior and resource attributes. |
tests/test_metrics_server.py |
Tests /metrics serving and file_sd discovery file lifecycle/atomic writes. |
tests/test_metrics_instruments.py |
Verifies framework instruments are exposed and callable. |
tests/test_connector_metrics.py |
Integration-ish test covering connector metrics server lifecycle and default-disabled behavior. |
pyproject.toml |
Bumps inorbit-edge dependency to include telemetry extras. |
inorbit_connector/models.py |
Adds MetricsConfig model and embeds it into ConnectorConfig. |
inorbit_connector/metrics/__init__.py |
Implements Prometheus/OTEL setup, metrics HTTP server + discovery writer, and framework instruments. |
inorbit_connector/connector.py |
Wires metrics setup/instruments into connector init + start/stop + execution loop counters. |
examples/robot-connector/robot.py |
Demonstrates domain metrics via with_counter_metric + error counters. |
examples/robot-connector/metrics.py |
Defines example robot connector meter + API request/error counters. |
examples/fleet-connector/metrics.py |
Defines example fleet connector meter + bulk API and per-robot fan-out counters. |
examples/fleet-connector/fleet_client.py |
Instruments fleet API wrapper methods and per-robot update counters. |
examples/example.yaml |
Adds metrics: config block example (robot connector). |
examples/example.fleet.yaml |
Adds metrics: config block example (fleet connector). |
examples/example.env |
Adds extra env vars used by examples. |
examples/README.md |
Documents how to run/scrape metrics from the examples. |
docs/sphinx/usage/metrics.md |
Adds Sphinx page that includes the metrics user guide content. |
docs/sphinx/usage/index.md |
Links the new Metrics page in Sphinx usage index. |
docs/deployment/otel-collector-config.yaml |
Reference OTEL collector config using Prometheus file_sd_configs. |
docs/deployment/otel-collector-compose.yaml |
Reference docker-compose for running an OTEL collector alongside connectors. |
docs/deployment/README.md |
Deployment guide for scraping/exporting connector metrics on a host. |
docs/contents/usage/metrics.md |
New end-user metrics guide (signals, config, cardinality guidance, examples). |
docs/contents/usage/index.md |
Adds Metrics link to docs usage index. |
docs/contents/index.md |
Adds Metrics entry to top-level docs index. |
docs/contents/configuration.md |
Documents ConnectorConfig.metrics and adds a MetricsConfig reference section. |
README.md |
Mentions optional Prometheus metrics as a built-in framework capability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b-Tomas
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This MR builds on top of inorbit-ai/edge-sdk-python#93
Adds an opt-in Prometheus metrics endpoint to the connector framework, gated by a new
MetricsConfigblock inConnectorConfig. When enabled, the connector exposes/metricsover HTTP and writes afile_sd-format discovery file so a host-side OTEL collector can find every connector on the host.Bumps
inorbit-edge[video,telemetry]>=2.1(uses the newsetup_prometheus_meter_provider,get_meter,with_counter_metricandattrs_from_selfhelpers from edge-sdk).What's included
inorbit-edge2.1.docs/deployment/.Demo
For example fleet connector:
For example robot connector: