The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import type * as Credentials from "@distilled.cloud/aws/Credentials"; |
| 2 | import type * as SigV4 from "@distilled.cloud/aws/SigV4"; |
| 3 | import * as Binding from "alchemy/Binding"; |
| 4 | import type { SourceError } from "effect/ConfigProvider"; |
| 5 | import type * as Effect from "effect/Effect"; |
| 6 | import type { PrometheusApiError, PrometheusMetricMetadata } from "./PrometheusTypes.ts"; |
| 7 | import type { Workspace } from "./Workspace.ts"; |
| 8 | |
| 9 | export interface GetMetricMetadataRequest { |
| 10 | /** Restrict metadata to one metric name. */ |
| 11 | metric?: string; |
| 12 | /** Maximum number of metrics to return. */ |
| 13 | limit?: number; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Runtime binding for `aps:GetMetricMetadata` — read metric metadata (type, |
| 18 | * help, unit) from an AMP {@link Workspace}'s Prometheus-compatible |
| 19 | * `api/v1/metadata` endpoint, SigV4-signed with the host Function's |
| 20 | * credentials. |
| 21 | * |
| 22 | * ### Reading Metric Metadata |
| 23 | * **Example:** All Metric Metadata |
| 24 | * ```typescript |
| 25 | * const getMetricMetadata = yield* AMP.GetMetricMetadata(workspace); |
| 26 | * const metadata = yield* getMetricMetadata({}); |
| 27 | * // { http_requests_total: [{ type: "counter", help: "...", unit: "" }], ... } |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetMetricMetadata extends Binding.Service< |
| 33 | GetMetricMetadata, |
| 34 | "AWS.AMP.GetMetricMetadata", |
| 35 | ( |
| 36 | workspace: Workspace, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: GetMetricMetadataRequest, |
| 40 | ) => Effect.Effect< |
| 41 | Record<string, PrometheusMetricMetadata[]>, |
| 42 | PrometheusApiError | Credentials.CredentialsError | SourceError | SigV4.SigningError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const GetMetricMetadata = Binding.Service<GetMetricMetadata>("AWS.AMP.GetMetricMetadata"); |