Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.x] Add Tags for API Requests #3162

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions documentation/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -267,6 +275,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -357,6 +373,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -437,6 +461,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -548,6 +580,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -637,6 +677,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -880,6 +928,13 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -971,6 +1026,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -1040,6 +1103,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -1135,6 +1206,14 @@
"schema": {
"type": "string"
}
},
{
"name": "tags",
"in": "query",
"description": "An optional set of comma-separated identifiers users can include to make an operation easier to identify.",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -1541,6 +1620,14 @@
"isStoppable": {
"type": "boolean"
},
"tags": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"resourceLocation": {
"type": "string",
"nullable": true
Expand Down Expand Up @@ -1575,6 +1662,14 @@
},
"isStoppable": {
"type": "boolean"
},
"tags": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
},
"nullable": true
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ partial class DiagController
/// <param name="name">Process name used to identify the target process.</param>
/// <param name="durationSeconds">The duration of the metrics session (in seconds).</param>
/// <param name="egressProvider">The egress provider to which the metrics are saved.</param>
/// <param name="tags">An optional set of comma-separated identifiers users can include to make an operation easier to identify.</param>
[HttpGet("livemetrics", Name = nameof(CaptureMetrics))]
[ProducesWithProblemDetails(ContentTypes.ApplicationJsonSequence)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)]
Expand All @@ -35,7 +36,9 @@ public Task<ActionResult> CaptureMetrics(
[FromQuery][Range(-1, int.MaxValue)]
int durationSeconds = 30,
[FromQuery]
string egressProvider = null)
string egressProvider = null,
[FromQuery]
string tags = null)
{
ProcessKey? processKey = Utilities.GetProcessKey(pid, uid, name);

Expand All @@ -49,7 +52,8 @@ public Task<ActionResult> CaptureMetrics(
Utilities.ArtifactType_Metrics,
egressProvider,
_metricsOperationFactory.Create(processInfo.EndpointInfo, settings),
processInfo),
processInfo,
tags),
processKey,
Utilities.ArtifactType_Metrics);
}
Expand All @@ -63,6 +67,7 @@ public Task<ActionResult> CaptureMetrics(
/// <param name="name">Process name used to identify the target process.</param>
/// <param name="durationSeconds">The duration of the metrics session (in seconds).</param>
/// <param name="egressProvider">The egress provider to which the metrics are saved.</param>
/// <param name="tags">An optional set of comma-separated identifiers users can include to make an operation easier to identify.</param>
[HttpPost("livemetrics", Name = nameof(CaptureMetricsCustom))]
[ProducesWithProblemDetails(ContentTypes.ApplicationJsonSequence)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)]
Expand All @@ -80,7 +85,9 @@ public Task<ActionResult> CaptureMetricsCustom(
[FromQuery][Range(-1, int.MaxValue)]
int durationSeconds = 30,
[FromQuery]
string egressProvider = null)
string egressProvider = null,
[FromQuery]
string tags = null)
{
ProcessKey? processKey = Utilities.GetProcessKey(pid, uid, name);

Expand All @@ -94,7 +101,8 @@ public Task<ActionResult> CaptureMetricsCustom(
Utilities.ArtifactType_Metrics,
egressProvider,
_metricsOperationFactory.Create(processInfo.EndpointInfo, settings),
processInfo),
processInfo,
tags),
processKey,
Utilities.ArtifactType_Metrics);
}
Expand Down
Loading