Skip to content

Commit

Permalink
Add ejection api docs (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Apr 27, 2024
1 parent 1725e3b commit 80252c3
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 23 deletions.
66 changes: 64 additions & 2 deletions disperser/dataapi/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,60 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/ejector/operators": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Ejector"
],
"summary": "Eject operators who violate the SLAs during the given time interval",
"parameters": [
{
"type": "integer",
"description": "Lookback window for operator ejection [default: 86400]",
"name": "interval",
"in": "query"
},
{
"type": "integer",
"description": "End time for evaluating operator ejection [default: now]",
"name": "end",
"in": "query"
},
{
"type": "string",
"description": "Whether it's periodic or urgent ejection request [default: periodic]",
"name": "mode",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
}
}
}
},
"/feed/blobs": {
"get": {
"produces": [
Expand Down Expand Up @@ -343,6 +397,12 @@ const docTemplate = `{
"description": "End time (2006-01-02T15:04:05Z) to query for operators nonsigning percentage [default: now]",
"name": "end",
"in": "query"
},
{
"type": "string",
"description": "Whether return only live nonsigners [default: true]",
"name": "live_only",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -769,14 +829,16 @@ const docTemplate = `{
1,
2,
3,
4
4,
5
],
"x-enum-varnames": [
"Processing",
"Confirmed",
"Failed",
"Finalized",
"InsufficientSignatures"
"InsufficientSignatures",
"Dispersing"
]
},
"github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2": {
Expand Down
66 changes: 64 additions & 2 deletions disperser/dataapi/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,60 @@
"version": "1"
},
"paths": {
"/ejector/operators": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Ejector"
],
"summary": "Eject operators who violate the SLAs during the given time interval",
"parameters": [
{
"type": "integer",
"description": "Lookback window for operator ejection [default: 86400]",
"name": "interval",
"in": "query"
},
{
"type": "integer",
"description": "End time for evaluating operator ejection [default: now]",
"name": "end",
"in": "query"
},
{
"type": "string",
"description": "Whether it's periodic or urgent ejection request [default: periodic]",
"name": "mode",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/dataapi.ErrorResponse"
}
}
}
}
},
"/feed/blobs": {
"get": {
"produces": [
Expand Down Expand Up @@ -339,6 +393,12 @@
"description": "End time (2006-01-02T15:04:05Z) to query for operators nonsigning percentage [default: now]",
"name": "end",
"in": "query"
},
{
"type": "string",
"description": "Whether return only live nonsigners [default: true]",
"name": "live_only",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -765,14 +825,16 @@
1,
2,
3,
4
4,
5
],
"x-enum-varnames": [
"Processing",
"Confirmed",
"Failed",
"Finalized",
"InsufficientSignatures"
"InsufficientSignatures",
"Dispersing"
]
},
"github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2": {
Expand Down
38 changes: 38 additions & 0 deletions disperser/dataapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,15 @@ definitions:
- 2
- 3
- 4
- 5
type: integer
x-enum-varnames:
- Processing
- Confirmed
- Failed
- Finalized
- InsufficientSignatures
- Dispersing
github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2:
properties:
a0:
Expand All @@ -225,6 +227,42 @@ info:
title: EigenDA Data Access API
version: "1"
paths:
/ejector/operators:
get:
parameters:
- description: 'Lookback window for operator ejection [default: 86400]'
in: query
name: interval
type: integer
- description: 'End time for evaluating operator ejection [default: now]'
in: query
name: end
type: integer
- description: 'Whether it''s periodic or urgent ejection request [default:
periodic]'
in: query
name: mode
type: string
produces:
- application/json
responses:
"200":
description: OK
"400":
description: 'error: Bad request'
schema:
$ref: '#/definitions/dataapi.ErrorResponse'
"404":
description: 'error: Not found'
schema:
$ref: '#/definitions/dataapi.ErrorResponse'
"500":
description: 'error: Server error'
schema:
$ref: '#/definitions/dataapi.ErrorResponse'
summary: Eject operators who violate the SLAs during the given time interval
tags:
- Ejector
/feed/blobs:
get:
parameters:
Expand Down
38 changes: 19 additions & 19 deletions disperser/dataapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ func (s *server) Shutdown() error {
// @Summary Eject operators who violate the SLAs during the given time interval
// @Tags Ejector
// @Produce json
// @Param interval query int false "Lookback window for operator ejection [default: 86400]"
// @Param end query int false "End time for evaluating operator ejection [default: now]"
// @Param mode query string "Whether it's periodic or urgent ejection request [default: periodic]"
// @Success 200 {object} BlobMetadataResponse
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /ejector/ejection [get]
// @Param interval query int false "Lookback window for operator ejection [default: 86400]"
// @Param end query int false "End time for evaluating operator ejection [default: now]"
// @Param mode query string false "Whether it's periodic or urgent ejection request [default: periodic]"
// @Success 200
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /ejector/operators [get]
func (s *server) EjectOperatorsHandler(c *gin.Context) {
timer := prometheus.NewTimer(prometheus.ObserverFunc(func(f float64) {
s.metrics.ObserveLatency("EjectOperators", f*1000) // make milliseconds
Expand Down Expand Up @@ -551,17 +551,17 @@ func (s *server) FetchNonSigners(c *gin.Context) {

// FetchOperatorsNonsigningPercentageHandler godoc
//
// @Summary Fetch operators non signing percentage
// @Tags Metrics
// @Produce json
// @Param interval query int false "Interval to query for operators nonsigning percentage [default: 3600]"
// @Param end query string false "End time (2006-01-02T15:04:05Z) to query for operators nonsigning percentage [default: now]"
// @Param live_only query string false "Whether return only live nonsigners [default: true]"
// @Success 200 {object} OperatorsNonsigningPercentage
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /metrics/operator-nonsigning-percentage [get]
// @Summary Fetch operators non signing percentage
// @Tags Metrics
// @Produce json
// @Param interval query int false "Interval to query for operators nonsigning percentage [default: 3600]"
// @Param end query string false "End time (2006-01-02T15:04:05Z) to query for operators nonsigning percentage [default: now]"
// @Param live_only query string false "Whether return only live nonsigners [default: true]"
// @Success 200 {object} OperatorsNonsigningPercentage
// @Failure 400 {object} ErrorResponse "error: Bad request"
// @Failure 404 {object} ErrorResponse "error: Not found"
// @Failure 500 {object} ErrorResponse "error: Server error"
// @Router /metrics/operator-nonsigning-percentage [get]
func (s *server) FetchOperatorsNonsigningPercentageHandler(c *gin.Context) {
timer := prometheus.NewTimer(prometheus.ObserverFunc(func(f float64) {
s.metrics.ObserveLatency("FetchOperatorsNonsigningPercentageHandler", f*1000) // make milliseconds
Expand Down

0 comments on commit 80252c3

Please sign in to comment.