feat(coderd): add user latency and template insights endpoints (#8519)

Part of #8514
Refs #8109
This commit is contained in:
Mathias Fredriksson
2023-07-21 18:00:19 +00:00
committed by GitHub
parent 539fcf9e6b
commit 30fe153296
20 changed files with 2505 additions and 6 deletions
+243
View File
@@ -878,6 +878,56 @@ const docTemplate = `{
}
}
},
"/insights/templates": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Insights"
],
"summary": "Get insights about templates",
"operationId": "get-insights-about-templates",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.TemplateInsightsResponse"
}
}
}
}
},
"/insights/user-latency": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Insights"
],
"summary": "Get insights about user latency",
"operationId": "get-insights-about-user-latency",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.UserLatencyInsightsResponse"
}
}
}
}
},
"/licenses": {
"get": {
"security": [
@@ -6956,6 +7006,19 @@ const docTemplate = `{
"BuildReasonAutostop"
]
},
"codersdk.ConnectionLatency": {
"type": "object",
"properties": {
"p50": {
"type": "number",
"example": 31.312
},
"p95": {
"type": "number",
"example": 119.832
}
}
},
"codersdk.ConvertLoginRequest": {
"type": "object",
"required": [
@@ -8040,6 +8103,15 @@ const docTemplate = `{
}
}
},
"codersdk.InsightsReportInterval": {
"type": "string",
"enum": [
"day"
],
"x-enum-varnames": [
"InsightsReportIntervalDay"
]
},
"codersdk.IssueReconnectingPTYSignedTokenRequest": {
"type": "object",
"required": [
@@ -9123,6 +9195,50 @@ const docTemplate = `{
}
}
},
"codersdk.TemplateAppUsage": {
"type": "object",
"properties": {
"display_name": {
"type": "string",
"example": "Visual Studio Code"
},
"icon": {
"type": "string"
},
"seconds": {
"type": "integer",
"example": 80500
},
"slug": {
"type": "string",
"example": "vscode"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"type": {
"allOf": [
{
"$ref": "#/definitions/codersdk.TemplateAppsType"
}
],
"example": "builtin"
}
}
},
"codersdk.TemplateAppsType": {
"type": "string",
"enum": [
"builtin"
],
"x-enum-varnames": [
"TemplateAppsTypeBuiltin"
]
},
"codersdk.TemplateBuildTimeStats": {
"type": "object",
"additionalProperties": {
@@ -9159,6 +9275,77 @@ const docTemplate = `{
}
}
},
"codersdk.TemplateInsightsIntervalReport": {
"type": "object",
"properties": {
"active_users": {
"type": "integer",
"example": 14
},
"end_time": {
"type": "string",
"format": "date-time"
},
"interval": {
"$ref": "#/definitions/codersdk.InsightsReportInterval"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
}
}
},
"codersdk.TemplateInsightsReport": {
"type": "object",
"properties": {
"active_users": {
"type": "integer",
"example": 22
},
"apps_usage": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateAppUsage"
}
},
"end_time": {
"type": "string",
"format": "date-time"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
}
}
},
"codersdk.TemplateInsightsResponse": {
"type": "object",
"properties": {
"interval_reports": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateInsightsIntervalReport"
}
},
"report": {
"$ref": "#/definitions/codersdk.TemplateInsightsReport"
}
}
},
"codersdk.TemplateRestartRequirement": {
"type": "object",
"properties": {
@@ -9708,6 +9895,62 @@ const docTemplate = `{
}
}
},
"codersdk.UserLatency": {
"type": "object",
"properties": {
"latency_ms": {
"$ref": "#/definitions/codersdk.ConnectionLatency"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"user_id": {
"type": "string",
"format": "uuid"
},
"username": {
"type": "string"
}
}
},
"codersdk.UserLatencyInsightsReport": {
"type": "object",
"properties": {
"end_time": {
"type": "string",
"format": "date-time"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.UserLatency"
}
}
}
},
"codersdk.UserLatencyInsightsResponse": {
"type": "object",
"properties": {
"report": {
"$ref": "#/definitions/codersdk.UserLatencyInsightsReport"
}
}
},
"codersdk.UserLoginType": {
"type": "object",
"properties": {
+227
View File
@@ -756,6 +756,48 @@
}
}
},
"/insights/templates": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Insights"],
"summary": "Get insights about templates",
"operationId": "get-insights-about-templates",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.TemplateInsightsResponse"
}
}
}
}
},
"/insights/user-latency": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Insights"],
"summary": "Get insights about user latency",
"operationId": "get-insights-about-user-latency",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.UserLatencyInsightsResponse"
}
}
}
}
},
"/licenses": {
"get": {
"security": [
@@ -6195,6 +6237,19 @@
"BuildReasonAutostop"
]
},
"codersdk.ConnectionLatency": {
"type": "object",
"properties": {
"p50": {
"type": "number",
"example": 31.312
},
"p95": {
"type": "number",
"example": 119.832
}
}
},
"codersdk.ConvertLoginRequest": {
"type": "object",
"required": ["password", "to_type"],
@@ -7220,6 +7275,11 @@
}
}
},
"codersdk.InsightsReportInterval": {
"type": "string",
"enum": ["day"],
"x-enum-varnames": ["InsightsReportIntervalDay"]
},
"codersdk.IssueReconnectingPTYSignedTokenRequest": {
"type": "object",
"required": ["agentID", "url"],
@@ -8238,6 +8298,46 @@
}
}
},
"codersdk.TemplateAppUsage": {
"type": "object",
"properties": {
"display_name": {
"type": "string",
"example": "Visual Studio Code"
},
"icon": {
"type": "string"
},
"seconds": {
"type": "integer",
"example": 80500
},
"slug": {
"type": "string",
"example": "vscode"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"type": {
"allOf": [
{
"$ref": "#/definitions/codersdk.TemplateAppsType"
}
],
"example": "builtin"
}
}
},
"codersdk.TemplateAppsType": {
"type": "string",
"enum": ["builtin"],
"x-enum-varnames": ["TemplateAppsTypeBuiltin"]
},
"codersdk.TemplateBuildTimeStats": {
"type": "object",
"additionalProperties": {
@@ -8274,6 +8374,77 @@
}
}
},
"codersdk.TemplateInsightsIntervalReport": {
"type": "object",
"properties": {
"active_users": {
"type": "integer",
"example": 14
},
"end_time": {
"type": "string",
"format": "date-time"
},
"interval": {
"$ref": "#/definitions/codersdk.InsightsReportInterval"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
}
}
},
"codersdk.TemplateInsightsReport": {
"type": "object",
"properties": {
"active_users": {
"type": "integer",
"example": 22
},
"apps_usage": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateAppUsage"
}
},
"end_time": {
"type": "string",
"format": "date-time"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
}
}
},
"codersdk.TemplateInsightsResponse": {
"type": "object",
"properties": {
"interval_reports": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateInsightsIntervalReport"
}
},
"report": {
"$ref": "#/definitions/codersdk.TemplateInsightsReport"
}
}
},
"codersdk.TemplateRestartRequirement": {
"type": "object",
"properties": {
@@ -8774,6 +8945,62 @@
}
}
},
"codersdk.UserLatency": {
"type": "object",
"properties": {
"latency_ms": {
"$ref": "#/definitions/codersdk.ConnectionLatency"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"user_id": {
"type": "string",
"format": "uuid"
},
"username": {
"type": "string"
}
}
},
"codersdk.UserLatencyInsightsReport": {
"type": "object",
"properties": {
"end_time": {
"type": "string",
"format": "date-time"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"template_ids": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
}
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.UserLatency"
}
}
}
},
"codersdk.UserLatencyInsightsResponse": {
"type": "object",
"properties": {
"report": {
"$ref": "#/definitions/codersdk.UserLatencyInsightsReport"
}
}
},
"codersdk.UserLoginType": {
"type": "object",
"properties": {