matrix-org / matrix-federation-tester

Tester for matrix federation written in golang.
77 stars 17 forks source link

API that returns a simple indicator whether the federation is okay #131

Closed stoically closed 1 year ago

stoically commented 1 year ago

I'd like to use the federation tester backend as monitoring in terms of whether federation generally works or not. I could parse the returned JSON and look at the FederationOK value. However, some tools currently don't support that, such as uptime-kuma (a regex feature could help as well, if it lands). In this case an API endpoint that reveals FederationOK as HTTP Status would be useful.

Maybe GET /api/federation-ok which responds with HTTP 200 if the federation is ok, and HTTP 500 if the federation is not ok, potentially with the error array as JSON, for easier debugging?

richvdh commented 1 year ago

The problem with 500 errors is that they tend to get interpreted by things like Cloudflare to mean "this server is down", which wouldn't be correct.

How about an endpoint which still returns 200, but has an easier-to-parse body?

stoically commented 1 year ago

I see. Yeah, maybe /api/federation-ok just returning true or false?

richvdh commented 1 year ago

yup. Or OK or some error code, maybe. I'd be happy to accept a pull request :)