Skip to content

Commit

Permalink
Add support for metrics APIs (Layr-Labs#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Dec 20, 2024
1 parent 0edc40a commit 122a438
Show file tree
Hide file tree
Showing 5 changed files with 444 additions and 7 deletions.
105 changes: 105 additions & 0 deletions disperser/dataapi/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,57 @@ const docTemplate = `{
}
}
},
"/metrics/summary": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Metrics"
],
"summary": "Fetch metrics summary",
"parameters": [
{
"type": "integer",
"description": "Start unix timestamp [default: 1 hour ago]",
"name": "start",
"in": "query"
},
{
"type": "integer",
"description": "End unix timestamp [default: unix time now]",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dataapi.Metric"
}
},
"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"
}
}
}
}
},
"/metrics/throughput": {
"get": {
"produces": [
Expand Down Expand Up @@ -583,6 +634,60 @@ const docTemplate = `{
}
}
},
"/metrics/timeseries/throughput": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Metrics"
],
"summary": "Fetch throughput time series",
"parameters": [
{
"type": "integer",
"description": "Start unix timestamp [default: 1 hour ago]",
"name": "start",
"in": "query"
},
{
"type": "integer",
"description": "End unix timestamp [default: unix time now]",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dataapi.Throughput"
}
}
},
"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"
}
}
}
}
},
"/operators-info/deregistered-operators": {
"get": {
"produces": [
Expand Down
105 changes: 105 additions & 0 deletions disperser/dataapi/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,57 @@
}
}
},
"/metrics/summary": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Metrics"
],
"summary": "Fetch metrics summary",
"parameters": [
{
"type": "integer",
"description": "Start unix timestamp [default: 1 hour ago]",
"name": "start",
"in": "query"
},
{
"type": "integer",
"description": "End unix timestamp [default: unix time now]",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dataapi.Metric"
}
},
"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"
}
}
}
}
},
"/metrics/throughput": {
"get": {
"produces": [
Expand Down Expand Up @@ -579,6 +630,60 @@
}
}
},
"/metrics/timeseries/throughput": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Metrics"
],
"summary": "Fetch throughput time series",
"parameters": [
{
"type": "integer",
"description": "Start unix timestamp [default: 1 hour ago]",
"name": "start",
"in": "query"
},
{
"type": "integer",
"description": "End unix timestamp [default: unix time now]",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dataapi.Throughput"
}
}
},
"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"
}
}
}
}
},
"/operators-info/deregistered-operators": {
"get": {
"produces": [
Expand Down
68 changes: 68 additions & 0 deletions disperser/dataapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,39 @@ paths:
summary: Fetch operators non signing percentage
tags:
- Metrics
/metrics/summary:
get:
parameters:
- description: 'Start unix timestamp [default: 1 hour ago]'
in: query
name: start
type: integer
- description: 'End unix timestamp [default: unix time now]'
in: query
name: end
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dataapi.Metric'
"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: Fetch metrics summary
tags:
- Metrics
/metrics/throughput:
get:
parameters:
Expand Down Expand Up @@ -732,6 +765,41 @@ paths:
summary: Fetch throughput time series
tags:
- Metrics
/metrics/timeseries/throughput:
get:
parameters:
- description: 'Start unix timestamp [default: 1 hour ago]'
in: query
name: start
type: integer
- description: 'End unix timestamp [default: unix time now]'
in: query
name: end
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dataapi.Throughput'
type: array
"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: Fetch throughput time series
tags:
- Metrics
/operators-info/deregistered-operators:
get:
produces:
Expand Down
Loading

0 comments on commit 122a438

Please sign in to comment.