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

feat: add dependency metrics #774

Merged
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
25 changes: 17 additions & 8 deletions docs/reference/instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ Metrics Types:
- Gauge: Point-in-time value of a continuous data stream (e.g file system size, speed, pressure)
- Histogram: Aggregation of counters where each bin is bounded from the min value (0) to the upper bin boundary. For example if we had bin boundaries [0, 1, 2, 3, 4, 5] and the measured value is 3.5, then the resulting histogram would be [0, 0, 0, 1, 1].

| Name | Type | Unit | Description |
|:---------------------------:| --------- |:------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ratify_verification_request | Histogram | milliseconds | Duration of a single request to the `/verify` endpoint. Histogram bins: [0, 10, 30, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2300, 2600, 4000, 4400, 4900] |
| ratify_mutation_request | Histogram | milliseconds | Duration of a single request to the `/mutate` endpoint. Histogram bins: [0, 10, 30, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800] |
| ratify_verifier_duration | Histogram | milliseconds | Duration of a single verifier's execution for a single referrer artifact. Histogram bins: [0, 10, 50, 100, 200, 300, 400, 600, 800, 1100, 1500, 2000] |
| ratify_system_error_count | Counter | N/A | Count of errors emitted by http handlers |

| Name | Type | Unit | Attributes | Description |
|:-----------------------------:| --------- |:------------:| ---------------------------------------------------------------------------------------------------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| ratify_verification_request | Histogram | milliseconds | N/A | Duration of a single request to the `/verify` endpoint. Histogram bins: `[0, 10, 30, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800, 2000, 2300, 2600, 4000, 4400, 4900]` |
| ratify_mutation_request | Histogram | milliseconds | N/A | Duration of a single request to the `/mutate` endpoint. Histogram bins: `[0, 10, 30, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 1800]` |
| ratify_verifier_duration | Histogram | milliseconds | `verifier`: name of the verifier <br/> `subject`: full subject reference <br/> `success`: verifier result <br/> `error`: if operation returned error | Duration of a single verifier's execution for a single referrer artifact. Histogram bins: `[0, 10, 50, 100, 200, 300, 400, 600, 800, 1100, 1500, 2000]` |
| ratify_system_error_count | Counter | N/A | `error`: error message | Count of errors emitted by http handlers |
| ratify_registry_request_count | Counter | N/A | `status_code`: registry request status code <br/> `registry_host`: registry host name | Count of requests made to registry |
| ratify_blob_cache_count | Counter | N/A | `hit`: boolean cache hit | Count of ORAS blob cache hit/miss | |

### Azure Metrics

| Name | Type | Unit | Attributes | Description |
| ------------------------------- | --------- | ------------ | --------------------------------------------------------------- | --------------------------------------------------------------- |
| ratify_aad_exchange_duration | Histogram | milliseconds | `resource_type`: resource scope (ACR vs AKV) | Duration of federated JWT exchange for AAD resource scope token |
| ratify_acr_exchange_duration | Histogram | milliseconds | `repository`: full ACR repository name for token exchange scope | Duration of exchange of AAD token for ACR refresh token |
| ratify_akv_certificate_duration | Histogram | milliseconds | `certificate_name`: name of AKV certificate object | Duration of AKV certificate fetch operation |

## Metrics Providers Supported

Expand Down Expand Up @@ -89,4 +98,4 @@ Prior to installing Ratify on the cluster:
>Note: There is only support for a single metric exporter at a time

Additional metrics exporters can be added as metrics backends.
The exporter must be initialized in the `InitMetricsExporter` method as a new exporter type. Each exporter type is determined from the `metricsBackend` parameter. During metric exporter initialization a new metric reader must be instantiated and assigned to the static global variable `MetricsReader`. Once registered, the global `MetricsReader` is used to initialize OpenTelemetry meter and instruments.
The exporter must be initialized in the `InitMetricsExporter` method as a new exporter type. Each exporter type is determined from the `metricsBackend` parameter. During metric exporter initialization a new metric reader must be instantiated and assigned to the static global variable `MetricsReader`. Once registered, the global `MetricsReader` is used to initialize OpenTelemetry meter and instruments.
Loading