1313// Credentials (from environment)
1414// ---------------------------------------------------------------------------
1515
16- export const SQL_USERNAME = process . env . BETTERSTACK_SQL_USERNAME || process . env . BETTERSTACK_USERNAME || "" ;
17- export const SQL_PASSWORD = process . env . BETTERSTACK_SQL_PASSWORD || process . env . BETTERSTACK_PASSWORD || "" ;
18- export const API_TOKEN = process . env . BETTERSTACK_API_TOKEN || "" ;
16+ export const SQL_USERNAME = process . env . BETTERSTACK_SQL_USERNAME || process . env . BETTERSTACK_USERNAME || ""
17+ export const SQL_PASSWORD = process . env . BETTERSTACK_SQL_PASSWORD || process . env . BETTERSTACK_PASSWORD || ""
18+ export const API_TOKEN = process . env . BETTERSTACK_API_TOKEN || ""
1919
2020// ---------------------------------------------------------------------------
2121// Endpoints
2222// ---------------------------------------------------------------------------
2323
2424/** BetterStack ClickHouse SQL API — read-only HTTP endpoint for log/metric queries */
25- export const SQL_ENDPOINT = "https://eu-nbg-2-connect.betterstackdata.com" ;
25+ export const SQL_ENDPOINT = "https://eu-nbg-2-connect.betterstackdata.com"
2626
2727/** BetterStack Uptime API */
28- export const UPTIME_API = "https://uptime.betterstack.com/api/v2" ;
28+ export const UPTIME_API = "https://uptime.betterstack.com/api/v2"
2929
3030/** BetterStack Telemetry API (management — sources, collectors, dashboards) */
31- export const TELEMETRY_API = "https://telemetry.betterstack.com/api/v1" ;
31+ export const TELEMETRY_API = "https://telemetry.betterstack.com/api/v1"
3232
3333// ---------------------------------------------------------------------------
3434// Log Sources
3535// ---------------------------------------------------------------------------
3636
3737export interface LogSource {
38- id : number ;
39- name : string ;
40- description : string ;
38+ id : number
39+ name : string
40+ description : string
4141 /** Recent logs (hot storage) */
42- logsTable : string ;
42+ logsTable : string
4343 /** Historical logs (cold/S3 storage). Use with `WHERE _row_type = 1` for logs. */
44- historicalTable : string ;
44+ historicalTable : string
4545 /** Metrics (aggregated time-series from this source) */
46- metricsTable : string ;
46+ metricsTable : string
4747}
4848
4949export const LOG_SOURCES : Record < string , LogSource > = {
@@ -65,25 +65,25 @@ export const LOG_SOURCES: Record<string, LogSource> = {
6565 historicalTable : "s3Cluster(primary, t373499_augmentos_s3)" ,
6666 metricsTable : "remote(t373499_augmentos_metrics)" ,
6767 } ,
68- } ;
68+ }
6969
7070/** Default source for prod queries */
71- export const DEFAULT_PROD_SOURCE = LOG_SOURCES . prod ;
71+ export const DEFAULT_PROD_SOURCE = LOG_SOURCES . prod
7272
7373/** Default source for dev/debug queries */
74- export const DEFAULT_DEV_SOURCE = LOG_SOURCES . dev ;
74+ export const DEFAULT_DEV_SOURCE = LOG_SOURCES . dev
7575
7676// ---------------------------------------------------------------------------
7777// Collector Sources (infrastructure metrics from each cluster)
7878// ---------------------------------------------------------------------------
7979
8080export interface CollectorSource {
81- collectorId : number ;
82- sourceId : number ;
83- name : string ;
84- region : string ;
85- clusterId : number ;
86- metricsTable : string ;
81+ collectorId : number
82+ sourceId : number
83+ name : string
84+ region : string
85+ clusterId : number
86+ metricsTable : string
8787}
8888
8989export const COLLECTORS : Record < string , CollectorSource > = {
@@ -127,17 +127,17 @@ export const COLLECTORS: Record<string, CollectorSource> = {
127127 clusterId : 4977 ,
128128 metricsTable : "remote(t373499_mentra_us_east_metrics)" ,
129129 } ,
130- } ;
130+ }
131131
132132// ---------------------------------------------------------------------------
133133// Uptime Monitors
134134// ---------------------------------------------------------------------------
135135
136136export interface UptimeMonitor {
137- id : number ;
138- name : string ;
139- url : string ;
140- description : string ;
137+ id : number
138+ name : string
139+ url : string
140+ description : string
141141}
142142
143143export const UPTIME_MONITORS : Record < string , UptimeMonitor > = {
@@ -183,18 +183,18 @@ export const UPTIME_MONITORS: Record<string, UptimeMonitor> = {
183183 url : "https://cloud-uptime-tracker-10698-4a24a192-r2am9o43.onporter.run/health" ,
184184 description : "Prod transcription uptime tracker. Currently DOWN (SSL cert issue)." ,
185185 } ,
186- } ;
186+ }
187187
188188// ---------------------------------------------------------------------------
189189// Dashboards
190190// ---------------------------------------------------------------------------
191191
192192export interface Dashboard {
193- id : number ;
194- name : string ;
195- sourceId : number ;
196- description : string ;
197- url : string ;
193+ id : number
194+ name : string
195+ sourceId : number
196+ description : string
197+ url : string
198198}
199199
200200export const DASHBOARDS : Record < string , Dashboard > = {
@@ -214,18 +214,18 @@ export const DASHBOARDS: Record<string, Dashboard> = {
214214 "Legacy dashboard from 057 investigation. Log-based charts — mostly broken because dashboard {{source}} resolves to metrics table. Superseded by SRE dashboard." ,
215215 url : "https://telemetry.betterstack.com/team/t329093/dashboards/971353" ,
216216 } ,
217- } ;
217+ }
218218
219219// ---------------------------------------------------------------------------
220220// Region Configuration
221221// ---------------------------------------------------------------------------
222222
223223export interface Region {
224- name : string ;
225- clusterId : number ;
226- healthUrl : string ;
227- dopplerConfig : string ;
228- porterEnvGroup : string ;
224+ name : string
225+ clusterId : number
226+ healthUrl : string
227+ dopplerConfig : string
228+ porterEnvGroup : string
229229}
230230
231231export const REGIONS : Record < string , Region > = {
@@ -246,7 +246,7 @@ export const REGIONS: Record<string, Region> = {
246246 "east-asia" : {
247247 name : "East Asia" ,
248248 clusterId : 4754 ,
249- healthUrl : "https://asiaeastapi.mentra.glass /health" ,
249+ healthUrl : "https://asiaeastapi.mentraglass.com /health" ,
250250 dopplerConfig : "prod_east-asia" ,
251251 porterEnvGroup : "cloud-prod-east-asia" ,
252252 } ,
@@ -264,7 +264,7 @@ export const REGIONS: Record<string, Region> = {
264264 dopplerConfig : "prod_us-east" ,
265265 porterEnvGroup : "cloud-prod-us-east" ,
266266 } ,
267- } ;
267+ }
268268
269269// ---------------------------------------------------------------------------
270270// Diagnostic Log Features (what our instrumentation emits)
@@ -281,9 +281,9 @@ export const DIAGNOSTIC_FEATURES = [
281281 "health-timing" ,
282282 "soniox-timing" ,
283283 "event-loop-lag" ,
284- ] as const ;
284+ ] as const
285285
286- export type DiagnosticFeature = ( typeof DIAGNOSTIC_FEATURES ) [ number ] ;
286+ export type DiagnosticFeature = ( typeof DIAGNOSTIC_FEATURES ) [ number ]
287287
288288// ---------------------------------------------------------------------------
289289// Key Collector Metrics (for dashboard queries)
@@ -307,7 +307,7 @@ export const COLLECTOR_METRICS = {
307307 httpRequests : "container_http_requests_total" ,
308308 /** TCP active connections */
309309 tcpConnections : "container_net_tcp_active_connections" ,
310- } as const ;
310+ } as const
311311
312312// ---------------------------------------------------------------------------
313313// Helpers
@@ -318,44 +318,44 @@ export const COLLECTOR_METRICS = {
318318 * Defaults to prod. Pass "dev" or "debug" for the dev source.
319319 */
320320export function getLogsTable ( env : "prod" | "dev" = "prod" ) : string {
321- return env === "prod" ? LOG_SOURCES . prod . logsTable : LOG_SOURCES . dev . logsTable ;
321+ return env === "prod" ? LOG_SOURCES . prod . logsTable : LOG_SOURCES . dev . logsTable
322322}
323323
324324/**
325325 * Get the collector metrics table for a given region.
326326 * Returns undefined if the region doesn't have a collector.
327327 */
328328export function getCollectorTable ( region : string ) : string | undefined {
329- return COLLECTORS [ region ] ?. metricsTable ;
329+ return COLLECTORS [ region ] ?. metricsTable
330330}
331331
332332/**
333333 * Get the health URL for a region.
334334 */
335335export function getHealthUrl ( region : string ) : string | undefined {
336- return REGIONS [ region ] ?. healthUrl ;
336+ return REGIONS [ region ] ?. healthUrl
337337}
338338
339339/**
340340 * All region names.
341341 */
342342export function getAllRegions ( ) : string [ ] {
343- return Object . keys ( REGIONS ) ;
343+ return Object . keys ( REGIONS )
344344}
345345
346346/**
347347 * Validate that SQL credentials are configured.
348348 */
349349export function validateSqlCredentials ( ) : void {
350350 if ( ! SQL_USERNAME || ! SQL_PASSWORD ) {
351- console . error ( "❌ BetterStack SQL credentials not set." ) ;
351+ console . error ( "❌ BetterStack SQL credentials not set." )
352352 console . error (
353353 " Set BETTERSTACK_SQL_USERNAME and BETTERSTACK_SQL_PASSWORD (or BETTERSTACK_USERNAME / BETTERSTACK_PASSWORD)." ,
354- ) ;
354+ )
355355 console . error (
356356 " These are the ClickHouse HTTP API credentials from BetterStack Integrations → Connect ClickHouse HTTP client." ,
357- ) ;
358- process . exit ( 1 ) ;
357+ )
358+ process . exit ( 1 )
359359 }
360360}
361361
@@ -366,6 +366,6 @@ export function validateApiToken(): void {
366366 if ( ! API_TOKEN ) {
367367 throw new Error (
368368 "BETTERSTACK_API_TOKEN not set. This is the management API token from BetterStack → Integrations → API." ,
369- ) ;
369+ )
370370 }
371371}
0 commit comments