This commit is contained in:
boufni95 2025-04-10 17:16:48 +00:00
parent b18eab9d20
commit cf9a10ded4
5 changed files with 10 additions and 10 deletions

View file

@ -807,7 +807,7 @@ The nostr server will send back a message response, and inside the body there wi
- ResetMetricsStorages
- auth type: __Metrics__
- http method: __post__
- http route: __/api/admin/metrics/reset__
- http route: __/api/metrics/reset__
- This methods has an __empty__ __request__ body
- This methods has an __empty__ __response__ body
@ -912,7 +912,7 @@ The nostr server will send back a message response, and inside the body there wi
- ZipMetricsStorages
- auth type: __Metrics__
- http method: __post__
- http route: __/api/admin/metrics/zip__
- http route: __/api/metrics/zip__
- This methods has an __empty__ __request__ body
- output: [ZippedMetrics](#ZippedMetrics)

View file

@ -1759,7 +1759,7 @@ func NewClient(params ClientParams) *Client {
if err != nil {
return err
}
finalRoute := "/api/admin/metrics/reset"
finalRoute := "/api/metrics/reset"
body := []byte{}
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
if err != nil {
@ -2110,7 +2110,7 @@ func NewClient(params ClientParams) *Client {
if err != nil {
return nil, err
}
finalRoute := "/api/admin/metrics/zip"
finalRoute := "/api/metrics/zip"
body := []byte{}
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
if err != nil {

View file

@ -1633,7 +1633,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented')
app.post('/api/admin/metrics/reset', async (req, res) => {
app.post('/api/metrics/reset', async (req, res) => {
const info: Types.RequestInfo = { rpcName: 'ResetMetricsStorages', batch: false, nostr: false, batchSize: 0}
const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n }
let authCtx: Types.AuthContext = {}
@ -1935,7 +1935,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented')
app.post('/api/admin/metrics/zip', async (req, res) => {
app.post('/api/metrics/zip', async (req, res) => {
const info: Types.RequestInfo = { rpcName: 'ZipMetricsStorages', batch: false, nostr: false, batchSize: 0}
const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n }
let authCtx: Types.AuthContext = {}

View file

@ -842,7 +842,7 @@ export default (params: ClientParams) => ({
ResetMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' })> => {
const auth = await params.retrieveMetricsAuth()
if (auth === null) throw new Error('retrieveMetricsAuth() returned null')
let finalRoute = '/api/admin/metrics/reset'
let finalRoute = '/api/metrics/reset'
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {
@ -1009,7 +1009,7 @@ export default (params: ClientParams) => ({
ZipMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' }& Types.ZippedMetrics)> => {
const auth = await params.retrieveMetricsAuth()
if (auth === null) throw new Error('retrieveMetricsAuth() returned null')
let finalRoute = '/api/admin/metrics/zip'
let finalRoute = '/api/metrics/zip'
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {

View file

@ -237,14 +237,14 @@ service LightningPub {
rpc ZipMetricsStorages(structs.Empty) returns (structs.ZippedMetrics) {
option (auth_type) = "Metrics";
option (http_method) = "post";
option (http_route) = "/api/admin/metrics/zip";
option (http_route) = "/api/metrics/zip";
option (nostr) = true;
}
rpc ResetMetricsStorages(structs.Empty) returns (structs.Empty) {
option (auth_type) = "Metrics";
option (http_method) = "post";
option (http_route) = "/api/admin/metrics/reset";
option (http_route) = "/api/metrics/reset";
option (nostr) = true;
}