alchemy 2.0.0-beta.18 → 2.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/alchemy.js +428 -80
- package/bin/alchemy.js.map +1 -1
- package/bin/alchemy.ts +2 -0
- package/bin/commands/_shared.ts +34 -0
- package/bin/commands/bootstrap.ts +10 -3
- package/bin/commands/deploy.ts +23 -3
- package/bin/commands/login.ts +18 -3
- package/bin/commands/logs.ts +11 -2
- package/bin/commands/profile.ts +11 -5
- package/bin/commands/state.ts +21 -13
- package/bin/commands/tail.ts +10 -2
- package/lib/Agent/lsp/client.d.ts +2 -2
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +41 -9
- package/lib/Apply.js.map +1 -1
- package/lib/Axiom/Annotation.d.ts +49 -0
- package/lib/Axiom/Annotation.d.ts.map +1 -0
- package/lib/Axiom/Annotation.js +74 -0
- package/lib/Axiom/Annotation.js.map +1 -0
- package/lib/Axiom/ApiToken.d.ts +62 -0
- package/lib/Axiom/ApiToken.d.ts.map +1 -0
- package/lib/Axiom/ApiToken.js +98 -0
- package/lib/Axiom/ApiToken.js.map +1 -0
- package/lib/Axiom/AuthProvider.d.ts +48 -0
- package/lib/Axiom/AuthProvider.d.ts.map +1 -0
- package/lib/Axiom/AuthProvider.js +177 -0
- package/lib/Axiom/AuthProvider.js.map +1 -0
- package/lib/Axiom/Chart.d.ts +72 -0
- package/lib/Axiom/Chart.d.ts.map +1 -0
- package/lib/Axiom/Chart.js +14 -0
- package/lib/Axiom/Chart.js.map +1 -0
- package/lib/Axiom/Credentials.d.ts +12 -0
- package/lib/Axiom/Credentials.d.ts.map +1 -0
- package/lib/Axiom/Credentials.js +34 -0
- package/lib/Axiom/Credentials.js.map +1 -0
- package/lib/Axiom/Dashboard.d.ts +124 -0
- package/lib/Axiom/Dashboard.d.ts.map +1 -0
- package/lib/Axiom/Dashboard.js +140 -0
- package/lib/Axiom/Dashboard.js.map +1 -0
- package/lib/Axiom/Dataset.d.ts +101 -0
- package/lib/Axiom/Dataset.d.ts.map +1 -0
- package/lib/Axiom/Dataset.js +183 -0
- package/lib/Axiom/Dataset.js.map +1 -0
- package/lib/Axiom/Monitor.d.ts +74 -0
- package/lib/Axiom/Monitor.d.ts.map +1 -0
- package/lib/Axiom/Monitor.js +103 -0
- package/lib/Axiom/Monitor.js.map +1 -0
- package/lib/Axiom/Notifier.d.ts +63 -0
- package/lib/Axiom/Notifier.d.ts.map +1 -0
- package/lib/Axiom/Notifier.js +83 -0
- package/lib/Axiom/Notifier.js.map +1 -0
- package/lib/Axiom/Providers.d.ts +15 -0
- package/lib/Axiom/Providers.d.ts.map +1 -0
- package/lib/Axiom/Providers.js +32 -0
- package/lib/Axiom/Providers.js.map +1 -0
- package/lib/Axiom/View.d.ts +55 -0
- package/lib/Axiom/View.d.ts.map +1 -0
- package/lib/Axiom/View.js +79 -0
- package/lib/Axiom/View.js.map +1 -0
- package/lib/Axiom/VirtualField.d.ts +42 -0
- package/lib/Axiom/VirtualField.d.ts.map +1 -0
- package/lib/Axiom/VirtualField.js +71 -0
- package/lib/Axiom/VirtualField.js.map +1 -0
- package/lib/Axiom/index.d.ts +13 -0
- package/lib/Axiom/index.d.ts.map +1 -0
- package/lib/Axiom/index.js +13 -0
- package/lib/Axiom/index.js.map +1 -0
- package/lib/Bundle/Bundle.d.ts +20 -2
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +18 -3
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts +109 -0
- package/lib/Bundle/PurePlugin.d.ts.map +1 -0
- package/lib/Bundle/PurePlugin.js +469 -0
- package/lib/Bundle/PurePlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +1 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +1 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +12 -0
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +19 -4
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +1 -1
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +10 -4
- package/lib/Plan.js.map +1 -1
- package/lib/Resource.d.ts +2 -2
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Telemetry/Attributes.d.ts +43 -0
- package/lib/Telemetry/Attributes.d.ts.map +1 -0
- package/lib/Telemetry/Attributes.js +144 -0
- package/lib/Telemetry/Attributes.js.map +1 -0
- package/lib/Telemetry/Layer.d.ts +14 -0
- package/lib/Telemetry/Layer.d.ts.map +1 -0
- package/lib/Telemetry/Layer.js +50 -0
- package/lib/Telemetry/Layer.js.map +1 -0
- package/lib/Telemetry/Metrics.d.ts +34 -0
- package/lib/Telemetry/Metrics.d.ts.map +1 -0
- package/lib/Telemetry/Metrics.js +57 -0
- package/lib/Telemetry/Metrics.js.map +1 -0
- package/package.json +12 -1
- package/src/Apply.ts +118 -9
- package/src/Axiom/Annotation.ts +95 -0
- package/src/Axiom/ApiToken.ts +125 -0
- package/src/Axiom/AuthProvider.ts +341 -0
- package/src/Axiom/Chart.ts +94 -0
- package/src/Axiom/Credentials.ts +70 -0
- package/src/Axiom/Dashboard.ts +192 -0
- package/src/Axiom/Dataset.ts +291 -0
- package/src/Axiom/Monitor.ts +122 -0
- package/src/Axiom/Notifier.ts +104 -0
- package/src/Axiom/Providers.ts +58 -0
- package/src/Axiom/View.ts +106 -0
- package/src/Axiom/VirtualField.ts +90 -0
- package/src/Axiom/index.ts +12 -0
- package/src/Bundle/Bundle.ts +39 -1
- package/src/Bundle/PurePlugin.ts +556 -0
- package/src/Bundle/index.ts +1 -0
- package/src/Cloudflare/Workers/Worker.ts +37 -6
- package/src/Output.ts +2 -1
- package/src/Plan.ts +13 -4
- package/src/Resource.ts +2 -2
- package/src/Telemetry/Attributes.ts +216 -0
- package/src/Telemetry/Layer.ts +65 -0
- package/src/Telemetry/Metrics.ts +101 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as Provider from "../Provider.ts";
|
|
2
|
+
import { Resource } from "../Resource.ts";
|
|
3
|
+
import type { Providers } from "./Providers.ts";
|
|
4
|
+
export type DatasetKind = "otel:metrics:v1" | "otel:traces:v1" | "otel:logs:v1" | "axiom:events:v1";
|
|
5
|
+
export type DatasetProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Dataset name. Used as the dataset's stable identifier in Axiom — changing
|
|
8
|
+
* this triggers a replacement.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/** Free-form description shown in the Axiom UI. */
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Dataset kind. Defaults to `axiom:events:v1`.
|
|
15
|
+
*
|
|
16
|
+
* For OTEL pipelines, choose:
|
|
17
|
+
* - `otel:traces:v1` for traces
|
|
18
|
+
* - `otel:logs:v1` for logs
|
|
19
|
+
* - `otel:metrics:v1` for metrics
|
|
20
|
+
*
|
|
21
|
+
* Cannot be changed after creation — triggers a replacement.
|
|
22
|
+
*/
|
|
23
|
+
kind?: DatasetKind;
|
|
24
|
+
/** Retention in days. Plan-dependent — see Axiom docs. */
|
|
25
|
+
retentionDays?: number;
|
|
26
|
+
/** Whether to enforce the configured retention period. */
|
|
27
|
+
useRetentionPeriod?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type Dataset = Resource<"Axiom.Dataset", DatasetProps, {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
kind: DatasetKind;
|
|
33
|
+
description: string;
|
|
34
|
+
created: string;
|
|
35
|
+
apiBaseUrl: string;
|
|
36
|
+
/** Root OTLP endpoint (`${apiBaseUrl}`). Most exporters auto-append the signal path. */
|
|
37
|
+
otelEndpoint: string;
|
|
38
|
+
/** OTLP/HTTP traces endpoint. */
|
|
39
|
+
otelTracesEndpoint: string;
|
|
40
|
+
/** OTLP/HTTP logs endpoint. */
|
|
41
|
+
otelLogsEndpoint: string;
|
|
42
|
+
/** OTLP/HTTP metrics endpoint. */
|
|
43
|
+
otelMetricsEndpoint: string;
|
|
44
|
+
/**
|
|
45
|
+
* Headers required for OTLP shipping aside from the bearer token.
|
|
46
|
+
* Add `Authorization: Bearer <AXIOM_TOKEN>` separately at runtime so the
|
|
47
|
+
* secret is never persisted in resource state.
|
|
48
|
+
*/
|
|
49
|
+
otelHeaders: Record<string, string>;
|
|
50
|
+
}, never, Providers>;
|
|
51
|
+
/**
|
|
52
|
+
* An Axiom dataset — the top-level container that stores events, logs,
|
|
53
|
+
* traces, or metrics. Pick a `kind` up-front: it determines schema and how
|
|
54
|
+
* the data is shown in the UI, and **cannot be changed** after creation
|
|
55
|
+
* (changing it triggers a replacement, which deletes the data).
|
|
56
|
+
*
|
|
57
|
+
* Datasets expose Axiom's OTLP/HTTP endpoints (`otelTracesEndpoint`,
|
|
58
|
+
* `otelLogsEndpoint`, `otelMetricsEndpoint`) as output attributes so you can
|
|
59
|
+
* inject them into a Worker / Lambda's env vars for OpenTelemetry shipping.
|
|
60
|
+
* The bearer token is **not** stored in resource state — supply
|
|
61
|
+
* `Authorization: Bearer <AXIOM_TOKEN>` separately at runtime.
|
|
62
|
+
*
|
|
63
|
+
* @see https://axiom.co/docs/reference/datasets
|
|
64
|
+
* @see https://axiom.co/docs/send-data/opentelemetry — OTLP endpoint reference
|
|
65
|
+
*
|
|
66
|
+
* @section Creating a Dataset
|
|
67
|
+
* @example Logs dataset with 30-day retention
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const logs = yield* Axiom.Dataset("app-logs", {
|
|
70
|
+
* name: "my-app-logs",
|
|
71
|
+
* kind: "otel:logs:v1",
|
|
72
|
+
* description: "Application logs from prod workers",
|
|
73
|
+
* retentionDays: 30,
|
|
74
|
+
* useRetentionPeriod: true,
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Separate datasets per OTEL signal
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const traces = yield* Axiom.Dataset("traces", { name: "app-traces", kind: "otel:traces:v1" });
|
|
81
|
+
* const logs = yield* Axiom.Dataset("logs", { name: "app-logs", kind: "otel:logs:v1" });
|
|
82
|
+
* const metrics = yield* Axiom.Dataset("metrics", { name: "app-metrics", kind: "otel:metrics:v1" });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @section Shipping OTEL data
|
|
86
|
+
* @example Wire OTEL env vars into a Cloudflare Worker
|
|
87
|
+
* ```typescript
|
|
88
|
+
* yield* Cloudflare.Worker("api", {
|
|
89
|
+
* vars: {
|
|
90
|
+
* OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: traces.otelTracesEndpoint,
|
|
91
|
+
* OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: logs.otelLogsEndpoint,
|
|
92
|
+
* // Bearer token must come from a secret store, not the dataset state.
|
|
93
|
+
* OTEL_EXPORTER_OTLP_HEADERS:
|
|
94
|
+
* `Authorization=Bearer ${env.AXIOM_TOKEN},X-Axiom-Dataset=${traces.name}`,
|
|
95
|
+
* },
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare const Dataset: import("../Resource.ts").ResourceClass<Dataset>;
|
|
100
|
+
export declare const DatasetProvider: () => import("effect/Layer").Layer<Provider.Provider<Dataset>, never, any>;
|
|
101
|
+
//# sourceMappingURL=Dataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dataset.d.ts","sourceRoot":"","sources":["../../src/Axiom/Dataset.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,iBAAiB,CAAC;AAEtB,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,QAAQ,CAC5B,eAAe,EACf,YAAY,EACZ;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+BAA+B;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,EACD,KAAK,EACL,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,OAAO,iDAAqC,CAAC;AA8C1D,eAAO,MAAM,eAAe,4EA4HzB,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Credentials } from "@distilled.cloud/axiom/Credentials";
|
|
2
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
5
|
+
import { AdoptPolicy } from "../AdoptPolicy.js";
|
|
6
|
+
import { isResolved } from "../Diff.js";
|
|
7
|
+
import * as Provider from "../Provider.js";
|
|
8
|
+
import { Resource } from "../Resource.js";
|
|
9
|
+
import { Stack } from "../Stack.js";
|
|
10
|
+
import { Stage } from "../Stage.js";
|
|
11
|
+
/**
|
|
12
|
+
* An Axiom dataset — the top-level container that stores events, logs,
|
|
13
|
+
* traces, or metrics. Pick a `kind` up-front: it determines schema and how
|
|
14
|
+
* the data is shown in the UI, and **cannot be changed** after creation
|
|
15
|
+
* (changing it triggers a replacement, which deletes the data).
|
|
16
|
+
*
|
|
17
|
+
* Datasets expose Axiom's OTLP/HTTP endpoints (`otelTracesEndpoint`,
|
|
18
|
+
* `otelLogsEndpoint`, `otelMetricsEndpoint`) as output attributes so you can
|
|
19
|
+
* inject them into a Worker / Lambda's env vars for OpenTelemetry shipping.
|
|
20
|
+
* The bearer token is **not** stored in resource state — supply
|
|
21
|
+
* `Authorization: Bearer <AXIOM_TOKEN>` separately at runtime.
|
|
22
|
+
*
|
|
23
|
+
* @see https://axiom.co/docs/reference/datasets
|
|
24
|
+
* @see https://axiom.co/docs/send-data/opentelemetry — OTLP endpoint reference
|
|
25
|
+
*
|
|
26
|
+
* @section Creating a Dataset
|
|
27
|
+
* @example Logs dataset with 30-day retention
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const logs = yield* Axiom.Dataset("app-logs", {
|
|
30
|
+
* name: "my-app-logs",
|
|
31
|
+
* kind: "otel:logs:v1",
|
|
32
|
+
* description: "Application logs from prod workers",
|
|
33
|
+
* retentionDays: 30,
|
|
34
|
+
* useRetentionPeriod: true,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example Separate datasets per OTEL signal
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const traces = yield* Axiom.Dataset("traces", { name: "app-traces", kind: "otel:traces:v1" });
|
|
41
|
+
* const logs = yield* Axiom.Dataset("logs", { name: "app-logs", kind: "otel:logs:v1" });
|
|
42
|
+
* const metrics = yield* Axiom.Dataset("metrics", { name: "app-metrics", kind: "otel:metrics:v1" });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @section Shipping OTEL data
|
|
46
|
+
* @example Wire OTEL env vars into a Cloudflare Worker
|
|
47
|
+
* ```typescript
|
|
48
|
+
* yield* Cloudflare.Worker("api", {
|
|
49
|
+
* vars: {
|
|
50
|
+
* OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: traces.otelTracesEndpoint,
|
|
51
|
+
* OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: logs.otelLogsEndpoint,
|
|
52
|
+
* // Bearer token must come from a secret store, not the dataset state.
|
|
53
|
+
* OTEL_EXPORTER_OTLP_HEADERS:
|
|
54
|
+
* `Authorization=Bearer ${env.AXIOM_TOKEN},X-Axiom-Dataset=${traces.name}`,
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export const Dataset = Resource("Axiom.Dataset");
|
|
60
|
+
/**
|
|
61
|
+
* Axiom has no tags/labels API. The only writable field we can use to mark
|
|
62
|
+
* ownership is `description`. We append a deterministic marker on create so
|
|
63
|
+
* that on a re-apply (e.g. state was wiped) we can safely identify a dataset
|
|
64
|
+
* that **we** previously created and adopt it idempotently — without
|
|
65
|
+
* accidentally hijacking a dataset created by someone else with the same name.
|
|
66
|
+
*/
|
|
67
|
+
const MARKER_RE = /\s*\[alchemy:stack=([^;]+);stage=([^;]+);id=([^\]]+)\]\s*$/;
|
|
68
|
+
const buildMarker = (stack, stage, id) => `[alchemy:stack=${stack};stage=${stage};id=${id}]`;
|
|
69
|
+
const augmentDescription = (description, marker) => {
|
|
70
|
+
const base = stripMarker(description ?? "");
|
|
71
|
+
return base.length > 0 ? `${base}\n${marker}` : marker;
|
|
72
|
+
};
|
|
73
|
+
const stripMarker = (description) => description.replace(MARKER_RE, "").trimEnd();
|
|
74
|
+
const parseMarker = (description) => {
|
|
75
|
+
if (!description)
|
|
76
|
+
return undefined;
|
|
77
|
+
const m = description.match(MARKER_RE);
|
|
78
|
+
if (!m)
|
|
79
|
+
return undefined;
|
|
80
|
+
return { stack: m[1], stage: m[2], id: m[3] };
|
|
81
|
+
};
|
|
82
|
+
const buildOtelAttrs = (apiBaseUrl, name) => {
|
|
83
|
+
const root = apiBaseUrl.replace(/\/$/, "");
|
|
84
|
+
return {
|
|
85
|
+
apiBaseUrl: root,
|
|
86
|
+
otelEndpoint: root,
|
|
87
|
+
otelTracesEndpoint: `${root}/v1/traces`,
|
|
88
|
+
otelLogsEndpoint: `${root}/v1/logs`,
|
|
89
|
+
otelMetricsEndpoint: `${root}/v1/metrics`,
|
|
90
|
+
otelHeaders: { "X-Axiom-Dataset": name },
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export const DatasetProvider = () => Provider.effect(Dataset, Effect.gen(function* () {
|
|
94
|
+
const { apiBaseUrl } = yield* Credentials;
|
|
95
|
+
const create = yield* Operations.createDataset;
|
|
96
|
+
const update = yield* Operations.updateDataset;
|
|
97
|
+
const get = yield* Operations.getDataset;
|
|
98
|
+
const del = yield* Operations.deleteDataset;
|
|
99
|
+
const toAttrs = (dataset) => ({
|
|
100
|
+
id: dataset.id,
|
|
101
|
+
name: dataset.name,
|
|
102
|
+
kind: dataset.kind,
|
|
103
|
+
description: stripMarker(dataset.description),
|
|
104
|
+
created: dataset.created,
|
|
105
|
+
...buildOtelAttrs(apiBaseUrl, dataset.name),
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
stables: ["id", "name", "kind"],
|
|
109
|
+
diff: Effect.fn(function* ({ olds, news, output }) {
|
|
110
|
+
if (!isResolved(news))
|
|
111
|
+
return undefined;
|
|
112
|
+
if (output && news.name !== output.name) {
|
|
113
|
+
return { action: "replace" };
|
|
114
|
+
}
|
|
115
|
+
if (news.kind && output && news.kind !== output.kind) {
|
|
116
|
+
return { action: "replace" };
|
|
117
|
+
}
|
|
118
|
+
if (news.description !== olds?.description ||
|
|
119
|
+
news.retentionDays !== olds?.retentionDays ||
|
|
120
|
+
news.useRetentionPeriod !== olds?.useRetentionPeriod) {
|
|
121
|
+
return { action: "update" };
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}),
|
|
125
|
+
create: Effect.fn(function* ({ id, news }) {
|
|
126
|
+
const stack = yield* Stack;
|
|
127
|
+
const stage = yield* Stage;
|
|
128
|
+
const adoptPolicy = yield* Effect.serviceOption(AdoptPolicy).pipe(Effect.map(Option.getOrElse(() => false)));
|
|
129
|
+
const marker = buildMarker(stack.name, stage, id);
|
|
130
|
+
const dataset = yield* create({
|
|
131
|
+
name: news.name,
|
|
132
|
+
description: augmentDescription(news.description, marker),
|
|
133
|
+
kind: news.kind,
|
|
134
|
+
retentionDays: news.retentionDays,
|
|
135
|
+
useRetentionPeriod: news.useRetentionPeriod,
|
|
136
|
+
}).pipe(Effect.catchIf((e) => e._tag === "Conflict" || e._tag === "UnprocessableEntity", () => Effect.gen(function* () {
|
|
137
|
+
const existing = yield* get({ dataset_id: news.name });
|
|
138
|
+
const ownership = parseMarker(existing.description);
|
|
139
|
+
const isOurs = ownership !== undefined &&
|
|
140
|
+
ownership.stack === stack.name &&
|
|
141
|
+
ownership.stage === stage &&
|
|
142
|
+
ownership.id === id;
|
|
143
|
+
if (isOurs || adoptPolicy) {
|
|
144
|
+
// Re-apply the user's desired props (and re-stamp marker)
|
|
145
|
+
// so adoption is idempotent and Axiom-side state matches
|
|
146
|
+
// the resource spec.
|
|
147
|
+
return yield* update({
|
|
148
|
+
dataset_id: existing.id,
|
|
149
|
+
description: augmentDescription(news.description, marker),
|
|
150
|
+
retentionDays: news.retentionDays,
|
|
151
|
+
useRetentionPeriod: news.useRetentionPeriod,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return yield* Effect.die(new Error(`Axiom dataset "${news.name}" already exists and was ` +
|
|
155
|
+
`not created by this stack (${stack.name}/${stage}/${id}). ` +
|
|
156
|
+
`Pipe the resource through \`adopt()\` from "alchemy/AdoptPolicy" ` +
|
|
157
|
+
`to take ownership, or delete the dataset in Axiom and retry.`));
|
|
158
|
+
})));
|
|
159
|
+
return toAttrs(dataset);
|
|
160
|
+
}),
|
|
161
|
+
update: Effect.fn(function* ({ id, news, output }) {
|
|
162
|
+
const stack = yield* Stack;
|
|
163
|
+
const stage = yield* Stage;
|
|
164
|
+
const marker = buildMarker(stack.name, stage, id);
|
|
165
|
+
const dataset = yield* update({
|
|
166
|
+
dataset_id: output.id,
|
|
167
|
+
description: augmentDescription(news.description, marker),
|
|
168
|
+
retentionDays: news.retentionDays,
|
|
169
|
+
useRetentionPeriod: news.useRetentionPeriod,
|
|
170
|
+
});
|
|
171
|
+
return toAttrs(dataset);
|
|
172
|
+
}),
|
|
173
|
+
delete: Effect.fn(function* ({ output }) {
|
|
174
|
+
yield* del({ dataset_id: output.id }).pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
175
|
+
}),
|
|
176
|
+
read: Effect.fn(function* ({ output }) {
|
|
177
|
+
if (!output?.id)
|
|
178
|
+
return undefined;
|
|
179
|
+
return yield* get({ dataset_id: output.id }).pipe(Effect.map(toAttrs), Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
|
|
180
|
+
}),
|
|
181
|
+
};
|
|
182
|
+
}));
|
|
183
|
+
//# sourceMappingURL=Dataset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dataset.js","sourceRoot":"","sources":["../../src/Axiom/Dataset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,M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E,CAAC,CAAC,IAAI,CACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAC/C,CAAC;QACJ,CAAC,CAAC;QACF,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE;YACnC,IAAI,CAAC,MAAM,EAAE,EAAE;gBAAE,OAAO,SAAS,CAAC;YAClC,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAC/C,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EACnB,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAC7D,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
2
|
+
import * as Provider from "../Provider.ts";
|
|
3
|
+
import { Resource } from "../Resource.ts";
|
|
4
|
+
import type { Providers } from "./Providers.ts";
|
|
5
|
+
export type MonitorProps = Operations.CreateMonitorInput;
|
|
6
|
+
export type Monitor = Resource<"Axiom.Monitor", MonitorProps, Operations.CreateMonitorOutput, never, Providers>;
|
|
7
|
+
/**
|
|
8
|
+
* An Axiom monitor — a scheduled APL/MPL query that evaluates on a fixed
|
|
9
|
+
* cadence and fires alerts via {@link Notifier notifiers} when its
|
|
10
|
+
* condition is met.
|
|
11
|
+
*
|
|
12
|
+
* Three monitor `type`s are supported:
|
|
13
|
+
*
|
|
14
|
+
* - **`Threshold`** — fires when an aggregate result crosses a static
|
|
15
|
+
* `threshold` (compared with `operator`).
|
|
16
|
+
* - **`MatchEvent`** — fires for every event matching the query.
|
|
17
|
+
* - **`AnomalyDetection`** — fires when results deviate from a learned
|
|
18
|
+
* baseline by more than `tolerance` over `compareDays`.
|
|
19
|
+
*
|
|
20
|
+
* Changing `type` triggers a replacement; everything else updates in place.
|
|
21
|
+
*
|
|
22
|
+
* @see https://axiom.co/docs/monitor-data/monitors
|
|
23
|
+
*
|
|
24
|
+
* @section Creating a Monitor
|
|
25
|
+
* @example Threshold: alert on >100 errors per 5m
|
|
26
|
+
* ```typescript
|
|
27
|
+
* yield* Axiom.Monitor("error-rate", {
|
|
28
|
+
* name: "High error rate",
|
|
29
|
+
* description: "Fires when error count exceeds 100/5m",
|
|
30
|
+
* type: "Threshold",
|
|
31
|
+
* aplQuery: `
|
|
32
|
+
* ['my-app-traces']
|
|
33
|
+
* | where status >= 500
|
|
34
|
+
* | summarize count() by bin_auto(_time)
|
|
35
|
+
* `,
|
|
36
|
+
* operator: "Above",
|
|
37
|
+
* threshold: 100,
|
|
38
|
+
* intervalMinutes: 5,
|
|
39
|
+
* rangeMinutes: 5,
|
|
40
|
+
* alertOnNoData: false,
|
|
41
|
+
* resolvable: true,
|
|
42
|
+
* notifierIds: [slack.id, pagerduty.id],
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example MatchEvent: alert on every panic
|
|
47
|
+
* ```typescript
|
|
48
|
+
* yield* Axiom.Monitor("panics", {
|
|
49
|
+
* name: "Service panic",
|
|
50
|
+
* type: "MatchEvent",
|
|
51
|
+
* aplQuery: `['my-app-logs'] | where message contains "panic:"`,
|
|
52
|
+
* intervalMinutes: 1,
|
|
53
|
+
* rangeMinutes: 1,
|
|
54
|
+
* notifierIds: [pagerduty.id],
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example AnomalyDetection: deviation vs. last 7 days
|
|
59
|
+
* ```typescript
|
|
60
|
+
* yield* Axiom.Monitor("traffic-anomaly", {
|
|
61
|
+
* name: "Traffic anomaly",
|
|
62
|
+
* type: "AnomalyDetection",
|
|
63
|
+
* aplQuery: `['my-app-traces'] | summarize count() by bin_auto(_time)`,
|
|
64
|
+
* compareDays: 7,
|
|
65
|
+
* tolerance: 25, // %
|
|
66
|
+
* intervalMinutes: 15,
|
|
67
|
+
* rangeMinutes: 15,
|
|
68
|
+
* notifierIds: [slack.id],
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare const Monitor: import("../Resource.ts").ResourceClass<Monitor>;
|
|
73
|
+
export declare const MonitorProvider: () => import("effect/Layer").Layer<Provider.Provider<Monitor>, never, any>;
|
|
74
|
+
//# sourceMappingURL=Monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Monitor.d.ts","sourceRoot":"","sources":["../../src/Axiom/Monitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAEhE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,kBAAkB,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAC5B,eAAe,EACf,YAAY,EACZ,UAAU,CAAC,mBAAmB,EAC9B,KAAK,EACL,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,eAAO,MAAM,OAAO,iDAAqC,CAAC;AAE1D,eAAO,MAAM,eAAe,4EAqCzB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Provider from "../Provider.js";
|
|
4
|
+
import { Resource } from "../Resource.js";
|
|
5
|
+
import { isResolved } from "../Diff.js";
|
|
6
|
+
/**
|
|
7
|
+
* An Axiom monitor — a scheduled APL/MPL query that evaluates on a fixed
|
|
8
|
+
* cadence and fires alerts via {@link Notifier notifiers} when its
|
|
9
|
+
* condition is met.
|
|
10
|
+
*
|
|
11
|
+
* Three monitor `type`s are supported:
|
|
12
|
+
*
|
|
13
|
+
* - **`Threshold`** — fires when an aggregate result crosses a static
|
|
14
|
+
* `threshold` (compared with `operator`).
|
|
15
|
+
* - **`MatchEvent`** — fires for every event matching the query.
|
|
16
|
+
* - **`AnomalyDetection`** — fires when results deviate from a learned
|
|
17
|
+
* baseline by more than `tolerance` over `compareDays`.
|
|
18
|
+
*
|
|
19
|
+
* Changing `type` triggers a replacement; everything else updates in place.
|
|
20
|
+
*
|
|
21
|
+
* @see https://axiom.co/docs/monitor-data/monitors
|
|
22
|
+
*
|
|
23
|
+
* @section Creating a Monitor
|
|
24
|
+
* @example Threshold: alert on >100 errors per 5m
|
|
25
|
+
* ```typescript
|
|
26
|
+
* yield* Axiom.Monitor("error-rate", {
|
|
27
|
+
* name: "High error rate",
|
|
28
|
+
* description: "Fires when error count exceeds 100/5m",
|
|
29
|
+
* type: "Threshold",
|
|
30
|
+
* aplQuery: `
|
|
31
|
+
* ['my-app-traces']
|
|
32
|
+
* | where status >= 500
|
|
33
|
+
* | summarize count() by bin_auto(_time)
|
|
34
|
+
* `,
|
|
35
|
+
* operator: "Above",
|
|
36
|
+
* threshold: 100,
|
|
37
|
+
* intervalMinutes: 5,
|
|
38
|
+
* rangeMinutes: 5,
|
|
39
|
+
* alertOnNoData: false,
|
|
40
|
+
* resolvable: true,
|
|
41
|
+
* notifierIds: [slack.id, pagerduty.id],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example MatchEvent: alert on every panic
|
|
46
|
+
* ```typescript
|
|
47
|
+
* yield* Axiom.Monitor("panics", {
|
|
48
|
+
* name: "Service panic",
|
|
49
|
+
* type: "MatchEvent",
|
|
50
|
+
* aplQuery: `['my-app-logs'] | where message contains "panic:"`,
|
|
51
|
+
* intervalMinutes: 1,
|
|
52
|
+
* rangeMinutes: 1,
|
|
53
|
+
* notifierIds: [pagerduty.id],
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example AnomalyDetection: deviation vs. last 7 days
|
|
58
|
+
* ```typescript
|
|
59
|
+
* yield* Axiom.Monitor("traffic-anomaly", {
|
|
60
|
+
* name: "Traffic anomaly",
|
|
61
|
+
* type: "AnomalyDetection",
|
|
62
|
+
* aplQuery: `['my-app-traces'] | summarize count() by bin_auto(_time)`,
|
|
63
|
+
* compareDays: 7,
|
|
64
|
+
* tolerance: 25, // %
|
|
65
|
+
* intervalMinutes: 15,
|
|
66
|
+
* rangeMinutes: 15,
|
|
67
|
+
* notifierIds: [slack.id],
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export const Monitor = Resource("Axiom.Monitor");
|
|
72
|
+
export const MonitorProvider = () => Provider.effect(Monitor, Effect.gen(function* () {
|
|
73
|
+
const create = yield* Operations.createMonitor;
|
|
74
|
+
const update = yield* Operations.updateMonitor;
|
|
75
|
+
const get = yield* Operations.getMonitor;
|
|
76
|
+
const del = yield* Operations.deleteMonitor;
|
|
77
|
+
return {
|
|
78
|
+
stables: ["id"],
|
|
79
|
+
diff: Effect.fn(function* ({ news, output }) {
|
|
80
|
+
if (!isResolved(news))
|
|
81
|
+
return undefined;
|
|
82
|
+
if (output && news.type !== output.type) {
|
|
83
|
+
return { action: "replace" };
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}),
|
|
87
|
+
create: Effect.fn(function* ({ news }) {
|
|
88
|
+
return yield* create(news);
|
|
89
|
+
}),
|
|
90
|
+
update: Effect.fn(function* ({ news, output }) {
|
|
91
|
+
return yield* update({ ...news, id: output.id });
|
|
92
|
+
}),
|
|
93
|
+
delete: Effect.fn(function* ({ output }) {
|
|
94
|
+
yield* del({ id: output.id }).pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
95
|
+
}),
|
|
96
|
+
read: Effect.fn(function* ({ output }) {
|
|
97
|
+
if (!output?.id)
|
|
98
|
+
return undefined;
|
|
99
|
+
return yield* get({ id: output.id }).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
}));
|
|
103
|
+
//# sourceMappingURL=Monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Monitor.js","sourceRoot":"","sources":["../../src/Axiom/Monitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAaxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAU,eAAe,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAClC,QAAQ,CAAC,MAAM,CACb,OAAO,EACP,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC;IAC/C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IACzC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC;IAE5C,OAAO;QACL,OAAO,EAAE,CAAC,IAAI,CAA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AAE,CAAC,CAAC,IAAI,CACvC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAC7D,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
2
|
+
import * as Provider from "../Provider.ts";
|
|
3
|
+
import { Resource } from "../Resource.ts";
|
|
4
|
+
import type { Providers } from "./Providers.ts";
|
|
5
|
+
export type NotifierProps = Operations.CreateNotifierInput;
|
|
6
|
+
export type Notifier = Resource<"Axiom.Notifier", NotifierProps, Operations.CreateNotifierOutput & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, never, Providers>;
|
|
9
|
+
/**
|
|
10
|
+
* An Axiom notifier — an alert destination (Slack, email, PagerDuty,
|
|
11
|
+
* Opsgenie, Discord, Microsoft Teams, generic webhook, or a fully custom
|
|
12
|
+
* webhook with templated body/headers) that {@link Monitor monitors} target
|
|
13
|
+
* via `notifierIds`. Exactly one channel under `properties` should be set.
|
|
14
|
+
*
|
|
15
|
+
* @see https://axiom.co/docs/monitor-data/notifiers
|
|
16
|
+
*
|
|
17
|
+
* @section Creating a Notifier
|
|
18
|
+
* @example Slack incoming webhook
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const slack = yield* Axiom.Notifier("ops-slack", {
|
|
21
|
+
* name: "ops-channel",
|
|
22
|
+
* properties: {
|
|
23
|
+
* slack: { slackUrl: process.env.SLACK_WEBHOOK_URL! },
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Email distribution list
|
|
29
|
+
* ```typescript
|
|
30
|
+
* yield* Axiom.Notifier("ops-email", {
|
|
31
|
+
* name: "ops-team",
|
|
32
|
+
* properties: { email: { emails: ["sre@example.com", "oncall@example.com"] } },
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example PagerDuty integration
|
|
37
|
+
* ```typescript
|
|
38
|
+
* yield* Axiom.Notifier("pagerduty", {
|
|
39
|
+
* name: "primary-oncall",
|
|
40
|
+
* properties: {
|
|
41
|
+
* pagerduty: { routingKey: process.env.PAGERDUTY_ROUTING_KEY!, token: "" },
|
|
42
|
+
* },
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Custom webhook with templated body
|
|
47
|
+
* ```typescript
|
|
48
|
+
* yield* Axiom.Notifier("incident-webhook", {
|
|
49
|
+
* name: "incident.io",
|
|
50
|
+
* properties: {
|
|
51
|
+
* customWebhook: {
|
|
52
|
+
* url: "https://api.incident.io/v2/alert_events",
|
|
53
|
+
* headers: { "Content-Type": "application/json" },
|
|
54
|
+
* secretHeaders: { Authorization: `Bearer ${process.env.INCIDENT_TOKEN}` },
|
|
55
|
+
* body: '{"title": "{{.Monitor.Name}}", "status": "firing"}',
|
|
56
|
+
* },
|
|
57
|
+
* },
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare const Notifier: import("../Resource.ts").ResourceClass<Notifier>;
|
|
62
|
+
export declare const NotifierProvider: () => import("effect/Layer").Layer<Provider.Provider<Notifier>, never, any>;
|
|
63
|
+
//# sourceMappingURL=Notifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifier.d.ts","sourceRoot":"","sources":["../../src/Axiom/Notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAEhE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,mBAAmB,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAC7B,gBAAgB,EAChB,aAAa,EACb,UAAU,CAAC,oBAAoB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAChD,KAAK,EACL,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,QAAQ,kDAAuC,CAAC;AAE7D,eAAO,MAAM,gBAAgB,6EAiC1B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Provider from "../Provider.js";
|
|
4
|
+
import { Resource } from "../Resource.js";
|
|
5
|
+
/**
|
|
6
|
+
* An Axiom notifier — an alert destination (Slack, email, PagerDuty,
|
|
7
|
+
* Opsgenie, Discord, Microsoft Teams, generic webhook, or a fully custom
|
|
8
|
+
* webhook with templated body/headers) that {@link Monitor monitors} target
|
|
9
|
+
* via `notifierIds`. Exactly one channel under `properties` should be set.
|
|
10
|
+
*
|
|
11
|
+
* @see https://axiom.co/docs/monitor-data/notifiers
|
|
12
|
+
*
|
|
13
|
+
* @section Creating a Notifier
|
|
14
|
+
* @example Slack incoming webhook
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const slack = yield* Axiom.Notifier("ops-slack", {
|
|
17
|
+
* name: "ops-channel",
|
|
18
|
+
* properties: {
|
|
19
|
+
* slack: { slackUrl: process.env.SLACK_WEBHOOK_URL! },
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Email distribution list
|
|
25
|
+
* ```typescript
|
|
26
|
+
* yield* Axiom.Notifier("ops-email", {
|
|
27
|
+
* name: "ops-team",
|
|
28
|
+
* properties: { email: { emails: ["sre@example.com", "oncall@example.com"] } },
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example PagerDuty integration
|
|
33
|
+
* ```typescript
|
|
34
|
+
* yield* Axiom.Notifier("pagerduty", {
|
|
35
|
+
* name: "primary-oncall",
|
|
36
|
+
* properties: {
|
|
37
|
+
* pagerduty: { routingKey: process.env.PAGERDUTY_ROUTING_KEY!, token: "" },
|
|
38
|
+
* },
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Custom webhook with templated body
|
|
43
|
+
* ```typescript
|
|
44
|
+
* yield* Axiom.Notifier("incident-webhook", {
|
|
45
|
+
* name: "incident.io",
|
|
46
|
+
* properties: {
|
|
47
|
+
* customWebhook: {
|
|
48
|
+
* url: "https://api.incident.io/v2/alert_events",
|
|
49
|
+
* headers: { "Content-Type": "application/json" },
|
|
50
|
+
* secretHeaders: { Authorization: `Bearer ${process.env.INCIDENT_TOKEN}` },
|
|
51
|
+
* body: '{"title": "{{.Monitor.Name}}", "status": "firing"}',
|
|
52
|
+
* },
|
|
53
|
+
* },
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export const Notifier = Resource("Axiom.Notifier");
|
|
58
|
+
export const NotifierProvider = () => Provider.effect(Notifier, Effect.gen(function* () {
|
|
59
|
+
const create = yield* Operations.createNotifier;
|
|
60
|
+
const update = yield* Operations.updateNotifier;
|
|
61
|
+
const get = yield* Operations.getNotifier;
|
|
62
|
+
const del = yield* Operations.deleteNotifier;
|
|
63
|
+
return {
|
|
64
|
+
stables: ["id"],
|
|
65
|
+
create: Effect.fn(function* ({ news }) {
|
|
66
|
+
const result = yield* create(news);
|
|
67
|
+
return { ...result, id: result.id ?? "" };
|
|
68
|
+
}),
|
|
69
|
+
update: Effect.fn(function* ({ news, output }) {
|
|
70
|
+
const result = yield* update({ ...news, id: output.id });
|
|
71
|
+
return { ...result, id: result.id ?? output.id };
|
|
72
|
+
}),
|
|
73
|
+
delete: Effect.fn(function* ({ output }) {
|
|
74
|
+
yield* del({ id: output.id }).pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
75
|
+
}),
|
|
76
|
+
read: Effect.fn(function* ({ output }) {
|
|
77
|
+
if (!output?.id)
|
|
78
|
+
return undefined;
|
|
79
|
+
return yield* get({ id: output.id }).pipe(Effect.map((current) => ({ ...current, id: current.id ?? output.id })), Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
82
|
+
}));
|
|
83
|
+
//# sourceMappingURL=Notifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifier.js","sourceRoot":"","sources":["../../src/Axiom/Notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAW,gBAAgB,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,QAAQ,CAAC,MAAM,CACb,QAAQ,EACR,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;IAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC;IAE7C,OAAO;QACL,OAAO,EAAE,CAAC,IAAI,CA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AAE,OAAO,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EACtE,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAC7D,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as Provider from "../Provider.ts";
|
|
3
|
+
import * as Credentials from "./Credentials.ts";
|
|
4
|
+
export { Credentials } from "@distilled.cloud/axiom/Credentials";
|
|
5
|
+
declare const Providers_base: Provider.ProviderCollection<Providers, "Axiom">;
|
|
6
|
+
export declare class Providers extends Providers_base {
|
|
7
|
+
}
|
|
8
|
+
export type ProviderRequirements = Layer.Services<ReturnType<typeof providers>>;
|
|
9
|
+
/**
|
|
10
|
+
* Axiom providers and credentials. Wires up Dataset, ApiToken, Notifier,
|
|
11
|
+
* Monitor, Dashboard, VirtualField, View and Annotation resources, and
|
|
12
|
+
* registers the Axiom AuthProvider so `alchemy login` can configure it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const providers: () => Layer.Layer<import("effect/unstable/http/HttpClient").HttpClient | Providers | Credentials.Credentials, never, any>;
|
|
15
|
+
//# sourceMappingURL=Providers.d.ts.map
|