-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Also fixup some examples for Bearer
- Loading branch information
Showing
18 changed files
with
297 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Collectmetrics - Get Custom | ||
|
||
Captures metrics for a process, with the ability to specify custom metrics. | ||
|
||
## HTTP Route | ||
|
||
```http | ||
POST /collectmetrics?pid={pid}&uid={uid}&name={name}&metricsIntervalSeconds={metricsIntervalSeconds}&durationSeconds={durationSeconds}&egressProvider={egressProvider} HTTP/1.1 | ||
``` | ||
|
||
> **NOTE:** Process information (IDs, names, environment, etc) may change between invocations of these APIs. Processes may start or stop between API invocations, causing this information to change. | ||
## Host Address | ||
|
||
The default host address for these routes is `https://localhost:52323`. This route is only available on the addresses configured via the `--urls` command line parameter and the `DOTNETMONITOR_URLS` environment variable. | ||
|
||
## URI Parameters | ||
|
||
| Name | In | Required | Type | Description | | ||
|---|---|---|---|---| | ||
| `pid` | query | false | int | The ID of the process. | | ||
| `uid` | query | false | guid | A value that uniquely identifies a runtime instance within a process. | | ||
| `name` | query | false | string | The name of the process. | | ||
| `metricsIntervalSeconds` | query | false | int | The time interval used to collect metrics. Default is 5. | | ||
| `durationSeconds` | query | false | int | The duration of the metrics operation in seconds. Default is `30`. Min is `-1` (indefinite duration). Max is `2147483647`. | | ||
| `egressProvider` | query | false | string | If specified, uses the named egress provider for egressing the collected metrics. When not specified, the metrics are written to the HTTP response stream. See [Egress Providers](../egress.md) for more details. | | ||
|
||
See [ProcessIdentifier](definitions.md#ProcessIdentifier) for more details about the `pid`, `uid`, and `name` parameters. | ||
|
||
If none of `pid`, `uid`, or `name` are specified, artifacts for the [default process](defaultprocess.md) will be captured. Attempting to capture artifacts of the default process when the default process cannot be resolved will fail. | ||
|
||
## Authentication | ||
|
||
Authentication is enforced for this route. See [Authentication](./../authentication.md) for further information. | ||
|
||
Allowed schemes: | ||
- `Bearer` | ||
- `Negotiate` (Windows only, running as unelevated) | ||
|
||
## Request Body | ||
|
||
A request body of type [EventMetricsConfiguration](definitions.md#EventMetricsConfiguration) is required. | ||
|
||
The expected content type is `application/json`. | ||
|
||
## Responses | ||
|
||
| Name | Type | Description | Content Type | | ||
|---|---|---|---| | ||
| 200 OK | [Metric](./definitions.md/#Metric) | The metrics from the process formatted as json sequence. Each JSON object is a [metrics object](./definitions.md/#Metric)| `application/json-seq` | | ||
| 202 Accepted | | When an egress provider is specified, the Location header containers the URI of the operation for querying the egress status. | | | ||
| 400 Bad Request | [ValidationProblemDetails](definitions.md#ValidationProblemDetails) | An error occurred due to invalid input. The response body describes the specific problem(s). | `application/problem+json` | | ||
| 401 Unauthorized | | Authentication is required to complete the request. See [Authentication](./../authentication.md) for further information. | | | ||
| 429 Too Many Requests | | There are too many requests at this time. Try to request metrics at a later time. | `application/problem+json` | | ||
|
||
## Examples | ||
|
||
### Sample Request | ||
|
||
```http | ||
GET /collectmetrics?pid=21632&metricsIntervalSeconds=10&durationSeconds=60 HTTP/1.1 | ||
Host: localhost:52323 | ||
Authorization: Bearer fffffffffffffffffffffffffffffffffffffffffff= | ||
{ | ||
"includeDefaultProviders": false, | ||
"providers": [ | ||
{ | ||
"providerName": "CustomProvider", | ||
"counterNames": [ | ||
"counter1", | ||
"counter2" | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Sample Response | ||
|
||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json-seq | ||
{ | ||
"timestamp": "2021-08-31T16:58:39.7514031+00:00", | ||
"provider": "CustomProvider", | ||
"name": "counter1", | ||
"displayName": "Counter 1", | ||
"unit": "B", | ||
"counterType": "Metric", | ||
"value": 3 | ||
} | ||
{ | ||
"timestamp": "2021-08-31T16:58:39.7515128+00:00", | ||
"provider": "CustomProvider", | ||
"name": "counter2", | ||
"displayName": "Counter 2", | ||
"unit": "MB", | ||
"counterType": "Metric", | ||
"value": 126 | ||
} | ||
``` | ||
|
||
## Supported Runtimes | ||
|
||
| Operating System | Runtime Version | | ||
|---|---| | ||
| Windows | .NET Core 3.1, .NET 5+ | | ||
| Linux | .NET Core 3.1, .NET 5+ | | ||
| MacOS | .NET Core 3.1, .NET 5+ | | ||
|
||
## Additional Notes | ||
|
||
### When to use `pid` vs `uid` | ||
|
||
See [Process ID `pid` vs Unique ID `uid`](pidvsuid.md) for clarification on when it is best to use either parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Collectmetrics - Get | ||
|
||
Captures metrics for a chosen process. | ||
|
||
> **NOTE:** For Prometheus style metrics, use the [metrics](./metrics.md) endpoint. | ||
## HTTP Route | ||
|
||
```http | ||
GET /collectmetrics?pid={pid}&uid={uid}&name={name}&metricsIntervalSeconds={metricsIntervalSeconds}&durationSeconds={durationSeconds}&egressProvider={egressProvider} HTTP/1.1 | ||
``` | ||
|
||
> **NOTE:** Process information (IDs, names, environment, etc) may change between invocations of these APIs. Processes may start or stop between API invocations, causing this information to change. | ||
## Host Address | ||
|
||
The default host address for these routes is `https://localhost:52323`. This route is only available on the addresses configured via the `--urls` command line parameter and the `DOTNETMONITOR_URLS` environment variable. | ||
|
||
## URI Parameters | ||
|
||
| Name | In | Required | Type | Description | | ||
|---|---|---|---|---| | ||
| `pid` | query | false | int | The ID of the process. | | ||
| `uid` | query | false | guid | A value that uniquely identifies a runtime instance within a process. | | ||
| `name` | query | false | string | The name of the process. | | ||
| `metricsIntervalSeconds` | query | false | int | The time interval used to collect metrics. Default is 5. | | ||
| `durationSeconds` | query | false | int | The duration of the metrics operation in seconds. Default is `30`. Min is `-1` (indefinite duration). Max is `2147483647`. | | ||
| `egressProvider` | query | false | string | If specified, uses the named egress provider for egressing the collected metrics. When not specified, the metrics are written to the HTTP response stream. See [Egress Providers](../egress.md) for more details. | | ||
|
||
See [ProcessIdentifier](definitions.md#ProcessIdentifier) for more details about the `pid`, `uid`, and `name` parameters. | ||
|
||
If none of `pid`, `uid`, or `name` are specified, artifacts for the [default process](defaultprocess.md) will be captured. Attempting to capture artifacts of the default process when the default process cannot be resolved will fail. | ||
|
||
## Authentication | ||
|
||
Authentication is enforced for this route. See [Authentication](./../authentication.md) for further information. | ||
|
||
Allowed schemes: | ||
- `Bearer` | ||
- `Negotiate` (Windows only, running as unelevated) | ||
|
||
## Responses | ||
|
||
| Name | Type | Description | Content Type | | ||
|---|---|---|---| | ||
| 200 OK | [Metric](./definitions.md/#Metric) | The metrics from the process formatted as json sequence. | `application/json-seq` | | ||
| 202 Accepted | | When an egress provider is specified, the Location header containers the URI of the operation for querying the egress status. | | | ||
| 400 Bad Request | [ValidationProblemDetails](definitions.md#ValidationProblemDetails) | An error occurred due to invalid input. The response body describes the specific problem(s). | `application/problem+json` | | ||
| 401 Unauthorized | | Authentication is required to complete the request. See [Authentication](./../authentication.md) for further information. | | | ||
| 429 Too Many Requests | | There are too many requests at this time. Try to request metrics at a later time. | `application/problem+json` | | ||
|
||
## Examples | ||
|
||
### Sample Request | ||
|
||
```http | ||
GET /collectmetrics?pid=21632&metricsIntervalSeconds=10&durationSeconds=60 HTTP/1.1 | ||
Host: localhost:52323 | ||
Authorization: Bearer fffffffffffffffffffffffffffffffffffffffffff= | ||
``` | ||
|
||
### Sample Response | ||
|
||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json-seq | ||
{ | ||
"timestamp": "2021-08-31T16:58:39.7514031+00:00", | ||
"provider": "System.Runtime", | ||
"name": "cpu-usage", | ||
"displayName": "CPU Usage", | ||
"unit": "%", | ||
"counterType": "Metric", | ||
"value": 3 | ||
} | ||
{ | ||
"timestamp": "2021-08-31T16:58:39.7515128+00:00", | ||
"provider": "System.Runtime", | ||
"name": "working-set", | ||
"displayName": "Working Set", | ||
"unit": "MB", | ||
"counterType": "Metric", | ||
"value": 126 | ||
} | ||
{ | ||
"timestamp": "2021-08-31T16:58:39.7515232+00:00", | ||
"provider": "System.Runtime", | ||
"name": "gc-heap-size", | ||
"displayName": "GC Heap Size", | ||
"unit": "MB", | ||
"counterType": "Metric", | ||
"value": 16 | ||
} | ||
``` | ||
|
||
## Supported Runtimes | ||
|
||
| Operating System | Runtime Version | | ||
|---|---| | ||
| Windows | .NET Core 3.1, .NET 5+ | | ||
| Linux | .NET Core 3.1, .NET 5+ | | ||
| MacOS | .NET Core 3.1, .NET 5+ | | ||
|
||
## Additional Notes | ||
|
||
### When to use `pid` vs `uid` | ||
|
||
See [Process ID `pid` vs Unique ID `uid`](pidvsuid.md) for clarification on when it is best to use either parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Collect Metrics | ||
|
||
| Operation | Description | | ||
|---|---| | ||
| [Collect Metrics](collectmetrics-get.md) | Captures metrics using the default metric providers. | | ||
| [Collect Custom Metrics](collectmetrics-custom.md) | Captures metrics using custom metric providers. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.