flomesh-io / pipy

Pipy is a programmable proxy for the cloud, edge and IoT.
https://flomesh.io/pipy
Other
743 stars 70 forks source link

metrics of multi-threading version is not compatible with main branch #140

Closed ethinx closed 1 year ago

ethinx commented 1 year ago

What happened

Start pipy repo and worker in different version, the repo is unable to get metrics from worker. Reporting error in console:

2023-01-04 14:01:04.162 [ERR] [stats] Invalid JSON structure for metrics

How to reproduce

Use samples/gateway for proxy worker and enable metrics plugin:

{
  "listen": 8000,
  "listenTLS": 8443,
  "plugins": [
    "plugins/router.js",
    "plugins/metrics.js",
    "plugins/jwt.js",
    "plugins/cache.js",
    "plugins/hello.js",
    "plugins/balancer.js",
    "plugins/serve-files.js",
    "plugins/default.js"
  ],
  ...
}

Expect behavior

repo could receive the metrics from worker, they should be compatible

Version info

repo

Version     : nightly-202301041356
Commit      : 9bae523b94099360fd415e86cc84ad66e6514ac8
Commit Date : Fri, 30 Dec 2022 14:32:56 +0800
Host        : Linux-5.15.0-39-generic x86_64
OpenSSL     : OpenSSL 1.1.1q  5 Jul 2022
Builtin GUI : No
Samples     : No

worker

Version     : nightly-202301041229
Commit      : 55c9e5d546f1e415688decfee7d823983577dd4c
Commit Date : Wed, 4 Jan 2023 11:37:10 +0800
Host        : Linux-5.15.0-39-generic x86_64
OpenSSL     : OpenSSL 1.1.1q  5 Jul 2022
Builtin GUI : No
Samples     : No
pajama-coder commented 1 year ago

This is due to a minor change in the message protocol for reporting metrics from a worker to the repo. The change happened in this branch but not yet in the main branch. Generally speaking, compatibility between different versions of repo and worker is not garanteed.