@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 47 lines 1.67 KB
Raw
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, PrometheusSeries, PrometheusTime } from "./PrometheusTypes.ts";
7 import type { Workspace } from "./Workspace.ts";
8
9 export interface GetSeriesRequest {
10 /** Series selectors — at least one is required, e.g. `['up', 'job:.*']`. */
11 match: string[];
12 /** Start of the lookup range. A `Date`, Unix seconds, or RFC 3339 string. */
13 start?: PrometheusTime;
14 /** End of the lookup range. A `Date`, Unix seconds, or RFC 3339 string. */
15 end?: PrometheusTime;
16 }
17
18 /**
19 * Runtime binding for `aps:GetSeries` — find series (full label sets) that
20 * match a selector via an AMP {@link Workspace}'s Prometheus-compatible
21 * `api/v1/series` endpoint, SigV4-signed with the host Function's credentials.
22 *
23 * ### Finding Series
24 * **Example:** Match Series by Selector
25 * ```typescript
26 * const getSeries = yield* AMP.GetSeries(workspace);
27 * const series = yield* getSeries({ match: ['{__name__="up"}'] });
28 * // [{ __name__: "up", job: "api", instance: "..." }, ...]
29 * ```
30 *
31 * @binding
32 */
33 export interface GetSeries extends Binding.Service<
34 GetSeries,
35 "AWS.AMP.GetSeries",
36 (
37 workspace: Workspace,
38 ) => Effect.Effect<
39 (
40 request: GetSeriesRequest,
41 ) => Effect.Effect<
42 PrometheusSeries[],
43 PrometheusApiError | Credentials.CredentialsError | SourceError | SigV4.SigningError
44 >
45 >
46 > {}
47 export const GetSeries = Binding.Service<GetSeries>("AWS.AMP.GetSeries");