diff --git a/Cargo.lock b/Cargo.lock index 4112bb2..25ac861 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,11 +17,26 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "ascii" @@ -42,9 +57,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -105,9 +120,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -121,9 +136,12 @@ version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ + "android-tzdata", + "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", + "windows-targets 0.52.5", ] [[package]] @@ -311,9 +329,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -541,6 +559,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.5.0" @@ -567,6 +608,15 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "iso8601" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924e5d73ea28f59011fec52a0d12185d496a9b075d360657aed2a5707f701153" +dependencies = [ + "nom", +] + [[package]] name = "itertools" version = "0.12.1" @@ -609,6 +659,16 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.21" @@ -633,6 +693,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.2" @@ -671,11 +737,21 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -849,6 +925,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "parking_lot" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.5", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -908,6 +1007,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prometheus" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "memchr", + "parking_lot", + "protobuf", + "thiserror", +] + [[package]] name = "prost" version = "0.12.4" @@ -931,6 +1045,12 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + [[package]] name = "quote" version = "1.0.36" @@ -970,6 +1090,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "reqwest" version = "0.12.4" @@ -1062,13 +1191,19 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "security-framework" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -1077,9 +1212,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -1309,16 +1444,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -1571,6 +1705,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.5", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -1786,18 +1939,21 @@ dependencies = [ name = "worker-rust" version = "0.1.0" dependencies = [ + "chrono", "getrandom", "graphql_client", - "http 0.2.12", + "iso8601", "opentelemetry", "opentelemetry-http", "opentelemetry-otlp", "opentelemetry-stdout", "opentelemetry_sdk", + "prometheus", "reqwest", "serde", "serde_json", "tokio", + "web-time", "worker", ] diff --git a/Cargo.toml b/Cargo.toml index 87073ab..b07df9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,11 @@ getrandom = { version = "0.2.14", features = ["js"] } serde_json = "1.0.116" opentelemetry-http = { version="0.11.1" } opentelemetry-otlp = { version="0.15.0", features = ["metrics", "http-proto"], default-features = false } -http = { version = "0.2.12"} tokio = { version = "1.37.0"} +prometheus = "0.13.4" +iso8601 = "0.6.1" +web-time = "1.1.0" +chrono = "0.4.38" [profile.release] opt-level = "s" # optimize for size in release builds diff --git a/features/o11y.feature b/features/o11y.feature index 237b836..c410e56 100644 --- a/features/o11y.feature +++ b/features/o11y.feature @@ -4,4 +4,7 @@ Feature: OpenTelemetry metrics Given Worker is configured to send metrics to a mock OpenTelemetry collector When Worker is triggered Then Worker metrics are published - And Meter name should include "cloudflare_worker_requests" + And Metric name should include "cloudflare_worker_requests" + And Metric name should include "cloudflare_worker_errors" + And Metric name should include "cloudflare_worker_cpu_time" + And Metric name should include "cloudflare_worker_duration" diff --git a/features/step_definitions/mf.ts b/features/step_definitions/mf.ts index 4d94deb..9b36bae 100644 --- a/features/step_definitions/mf.ts +++ b/features/step_definitions/mf.ts @@ -61,6 +61,7 @@ export class MiniflareDriver { METRICS_URL: self.config.metricsUrl, CLOUDFLARE_API_URL: self.config.cloudflareApiUrl, CLOUDFLARE_API_KEY: "fake-key", + CLOUDFLARE_ACCOUNT_ID: "1234", }, modulesRules: [ { type: "CompiledWasm", include: ["**/*.wasm"], fallthrough: true }, diff --git a/features/step_definitions/o11y_steps.ts b/features/step_definitions/o11y_steps.ts index 5b4c6c8..8113b3e 100644 --- a/features/step_definitions/o11y_steps.ts +++ b/features/step_definitions/o11y_steps.ts @@ -23,7 +23,7 @@ Then('Worker metrics are published', async function () { expect(metrics).to.have.length.gte(1); }); -Then('Meter name should include {string}', function (metricName: string) { +Then('Metric name should include {string}', function (metricName: string) { let metricNames = otelServer.getMetricNames(); expect(metricNames).to.include(metricName); }); diff --git a/features/step_definitions/worker_query_response.json b/features/step_definitions/worker_query_response.json index 78fee26..6a1e5a4 100644 --- a/features/step_definitions/worker_query_response.json +++ b/features/step_definitions/worker_query_response.json @@ -6,1538 +6,464 @@ "workersInvocationsAdaptive": [ { "dimensions": { - "datetime": "2024-05-04T03:21:35Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 165526, - "cpuTimeP99": 165526 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:29:14Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 898907, - "cpuTimeP99": 898907 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:48:47Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 450428, - "cpuTimeP99": 450428 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T19:21:47Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 10506, - "cpuTimeP99": 10506 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:29:10Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 51489, - "cpuTimeP99": 51489 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T01:16:40Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 41602, - "cpuTimeP99": 41602 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-05T00:18:38Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 61421, - "cpuTimeP99": 61421 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T01:32:25Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 10958, - "cpuTimeP99": 10958 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T19:27:35Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 6957, - "cpuTimeP99": 6957 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:47:12Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 28291, - "cpuTimeP99": 28291 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:38:18Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 982910, - "cpuTimeP99": 982910 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:20:58Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 1489675, - "cpuTimeP99": 1489675 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T18:21:05Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 77070, - "cpuTimeP99": 77070 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T06:03:05Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 1446354, - "cpuTimeP99": 1446354 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T01:54:02Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 6886, - "cpuTimeP99": 6886 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:17:59Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 32774, - "cpuTimeP99": 32774 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:30:44Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 627408, - "cpuTimeP99": 627408 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T18:47:09Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 297564, - "cpuTimeP99": 297564 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:11:17Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 51090, - "cpuTimeP99": 51090 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:15:06Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 93841, - "cpuTimeP99": 93841 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:13:33Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 6922, - "cpuTimeP99": 6922 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:33:43Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 16432, - "cpuTimeP99": 16432 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-05T00:18:38Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 59452, - "cpuTimeP99": 59452 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:31:45Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 36099, - "cpuTimeP99": 36099 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T00:38:26Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 138396, - "cpuTimeP99": 158794 - }, - "sum": { - "errors": 0, - "requests": 3, - "subrequests": 6 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T00:38:25Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 62623, - "cpuTimeP99": 178988 - }, - "sum": { - "errors": 0, - "requests": 4, - "subrequests": 8 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:31:22Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 93964, - "cpuTimeP99": 95268 - }, - "sum": { - "errors": 0, - "requests": 3, - "subrequests": 6 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:28:24Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 47871, - "cpuTimeP99": 56188 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:19:35Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 15387, - "cpuTimeP99": 15387 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T17:54:49Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 7257, - "cpuTimeP99": 7257 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:02:32Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 34366, - "cpuTimeP99": 34366 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:46:21Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 50044, - "cpuTimeP99": 50044 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T00:38:26Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 156131, - "cpuTimeP99": 186266 - }, - "sum": { - "errors": 0, - "requests": 3, - "subrequests": 6 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T06:16:39Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 1408137, - "cpuTimeP99": 1408137 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:18:33Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 8157, - "cpuTimeP99": 8157 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:02:32Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 74485, - "cpuTimeP99": 74485 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:08:33Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 45108, - "cpuTimeP99": 70148 - }, - "sum": { - "errors": 0, - "requests": 3, - "subrequests": 6 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:37:00Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 76439, - "cpuTimeP99": 76439 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T01:36:45Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 82318, - "cpuTimeP99": 82318 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:45:50Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 8693, - "cpuTimeP99": 8693 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T22:51:21Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 621412, - "cpuTimeP99": 621412 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T14:25:07Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 255212, - "cpuTimeP99": 255212 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T15:50:05Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 129441, - "cpuTimeP99": 129441 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:03:32Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 23571, - "cpuTimeP99": 112494 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T15:49:35Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 8868, - "cpuTimeP99": 8868 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:33:59Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 18181, - "cpuTimeP99": 134570 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:02:31Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 52181, - "cpuTimeP99": 84649 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T01:16:10Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 9179, - "cpuTimeP99": 9179 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:15:16Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 62549, - "cpuTimeP99": 62549 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:32:46Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 39876, - "cpuTimeP99": 39876 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T14:24:37Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 11857, - "cpuTimeP99": 11857 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:49:00Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 30898, - "cpuTimeP99": 80874 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-05T00:41:17Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 9161, - "cpuTimeP99": 9161 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T00:38:25Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 57761, - "cpuTimeP99": 180755 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T19:41:43Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:30Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 230358, - "cpuTimeP99": 454414 + "cpuTimeP50": 2825, + "cpuTimeP75": 2825, + "cpuTimeP99": 2825, + "cpuTimeP999": 2825, + "durationP50": 0.04516975, + "durationP75": 0.04516975, + "durationP99": 0.04516975, + "durationP999": 0.04516975 }, "sum": { + "duration": 0.04516975, "errors": 0, - "requests": 2, - "subrequests": 4 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:59:03Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:28Z", + "scriptName": "log-forwarder-worker-dev", "status": "success" }, "quantiles": { - "cpuTimeP50": 1459306, - "cpuTimeP99": 1459306 + "cpuTimeP50": 7230, + "cpuTimeP75": 14834, + "cpuTimeP99": 14834, + "cpuTimeP999": 14834, + "durationP50": 0.0338585, + "durationP75": 0.034270875, + "durationP99": 0.034270875, + "durationP999": 0.034270875 }, "sum": { + "duration": 0.06812937499999999, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 2 } }, { "dimensions": { - "datetime": "2024-05-04T05:29:07Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 35470, - "cpuTimeP99": 35470 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:11:25Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 30731, - "cpuTimeP99": 30731 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:21:44Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 648493, - "cpuTimeP99": 648493 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:14:09Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 24811, - "cpuTimeP99": 24811 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:02:31Z", - "scriptName": "my-worker", - "status": "success" - }, - "quantiles": { - "cpuTimeP50": 26317, - "cpuTimeP99": 26317 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:34:59Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:40Z", + "scriptName": "log-forwarder-worker-dev", "status": "success" }, "quantiles": { - "cpuTimeP50": 114328, - "cpuTimeP99": 114328 + "cpuTimeP50": 2652, + "cpuTimeP75": 8379, + "cpuTimeP99": 8379, + "cpuTimeP999": 8379, + "durationP50": 0.049094126, + "durationP75": 0.049181376, + "durationP99": 0.049181376, + "durationP999": 0.049181376 }, "sum": { + "duration": 0.09827549999999999, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 2 } }, { "dimensions": { - "datetime": "2024-05-04T04:01:54Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 41293, - "cpuTimeP99": 41293 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T19:28:05Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:16Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 264197, - "cpuTimeP99": 264197 + "cpuTimeP50": 5736, + "cpuTimeP75": 5736, + "cpuTimeP99": 5736, + "cpuTimeP999": 5736, + "durationP50": 0.0419345, + "durationP75": 0.0419345, + "durationP99": 0.0419345, + "durationP999": 0.0419345 }, "sum": { + "duration": 0.0419345, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T03:49:00Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:32Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 86689, - "cpuTimeP99": 458522 + "cpuTimeP50": 3164, + "cpuTimeP75": 3164, + "cpuTimeP99": 3164, + "cpuTimeP999": 3164, + "durationP50": 0.04303725, + "durationP75": 0.04303725, + "durationP99": 0.04303725, + "durationP999": 0.04303725 }, "sum": { + "duration": 0.04303725, "errors": 0, - "requests": 3, - "subrequests": 6 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T06:02:25Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:01Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 1459426, - "cpuTimeP99": 1459426 + "cpuTimeP50": 3736, + "cpuTimeP75": 3736, + "cpuTimeP99": 3736, + "cpuTimeP999": 3736, + "durationP50": 0.012805625, + "durationP75": 0.012805625, + "durationP99": 0.012805625, + "durationP999": 0.012805625 }, "sum": { + "duration": 0.012805625, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:47:42Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:57Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 29254, - "cpuTimeP99": 29254 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-05T00:51:48Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 145956, - "cpuTimeP99": 145956 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:15:50Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 8913, - "cpuTimeP99": 22184 + "cpuTimeP50": 4022, + "cpuTimeP75": 4022, + "cpuTimeP99": 4022, + "cpuTimeP999": 4022, + "durationP50": 0.026200375, + "durationP75": 0.026200375, + "durationP99": 0.026200375, + "durationP999": 0.026200375 }, "sum": { + "duration": 0.026200375, "errors": 0, - "requests": 2, - "subrequests": 4 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T06:16:54Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:36Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 1011029, - "cpuTimeP99": 1011029 + "cpuTimeP50": 6373, + "cpuTimeP75": 6373, + "cpuTimeP99": 6373, + "cpuTimeP999": 6373, + "durationP50": 0.0433325, + "durationP75": 0.0433325, + "durationP99": 0.0433325, + "durationP999": 0.0433325 }, "sum": { + "duration": 0.0433325, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T18:21:05Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:26Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 519936, - "cpuTimeP99": 519936 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:45:18Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 1318946, - "cpuTimeP99": 1318946 + "cpuTimeP50": 3559, + "cpuTimeP75": 3559, + "cpuTimeP99": 3559, + "cpuTimeP999": 3559, + "durationP50": 0.04107925, + "durationP75": 0.04107925, + "durationP99": 0.04107925, + "durationP999": 0.04107925 }, "sum": { + "duration": 0.041079250000000005, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-05T00:06:57Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:46Z", + "scriptName": "otlp-forwarder-worker-dev", "status": "success" }, "quantiles": { - "cpuTimeP50": 70159, - "cpuTimeP99": 70159 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:05:49Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 101584, - "cpuTimeP99": 101584 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:32:31Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 75435, - "cpuTimeP99": 75435 + "cpuTimeP50": 5312, + "cpuTimeP75": 5312, + "cpuTimeP99": 5312, + "cpuTimeP999": 5312, + "durationP50": 0.014188875, + "durationP75": 0.014188875, + "durationP99": 0.014188875, + "durationP999": 0.014188875 }, "sum": { + "duration": 0.014188875, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T17:55:20Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:56Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 32105, - "cpuTimeP99": 32105 + "cpuTimeP50": 4622, + "cpuTimeP75": 4622, + "cpuTimeP99": 4622, + "cpuTimeP999": 4622, + "durationP50": 0.043582626, + "durationP75": 0.043582626, + "durationP99": 0.043582626, + "durationP999": 0.043582626 }, "sum": { + "duration": 0.043582625, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:08:33Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:23Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 1477290, - "cpuTimeP99": 1477290 + "cpuTimeP50": 3190, + "cpuTimeP75": 3190, + "cpuTimeP99": 3190, + "cpuTimeP999": 3190, + "durationP50": 0.012188125, + "durationP75": 0.012188125, + "durationP99": 0.012188125, + "durationP999": 0.012188125 }, "sum": { + "duration": 0.012188125, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T04:00:55Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:24Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 116508, - "cpuTimeP99": 116508 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:10:47Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 108043, - "cpuTimeP99": 108043 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:40:58Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 44887, - "cpuTimeP99": 44887 + "cpuTimeP50": 3283, + "cpuTimeP75": 3283, + "cpuTimeP99": 3283, + "cpuTimeP999": 3283, + "durationP50": 0.043589376, + "durationP75": 0.043589376, + "durationP99": 0.043589376, + "durationP999": 0.043589376 }, "sum": { + "duration": 0.043589375, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:13:11Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:19Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 1559088, - "cpuTimeP99": 1559088 + "cpuTimeP50": 3632, + "cpuTimeP75": 3632, + "cpuTimeP99": 3632, + "cpuTimeP999": 3632, + "durationP50": 0.0413035, + "durationP75": 0.0413035, + "durationP99": 0.0413035, + "durationP999": 0.0413035 }, "sum": { + "duration": 0.0413035, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T19:22:18Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:54Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 311130, - "cpuTimeP99": 311130 + "cpuTimeP50": 5414, + "cpuTimeP75": 5414, + "cpuTimeP99": 5414, + "cpuTimeP999": 5414, + "durationP50": 0.042014, + "durationP75": 0.042014, + "durationP99": 0.042014, + "durationP999": 0.042014 }, "sum": { + "duration": 0.042014, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:52:22Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:02Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 1819849, - "cpuTimeP99": 1819849 + "cpuTimeP50": 5182, + "cpuTimeP75": 5182, + "cpuTimeP99": 5182, + "cpuTimeP999": 5182, + "durationP50": 0.054845374, + "durationP75": 0.054845374, + "durationP99": 0.054845374, + "durationP999": 0.054845374 }, "sum": { + "duration": 0.054845374999999995, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T04:21:32Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:50Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 45432, - "cpuTimeP99": 55368 - }, - "sum": { - "errors": 0, - "requests": 2, - "subrequests": 4 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:58:23Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 64081, - "cpuTimeP99": 64081 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T13:58:44Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 41575, - "cpuTimeP99": 41575 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T06:14:02Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 298021, - "cpuTimeP99": 298021 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:18:04Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 35646, - "cpuTimeP99": 35646 + "cpuTimeP50": 9972, + "cpuTimeP75": 9972, + "cpuTimeP99": 9972, + "cpuTimeP999": 9972, + "durationP50": 0.0423945, + "durationP75": 0.0423945, + "durationP99": 0.0423945, + "durationP999": 0.0423945 }, "sum": { + "duration": 0.0423945, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-05T00:41:48Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:15Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 63339, - "cpuTimeP99": 63339 + "cpuTimeP50": 4044, + "cpuTimeP75": 4044, + "cpuTimeP99": 4044, + "cpuTimeP999": 4044, + "durationP50": 0.054611124, + "durationP75": 0.054611124, + "durationP99": 0.054611124, + "durationP999": 0.054611124 }, "sum": { + "duration": 0.054611125, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T04:11:25Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:40Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 59538, - "cpuTimeP99": 59538 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:31:20Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 654924, - "cpuTimeP99": 654924 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T04:21:32Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 15615, - "cpuTimeP99": 15615 + "cpuTimeP50": 3707, + "cpuTimeP75": 3707, + "cpuTimeP99": 3707, + "cpuTimeP999": 3707, + "durationP50": 0.0428685, + "durationP75": 0.0428685, + "durationP99": 0.0428685, + "durationP999": 0.0428685 }, "sum": { + "duration": 0.0428685, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T04:03:32Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:06Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 25235, - "cpuTimeP99": 25235 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T03:33:59Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 65821, - "cpuTimeP99": 128732 + "cpuTimeP50": 4460, + "cpuTimeP75": 4460, + "cpuTimeP99": 4460, + "cpuTimeP999": 4460, + "durationP50": 0.0432345, + "durationP75": 0.0432345, + "durationP99": 0.0432345, + "durationP999": 0.0432345 }, "sum": { + "duration": 0.043234499999999995, "errors": 0, - "requests": 2, - "subrequests": 4 + "requests": 1 } }, { "dimensions": { - "datetime": "2024-05-04T05:09:48Z", - "scriptName": "my-worker", + "datetime": "2024-05-05T01:00:20Z", + "scriptName": "otlp-forwarder-worker-prod", "status": "success" }, "quantiles": { - "cpuTimeP50": 59387, - "cpuTimeP99": 59387 - }, - "sum": { - "errors": 0, - "requests": 1, - "subrequests": 2 - } - }, - { - "dimensions": { - "datetime": "2024-05-04T05:14:04Z", - "scriptName": "my-worker", - "status": "clientDisconnected" - }, - "quantiles": { - "cpuTimeP50": 11822, - "cpuTimeP99": 11822 + "cpuTimeP50": 3549, + "cpuTimeP75": 3549, + "cpuTimeP99": 3549, + "cpuTimeP999": 3549, + "durationP50": 0.012762625, + "durationP75": 0.012762625, + "durationP99": 0.012762625, + "durationP999": 0.012762625 }, "sum": { + "duration": 0.012762625, "errors": 0, - "requests": 1, - "subrequests": 2 + "requests": 1 } } ] diff --git a/gql/queries.graphql b/gql/queries.graphql index 4bbd4a5..8d57c1b 100644 --- a/gql/queries.graphql +++ b/gql/queries.graphql @@ -1,24 +1,31 @@ -query GetWorkersAnalyticsQuery($accountTag: string, $datetimeStart: string, $datetimeEnd: string, $scriptName: string) { +query GetWorkersAnalyticsQuery($accountTag: string, $datetimeStart: string, $datetimeEnd: string, $limit: Int!) { viewer { accounts(filter: {accountTag: $accountTag}) { - workersInvocationsAdaptive(limit: 100, filter: { - scriptName: $scriptName, + workersInvocationsAdaptive(limit: $limit, filter: { datetime_geq: $datetimeStart, - datetime_leq: $datetimeEnd + datetime_lt: $datetimeEnd }) { + dimensions { + scriptName + status + datetime + } + sum { - subrequests requests errors + duration } + quantiles { cpuTimeP50 + cpuTimeP75 cpuTimeP99 - } - dimensions{ - datetime - scriptName - status + cpuTimeP999 + durationP50 + durationP75 + durationP99 + durationP999 } } } diff --git a/src/gql.rs b/src/gql.rs index 339df5b..69ae752 100644 --- a/src/gql.rs +++ b/src/gql.rs @@ -1,12 +1,10 @@ -use std::borrow::Cow; use std::error::Error; -use std::sync::{Arc, Mutex}; use graphql_client::{GraphQLQuery, Response}; -use opentelemetry::KeyValue; -use opentelemetry::metrics::Unit; -use opentelemetry_sdk::AttributeSet; -use opentelemetry_sdk::metrics::data::{DataPoint, Metric}; -use opentelemetry_sdk::metrics::data::Gauge; +use opentelemetry_sdk::metrics::data::Metric; +use prometheus::{CounterVec, GaugeVec, Opts, Registry}; +use crate::metrics::prometheus_registry_to_opentelemetry_metrics; +use web_time::SystemTime; +use chrono::NaiveDateTime; // The paths are relative to the directory where your `Cargo.toml` is located. // Both json and the GraphQL schema language are supported as sources for the schema @@ -30,8 +28,10 @@ type Time = String; #[allow(non_camel_case_types)] type uint64 = u64; +#[allow(non_camel_case_types)] +type float64 = f64; + pub async fn perform_my_query(cloudflare_api_url: String, cloudflare_api_key: String, variables: get_workers_analytics_query::Variables) -> Result, Box> { - let metrics = Arc::new(Mutex::new(Vec::new())); let request_body = GetWorkersAnalyticsQuery::build_query(variables); let client = reqwest::Client::new(); let res = client.post(cloudflare_api_url) @@ -41,40 +41,58 @@ pub async fn perform_my_query(cloudflare_api_url: String, cloudflare_api_key: St return Err(Box::new(res.error_for_status().unwrap_err())); } let response_body: Response = res.json().await?; - let response_data: get_workers_analytics_query::ResponseData = response_body.data.expect("missing response data"); + + let registry = Registry::new(); + let worker_requests_opts = Opts::new("cloudflare_worker_requests", "number of requests to the worker"); + let worker_requests = CounterVec::new(worker_requests_opts, &["script_name"]).unwrap(); + registry.register(Box::new(worker_requests.clone())).unwrap(); + + let worker_errors_opts = Opts::new("cloudflare_worker_errors", "number of failed requests to the worker"); + let worker_errors = CounterVec::new(worker_errors_opts, &["script_name"]).unwrap(); + registry.register(Box::new(worker_errors.clone())).unwrap(); + + let worker_cpu_time_opts = Opts::new("cloudflare_worker_cpu_time", "cpu time processing request"); + let worker_cpu_time = GaugeVec::new(worker_cpu_time_opts, &["script_name", "quantile"]).unwrap(); + registry.register(Box::new(worker_cpu_time.clone())).unwrap(); + + let worker_duration_opts = Opts::new("cloudflare_worker_duration", "wall clock time processing request"); + let worker_duration = GaugeVec::new(worker_duration_opts, &["script_name", "quantile"]).unwrap(); + registry.register(Box::new(worker_duration.clone())).unwrap(); + + let mut last_datetime: Option