Skip to content

Commit

Permalink
export prom metrics from the printer (#121)
Browse files Browse the repository at this point in the history
add in prom metrics to export machine information where available
  • Loading branch information
paultag authored Oct 9, 2024
1 parent 6d2dcae commit bb55940
Show file tree
Hide file tree
Showing 13 changed files with 285 additions and 63 deletions.
109 changes: 65 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ multer = { version = "3.1.0", features = ["json"] }
opentelemetry = "0.25.0"
opentelemetry-otlp = "0.25.0"
opentelemetry_sdk = { version = "0.25.0", features = ["rt-tokio"] }
prometheus-client = "0.22.3"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
schemars = { version = "0.8", features = ["chrono", "uuid1", "bigdecimal"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions moonraker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub use print::InfoResponse;
pub use upload::{DeleteResponse, DeleteResponseItem, UploadResponse, UploadResponseItem};

/// Client is a moonraker instance which can accept gcode for printing.
#[derive(Clone, Debug, PartialEq)]
pub struct Client {
pub(crate) url_base: String,
}
Expand Down
4 changes: 4 additions & 0 deletions openapi/api-tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
API operations found with tag "hidden"
OPERATION ID URL PATH
get_metrics /metrics

API operations found with tag "machines"
OPERATION ID URL PATH
get_machine /machines/{id}
Expand Down
35 changes: 35 additions & 0 deletions openapi/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,34 @@
]
}
},
"/metrics": {
"get": {
"operationId": "get_metrics",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"title": "String",
"type": "string"
}
}
},
"description": "successful operation"
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
},
"summary": "List available machines and their statuses",
"tags": [
"hidden"
]
}
},
"/ping": {
"get": {
"operationId": "ping",
Expand Down Expand Up @@ -492,6 +520,13 @@
}
},
"tags": [
{
"description": "Hidden API endpoints that should not show up in the docs.",
"externalDocs": {
"url": "https://docs.zoo.dev/api/machines"
},
"name": "hidden"
},
{
"description": "Utilities for making parts and discovering machines.",
"externalDocs": {
Expand Down
6 changes: 6 additions & 0 deletions openapi/tag-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"external_docs": {
"url": "https://docs.zoo.dev/api/machines"
}
},
"hidden": {
"description": "Hidden API endpoints that should not show up in the docs.",
"external_docs": {
"url": "https://docs.zoo.dev/api/machines"
}
}
}
}
Loading

0 comments on commit bb55940

Please sign in to comment.