@ts-cloud/core 0.7.105 → 0.7.108

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.
Files changed (2) hide show
  1. package/dist/types.d.ts +71 -0
  2. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -2586,7 +2586,78 @@ export interface ComputeMonitoringConfig {
2586
2586
  memPercent?: number;
2587
2587
  /** Alert when root-filesystem usage percentage is ≥ this. @default 90 */
2588
2588
  diskPercent?: number;
2589
+ /**
2590
+ * Monthly bandwidth allowance in TB (decimal, as providers quote it).
2591
+ *
2592
+ * Set it and the collector accumulates month-to-date rx+tx and warns once
2593
+ * {@link bandwidthPercent} of the allowance is used — before the provider's
2594
+ * overage mail. Omit (or 0) to skip bandwidth alerting entirely; the
2595
+ * accounting is still collected either way.
2596
+ */
2597
+ bandwidthTb?: number;
2598
+ /** Alert when month-to-date bandwidth is ≥ this share of the allowance. @default 80 */
2599
+ bandwidthPercent?: number;
2589
2600
  };
2601
+ /**
2602
+ * Endpoints reporting object-storage egress.
2603
+ *
2604
+ * Host network counters cannot see this. When an application redirects
2605
+ * downloads to object storage (or to a CDN in front of it), the bytes never
2606
+ * cross the host's NIC — the box can look idle while the bucket serves
2607
+ * terabytes, and the first sign of an overrun is the provider's invoice. The
2608
+ * only component that knows is the application doing the redirecting, so this
2609
+ * polls it and records what it reports.
2610
+ *
2611
+ * Each endpoint must return an {@link EgressReport}.
2612
+ */
2613
+ egressEndpoints?: EgressEndpointConfig[];
2614
+ }
2615
+ /** An application endpoint reporting its own object-storage egress. */
2616
+ export interface EgressEndpointConfig {
2617
+ /** Short slug identifying this source in metrics (e.g. "registry"). */
2618
+ name: string;
2619
+ /** Absolute URL returning an {@link EgressReport} as JSON. */
2620
+ url: string;
2621
+ /**
2622
+ * Name of an environment variable holding a bearer token for the request.
2623
+ *
2624
+ * The variable name, never the token itself — config is committed, tokens are
2625
+ * not. Omit for a public endpoint.
2626
+ */
2627
+ tokenEnv?: string;
2628
+ }
2629
+ /**
2630
+ * What an {@link EgressEndpointConfig} URL is expected to return.
2631
+ *
2632
+ * Every field is optional and validated on arrival: a partial or malformed
2633
+ * report degrades to fewer recorded series rather than failing the whole
2634
+ * telemetry collection, because losing host metrics to a bad egress endpoint
2635
+ * would be a bad trade.
2636
+ *
2637
+ * `days` is the valuable part. Reporting a per-day history rather than a single
2638
+ * running counter means the collector can replay it — any day missed while the
2639
+ * collector was down still lands, and re-collecting the same day is idempotent
2640
+ * rather than double-counted.
2641
+ */
2642
+ export interface EgressReport {
2643
+ /** UTC day key (YYYY-MM-DD) the `today` figures describe. */
2644
+ today?: string;
2645
+ todayBytes?: number;
2646
+ /** UTC month key (YYYY-MM) the month-to-date figures describe. */
2647
+ month?: string;
2648
+ monthBytes?: number;
2649
+ /** Monthly allowance in bytes; 0 or absent when none is configured. */
2650
+ budgetBytes?: number;
2651
+ /** Share of the allowance consumed, or null when there is no allowance. */
2652
+ budgetUsedPercent?: number | null;
2653
+ /** Straight-line month-end projection in bytes. */
2654
+ projectedMonthBytes?: number;
2655
+ /** Per-day totals, oldest first. */
2656
+ days?: Array<{
2657
+ date: string;
2658
+ bytes: number;
2659
+ downloads?: number;
2660
+ }>;
2590
2661
  }
2591
2662
  /** Host firewall (UFW) configuration. See {@link ComputeConfig.firewall}. */
2592
2663
  export interface ComputeFirewallConfig {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
3
  "type": "module",
4
- "version": "0.7.105",
4
+ "version": "0.7.108",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.7.105"
34
+ "@ts-cloud/aws-types": "0.7.108"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"