Skip to content

Commit

Permalink
Feat: swagger 문서 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
rrgks6221 committed Aug 6, 2022
1 parent a9dbfd7 commit f5aaa09
Showing 1 changed file with 159 additions and 47 deletions.
206 changes: 159 additions & 47 deletions swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,67 @@
"description": "uncloudy-grapher를 위한 prometheus-metrics 입니다.",
"license": {
"name": "MIT",
"url": "http://localhost:9090/api/v1"
"url": "http://uncloudy.duckdns.org:9090/api/v1"
}
},
"host": "localhost:9090/api/v1",
"host": "uncloudy.duckdns.org:9090/api/v1",
"schemes": ["http"],
"paths": {
"/query?query={query}&time={time}": {
"get": {
"tags": ["prometheus-metric"],
"summary": "resultType: vector",
"summary": "custom_node_cpu_usage",
"parameters": [
{
"name": "query",
"in": "path",
"required": true,
"type": "string",
"format": "string",
"example": "custom_node_cpu_total"
"default": "custom_node_cpu_usage[1m]",
"example": "custom_node_cpu_usage[1m]",
"description": "prom-ql"
},
{
"name": "time",
"in": "path",
"required": true,
"type": "string",
"format": "dateTime",
"example": 1659083667.513
"example": 1659782551.14,
"default": 1659782551.14,
"description": "기준 시각"
}
],
"responses": {
"200": {
"description": "OK",
"200: node vector": {
"description": "node metric의 value가 1개일 경우",
"schema": {
"$ref": "#definitions/vector"
"$ref": "#definitions/node_vector"
}
}
}
}
},
"/query?query={query}{timeRange}&time={time}": {
"get": {
"tags": ["prometheus-metric"],
"summary": "resultType: vector",
"parameters": [
{
"name": "query",
"in": "path",
"required": true,
"type": "string",
"example": "custom_node_cpu_total"
},
{
"name": "timeRange",
"in": "path",
"required": true,
"type": "string",
"example": "[1m]"
"200: node metric": {
"description": "node metric의 value가 여러개일 경우",
"schema": {
"$ref": "#definitions/node_matrix"
}
},
{
"name": "time",
"in": "path",
"required": true,
"type": "string",
"example": 1659083667.513
}
],
"responses": {
"200": {
"description": "OK",
"200: pod vector": {
"description": "pod metric의 value가 1개일 경우",
"schema": {
"$ref": "#definitions/matrix"
"$ref": "#definitions/pod_vector"
}
},
"200: pod metric": {
"description": "pod metric의 value가 여러개일 경우",
"schema": {
"$ref": "#definitions/pod_matrix"
}
}
}
}
}
},
"definitions": {
"vector": {
"node_vector": {
"properties": {
"status": {
"type": "integer",
Expand All @@ -103,7 +86,7 @@
"properties": {
"__name__": {
"type": "string",
"example": "custom_node_cpu_total"
"example": "query resource"
},
"cluster": {
"type": "string",
Expand All @@ -120,6 +103,10 @@
"job": {
"type": "string",
"example": "kube_state_demo"
},
"os": {
"type": "string",
"example": "ubuntu"
}
}
},
Expand All @@ -134,7 +121,7 @@
}
}
},
"matrix": {
"node_matrix": {
"properties": {
"status": {
"type": "integer",
Expand All @@ -154,7 +141,7 @@
"properties": {
"__name__": {
"type": "string",
"example": "custom_node_cpu_total"
"example": "query resource"
},
"cluster": {
"type": "string",
Expand All @@ -171,6 +158,131 @@
"job": {
"type": "string",
"example": "kube_state_demo"
},
"os": {
"type": "string",
"example": "ubuntu"
}
}
},
"values": {
"type": "array",
"example": [
[1659083667.513, "0.9572312074314"],
[1659083712.513, "0.2589979277102208"]
]
}
}
}
}
}
}
}
},
"pod_vector": {
"properties": {
"status": {
"type": "integer",
"example": "success"
},
"data": {
"properties": {
"resultType": {
"type": "string",
"example": "vector"
},
"result": {
"type": "array",
"items": {
"properties": {
"metric": {
"properties": {
"__name__": {
"type": "string",
"example": "query resource"
},
"deployment": {
"type": "string",
"example": "grafana-deployment-5738192321"
},
"instance": {
"type": "string",
"example": "busanh02"
},
"job": {
"type": "string",
"example": "kube_state_demo"
},
"namespace": {
"type": "string",
"example": "infra"
},
"pod": {
"type": "string",
"example": "grafana-deployment-5738192321-9sj2a"
},
"os": {
"type": "string",
"example": "ubuntu"
}
}
},
"value": {
"type": "array",
"example": [1659074738.418, "0.2925363504199614"]
}
}
}
}
}
}
}
},
"pod_matrix": {
"properties": {
"status": {
"type": "integer",
"example": "success"
},
"data": {
"properties": {
"resultType": {
"type": "string",
"example": "matrix"
},
"result": {
"type": "array",
"items": {
"properties": {
"metric": {
"properties": {
"__name__": {
"type": "string",
"example": "query resource"
},
"deployment": {
"type": "string",
"example": "grafana-deployment-5738192321"
},
"instance": {
"type": "string",
"example": "busanh02"
},
"job": {
"type": "string",
"example": "kube_state_demo"
},
"namespace": {
"type": "string",
"example": "infra"
},
"pod": {
"type": "string",
"example": "grafana-deployment-5738192321-9sj2a"
},
"os": {
"type": "string",
"example": "ubuntu"
}
}
},
Expand Down

0 comments on commit f5aaa09

Please sign in to comment.