@adonis-agora/telescope 0.23.0 → 0.25.0
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/CHANGELOG.md +58 -0
- package/dist/providers/telescope_provider.js +1 -1
- package/dist/providers/telescope_provider.js.map +1 -1
- package/dist/src/ai/index.d.ts +1 -1
- package/dist/src/ai/index.js +1 -1
- package/dist/src/alerts/index.d.ts +1 -1
- package/dist/src/alerts/index.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.js +1 -1
- package/dist/src/metrics/metrics_service.d.ts +5 -0
- package/dist/src/metrics/metrics_service.d.ts.map +1 -1
- package/dist/src/metrics/metrics_service.js +32 -4
- package/dist/src/metrics/metrics_service.js.map +1 -1
- package/dist/src/metrics/pulse.d.ts +8 -0
- package/dist/src/metrics/pulse.d.ts.map +1 -1
- package/dist/src/metrics/pulse.js +125 -37
- package/dist/src/metrics/pulse.js.map +1 -1
- package/dist/src/metrics/stats.d.ts +2 -0
- package/dist/src/metrics/stats.d.ts.map +1 -1
- package/dist/src/metrics/stats.js +8 -3
- package/dist/src/metrics/stats.js.map +1 -1
- package/dist/src/otel/otel_exporter.d.ts +40 -3
- package/dist/src/otel/otel_exporter.d.ts.map +1 -1
- package/dist/src/otel/otel_exporter.js +55 -7
- package/dist/src/otel/otel_exporter.js.map +1 -1
- package/dist/src/otel/otel_exporting_store.d.ts +1 -1
- package/dist/src/otel/otel_exporting_store.d.ts.map +1 -1
- package/dist/src/otel/otel_exporting_store.js +2 -0
- package/dist/src/otel/otel_exporting_store.js.map +1 -1
- package/dist/src/profiling/index.d.ts +1 -1
- package/dist/src/profiling/index.js +1 -1
- package/dist/src/redaction/redact.d.ts.map +1 -1
- package/dist/src/redaction/redact.js +28 -4
- package/dist/src/redaction/redact.js.map +1 -1
- package/dist/src/redaction/redacting_store.d.ts +1 -1
- package/dist/src/redaction/redacting_store.d.ts.map +1 -1
- package/dist/src/redaction/redacting_store.js +2 -0
- package/dist/src/redaction/redacting_store.js.map +1 -1
- package/dist/src/sampling/sampling_store.d.ts +1 -1
- package/dist/src/sampling/sampling_store.d.ts.map +1 -1
- package/dist/src/sampling/sampling_store.js +6 -1
- package/dist/src/sampling/sampling_store.js.map +1 -1
- package/dist/src/self_scope.d.ts +5 -0
- package/dist/src/self_scope.d.ts.map +1 -0
- package/dist/src/self_scope.js +28 -0
- package/dist/src/self_scope.js.map +1 -0
- package/dist/src/service.d.ts.map +1 -1
- package/dist/src/service.js +9 -2
- package/dist/src/service.js.map +1 -1
- package/dist/src/store.d.ts +46 -0
- package/dist/src/store.d.ts.map +1 -1
- package/dist/src/store.js +16 -1
- package/dist/src/store.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +73 -28
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +487 -183
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/stores/memory.d.ts +3 -1
- package/dist/src/stores/memory.d.ts.map +1 -1
- package/dist/src/stores/memory.js +29 -0
- package/dist/src/stores/memory.js.map +1 -1
- package/dist/src/stores/tiered.d.ts +9 -4
- package/dist/src/stores/tiered.d.ts.map +1 -1
- package/dist/src/stores/tiered.js +34 -11
- package/dist/src/stores/tiered.js.map +1 -1
- package/dist/src/stream/streaming_store.d.ts +1 -1
- package/dist/src/stream/streaming_store.d.ts.map +1 -1
- package/dist/src/stream/streaming_store.js +2 -0
- package/dist/src/stream/streaming_store.js.map +1 -1
- package/dist/src/telescope_middleware.d.ts.map +1 -1
- package/dist/src/telescope_middleware.js +20 -11
- package/dist/src/telescope_middleware.js.map +1 -1
- package/dist/src/ui/index.d.ts +1 -1
- package/dist/src/ui/index.js +1 -1
- package/dist/src/watchers/cache_watcher.js +1 -1
- package/dist/src/watchers/cache_watcher.js.map +1 -1
- package/dist/src/watchers/events_watcher.js +1 -1
- package/dist/src/watchers/events_watcher.js.map +1 -1
- package/dist/src/watchers/http_client_watcher.js +1 -1
- package/dist/src/watchers/http_client_watcher.js.map +1 -1
- package/dist/src/watchers/index.d.ts +1 -1
- package/dist/src/watchers/index.js +1 -1
- package/dist/src/watchers/logs_watcher.js +1 -1
- package/dist/src/watchers/logs_watcher.js.map +1 -1
- package/dist/src/watchers/lucid_query_watcher.d.ts.map +1 -1
- package/dist/src/watchers/lucid_query_watcher.js +8 -2
- package/dist/src/watchers/lucid_query_watcher.js.map +1 -1
- package/dist/src/watchers/mail_watcher.js +1 -1
- package/dist/src/watchers/mail_watcher.js.map +1 -1
- package/dist/src/watchers/profiling_watcher.js +1 -1
- package/dist/src/watchers/profiling_watcher.js.map +1 -1
- package/dist/src/watchers/queue_watcher.js +1 -1
- package/dist/src/watchers/queue_watcher.js.map +1 -1
- package/dist/src/watchers/record.d.ts +5 -1
- package/dist/src/watchers/record.d.ts.map +1 -1
- package/dist/src/watchers/record.js +10 -1
- package/dist/src/watchers/record.js.map +1 -1
- package/dist/src/watchers/redis_watcher.js +1 -1
- package/dist/src/watchers/redis_watcher.js.map +1 -1
- package/dist/src/watchers/schedule_watcher.js +1 -1
- package/dist/src/watchers/schedule_watcher.js.map +1 -1
- package/dist/stubs/database/migrations/create_telescope_entries_table.stub +2 -2
- package/package.json +20 -14
- package/skills/telescope-storage-retention/SKILL.md +6 -3
- package/skills/telescope-watchers/SKILL.md +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @adonis-agora/telescope
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#227](https://github.com/DavideCarvalho/adonis-agora-telescope/pull/227) [`192cd5c`](https://github.com/DavideCarvalho/adonis-agora-telescope/commit/192cd5c560be41bb85d9e5d8d113b938db5ee61d) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Support OpenTelemetry JS 3 and `@anthropic-ai/sdk` 1.x, alongside the versions already supported.
|
|
8
|
+
|
|
9
|
+
- Peer ranges: `@opentelemetry/resources` `^2.0.0 || ^3.0.0`, `@opentelemetry/sdk-logs`
|
|
10
|
+
`>=0.220.0 <1.0.0 || ^3.0.0`, `@anthropic-ai/sdk` `>=0.32.0 <2.0.0`. The `0.300.x` OTLP
|
|
11
|
+
exporters and `@opentelemetry/api` 1.10 were already in range.
|
|
12
|
+
- New optional peer `@opentelemetry/sdk-trace` (`^2.9.0 || ^3.0.0`). OTel JS 3 has no
|
|
13
|
+
`@opentelemetry/sdk-trace-base`: it was deprecated in favour of `sdk-trace`, which renames
|
|
14
|
+
`BasicTracerProvider` to `TracerProvider` and takes `new BatchSpanProcessor({ exporter })`. OTel
|
|
15
|
+
export loads `sdk-trace` when it is installed and falls back to `sdk-trace-base` 2.x otherwise,
|
|
16
|
+
so a host that has only `sdk-trace-base` keeps exporting without changing its dependencies.
|
|
17
|
+
- `@opentelemetry/sdk-logs` 0.200–0.219 is no longer in the peer range. Those versions take
|
|
18
|
+
`new BatchLogRecordProcessor(exporter)` while telescope passes `{ exporter }`, so on them no log
|
|
19
|
+
record was ever exported.
|
|
20
|
+
|
|
21
|
+
## 0.24.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [#225](https://github.com/DavideCarvalho/adonis-agora-telescope/pull/225) [`6f999b3`](https://github.com/DavideCarvalho/adonis-agora-telescope/commit/6f999b3ca702e0a129a392df8f0b76ae2a76ab31) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Faster recording and dashboard reads on the `lucid` store, and a fix for an endless write loop.
|
|
26
|
+
|
|
27
|
+
- The `lucid` store batches writes: every entry recorded in one tick of the event loop goes out
|
|
28
|
+
in one multi-row INSERT (split under each dialect's bind limit). The buffer is bounded at
|
|
29
|
+
10,000 waiting entries; past that new entries are dropped and counted on `droppedCount`.
|
|
30
|
+
`record()` still resolves once its entry is written.
|
|
31
|
+
- The request middleware no longer waits for its entry to be written before the response is
|
|
32
|
+
sent. Recording failures are now reported on `console.error` instead of swallowed.
|
|
33
|
+
- The store's own queries are no longer recorded by the query watcher. With the store on the
|
|
34
|
+
app's connection and `debug: true`, each INSERT was recorded as a query entry, whose INSERT was
|
|
35
|
+
recorded in turn, forever.
|
|
36
|
+
- The redaction, sampling, streaming and OTel store decorators expose the optional fast paths
|
|
37
|
+
(`listTraceIds`, `countByBucket`, and the new `countFamilies` / `countTags`) when the store
|
|
38
|
+
they wrap has them, so the throughput chart and traces screen stop falling back to a full scan.
|
|
39
|
+
- Pulse and per-type stats scan their window without `content` (new `EntryQuery.omitContent`
|
|
40
|
+
hint) and read content only for the rows they display. `/api/stats` counts families with
|
|
41
|
+
`GROUP BY` and tags from the `tags` column alone. The throughput chart is grouped in SQL.
|
|
42
|
+
- New composite indexes `(type, created_at, sequence)` and `(family_hash, created_at)` replace
|
|
43
|
+
the single-column `type` and `family_hash` ones in the migration stub; `autoCreateTable` adds
|
|
44
|
+
them on the next boot. Apps that ran the migration should add them with their own migration
|
|
45
|
+
(see the storages docs).
|
|
46
|
+
- `prune` deletes oldest-first in bounded batches, so a backlog larger than the database's bind
|
|
47
|
+
limit no longer makes every prune fail; the tiered store moves entries to cold by time instead
|
|
48
|
+
of by offset.
|
|
49
|
+
- Watchers build an entry only once it will be recorded (not while paused), and the query
|
|
50
|
+
watcher templates SQL into its `familyHash` only for entries that survive sampling.
|
|
51
|
+
- Redaction remembers which keys are masked instead of lowercasing every key of every entry, and
|
|
52
|
+
never reads the value of a key it masks.
|
|
53
|
+
- Latency percentiles no longer throw `RangeError` on windows with more than ~120k durations.
|
|
54
|
+
- The `lucid` store works on MySQL without `ANSI_QUOTES`. The `tag` and `search` filters quoted
|
|
55
|
+
their columns with double quotes, which MySQL reads as string literals, so they matched nothing;
|
|
56
|
+
they now use identifier bindings, and LIKE patterns escape with `!` instead of a backslash.
|
|
57
|
+
`autoCreateTable` / `createTelescopeTable` issue backtick-quoted DDL and plain `CREATE INDEX` on
|
|
58
|
+
MySQL (an index that already exists is skipped); `createTableStatements` takes the Lucid dialect
|
|
59
|
+
name as an optional second argument.
|
|
60
|
+
|
|
3
61
|
## 0.23.0
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
|
@@ -201,7 +201,7 @@ export default class TelescopeProvider {
|
|
|
201
201
|
import('../src/otel/otel_exporter.js'),
|
|
202
202
|
import('../src/otel/otel_exporting_store.js'),
|
|
203
203
|
]);
|
|
204
|
-
const exporter = createOtelExporter(config.otel);
|
|
204
|
+
const exporter = await createOtelExporter(config.otel);
|
|
205
205
|
this.otelExporter = exporter;
|
|
206
206
|
return new OtelExportingTelescopeStore(store, exporter, config.otel.entryTypes);
|
|
207
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telescope_provider.js","sourceRoot":"","sources":["../../providers/telescope_provider.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,aAAa,GAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,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,QAAQ,EAAE,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,qBAAqB,EAAE,CAAC;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,sBAAsB,GAAoB;IAC9C,KAAK,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC;IACrC,MAAM,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;IACvC,IAAI,QAAQ;QACV,OAAO,mBAAmB,EAAE,CAAC,MAAM,CAAC;IACtC,CAAC;CACF,CAAC"}
|
package/dist/src/ai/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.25.0";
|
|
3
3
|
export type { ResolvedTelescopeAiConfig, TelescopeAiConfig, } from './define_config.js';
|
|
4
4
|
export { DEFAULT_MAX_TOKENS, DEFAULT_MODEL, defineConfig, resolveConfig, } from './define_config.js';
|
|
5
5
|
export type { Diagnosis, DiagnosisConfidence, ExceptionEntryContent } from './diagnoser.js';
|
package/dist/src/ai/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.25.0';
|
|
3
3
|
// — config —
|
|
4
4
|
export { DEFAULT_MAX_TOKENS, DEFAULT_MODEL, defineConfig, resolveConfig, } from './define_config.js';
|
|
5
5
|
// — diagnosis model + parsing —
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.25.0";
|
|
3
3
|
export type { AlertChannel, ChannelFetch, ConsoleSink } from './alert_channel.js';
|
|
4
4
|
export { consoleChannel, customChannel, slackChannel, webhookChannel, } from './alert_channel.js';
|
|
5
5
|
export type { AlertDiagnosis, AlertGeoLocation, AlertMetric, AlertPayload, AlertRule, ExceptionAlertContext, GeoLookup, ResolvedAlerts, } from './alert_rule.js';
|
package/dist/src/alerts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.25.0';
|
|
3
3
|
// — channels —
|
|
4
4
|
export { consoleChannel, customChannel, slackChannel, webhookChannel, } from './alert_channel.js';
|
|
5
5
|
// — alerter (exception source → tracker → channels) —
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.25.0";
|
|
3
3
|
export { configure } from '../configure.js';
|
|
4
4
|
export type { DiagnoserLike, DiagnosisCoordinatorOptions, DiagnosisSummary, } from './ai/diagnosis_coordinator.js';
|
|
5
5
|
export { DiagnosisCoordinator, formatDiagnosisMarkdown, } from './ai/diagnosis_coordinator.js';
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.25.0';
|
|
3
3
|
// Re-export the configure hook from the package root so `node ace configure` finds it
|
|
4
4
|
export { configure } from '../configure.js';
|
|
5
5
|
// — AI diagnosis coordinator (wires the MCP tool + the alerter; SDK-free) —
|
package/dist/src/mcp/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.25.0";
|
|
3
3
|
export type { McpToolName, ResolvedTelescopeMcpConfig, TelescopeMcpConfig, } from './define_config.js';
|
|
4
4
|
export { defineConfig, MCP_TOOL_NAMES, resolveConfig } from './define_config.js';
|
|
5
5
|
export type { DiagnoseExceptionHook, JsonRpcRequest, McpToolSpec, TelescopeMcpServerOptions, } from './server.js';
|
package/dist/src/mcp/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.25.0';
|
|
3
3
|
// — config —
|
|
4
4
|
export { defineConfig, MCP_TOOL_NAMES, resolveConfig } from './define_config.js';
|
|
5
5
|
// — server (plain, testable JSON-RPC surface) —
|
|
@@ -57,6 +57,11 @@ export declare class MetricsService {
|
|
|
57
57
|
constructor(store: TelescopeStore, options?: MetricsServiceOptions);
|
|
58
58
|
/** Per-type analytics over a trailing window. */
|
|
59
59
|
getStats(query: StatsQuery): Promise<StatsResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Fill in the labels of `families` from a read by id. A family is labelled from
|
|
62
|
+
* its newest entry, which a content-less scan returned without the SQL.
|
|
63
|
+
*/
|
|
64
|
+
private labelFamilies;
|
|
60
65
|
/** Throughput time-series over a trailing window (total + per-type per bucket). */
|
|
61
66
|
getTimeseries(query: TimeseriesQuery): Promise<TimeseriesReport>;
|
|
62
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics_service.d.ts","sourceRoot":"","sources":["../../../src/metrics/metrics_service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,cAAc,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"metrics_service.d.ts","sourceRoot":"","sources":["../../../src/metrics/metrics_service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL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;;;;;;;;OAWG;YACW,eAAe;CAmB9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntryType, EXCEPTION_ENTRY_TYPES, isExceptionType } from '../entry.js';
|
|
2
2
|
import { detectNPlusOne, detectNPlusOnePatterns, } from '../query/n_plus_one.js';
|
|
3
3
|
import { summarizeScreens } from './screens.js';
|
|
4
|
-
import { estimateLatencyPercentiles, summarizeStats } from './stats.js';
|
|
4
|
+
import { estimateLatencyPercentiles, familyLabel, summarizeStats, } from './stats.js';
|
|
5
5
|
import { bucketTimeseries, bucketTimeseriesFromCounts, } from './timeseries.js';
|
|
6
6
|
import { summarizeTraces } from './traces.js';
|
|
7
7
|
import { buildWaterfall } from './waterfall.js';
|
|
@@ -49,7 +49,7 @@ export class MetricsService {
|
|
|
49
49
|
.map((entry) => entry.durationMs)
|
|
50
50
|
.filter((d) => typeof d === 'number');
|
|
51
51
|
const latencyPercentiles = estimateLatencyPercentiles(durations);
|
|
52
|
-
|
|
52
|
+
const result = summarizeStats({
|
|
53
53
|
entries,
|
|
54
54
|
type: query.type,
|
|
55
55
|
...(query.topExceptions !== undefined ? { topExceptions: query.topExceptions } : {}),
|
|
@@ -61,6 +61,29 @@ export class MetricsService {
|
|
|
61
61
|
truncated,
|
|
62
62
|
...(latencyPercentiles !== undefined ? { latencyPercentiles } : {}),
|
|
63
63
|
});
|
|
64
|
+
if (result.families !== undefined)
|
|
65
|
+
await this.labelFamilies(result.families, entries);
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fill in the labels of `families` from a read by id. A family is labelled from
|
|
70
|
+
* its newest entry, which a content-less scan returned without the SQL.
|
|
71
|
+
*/
|
|
72
|
+
async labelFamilies(families, entries) {
|
|
73
|
+
const newest = new Map();
|
|
74
|
+
for (const entry of entries) {
|
|
75
|
+
if (entry.familyHash !== null && !newest.has(entry.familyHash)) {
|
|
76
|
+
newest.set(entry.familyHash, entry);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
await Promise.all(families.map(async (family) => {
|
|
80
|
+
const sample = newest.get(family.familyHash);
|
|
81
|
+
if (sample === undefined || sample.content !== null)
|
|
82
|
+
return;
|
|
83
|
+
const full = await this.store.get(sample.id);
|
|
84
|
+
if (full !== null)
|
|
85
|
+
family.label = familyLabel(full.content);
|
|
86
|
+
}));
|
|
64
87
|
}
|
|
65
88
|
/** Throughput time-series over a trailing window (total + per-type per bucket). */
|
|
66
89
|
async getTimeseries(query) {
|
|
@@ -85,6 +108,7 @@ export class MetricsService {
|
|
|
85
108
|
}
|
|
86
109
|
const { entries } = await this.collect({
|
|
87
110
|
after: windowStart,
|
|
111
|
+
omitContent: true,
|
|
88
112
|
...(query.type !== undefined ? { type: query.type } : {}),
|
|
89
113
|
});
|
|
90
114
|
return bucketTimeseries(entries, windowStart, windowEnd, buckets);
|
|
@@ -204,8 +228,12 @@ export class MetricsService {
|
|
|
204
228
|
* EITHER scan hit the cap the window is incomplete.
|
|
205
229
|
*/
|
|
206
230
|
async collectForStats(type, after) {
|
|
207
|
-
if (!isExceptionType(type))
|
|
208
|
-
|
|
231
|
+
if (!isExceptionType(type)) {
|
|
232
|
+
// Request status and cache operations are read from content; every other type's
|
|
233
|
+
// stats come from the scalar columns (query families are labelled afterwards).
|
|
234
|
+
const omitContent = type !== EntryType.Request && type !== EntryType.Cache;
|
|
235
|
+
return this.collect({ type, after, omitContent });
|
|
236
|
+
}
|
|
209
237
|
const results = await Promise.all(EXCEPTION_ENTRY_TYPES.map((exceptionType) => this.collect({ type: exceptionType, after })));
|
|
210
238
|
return {
|
|
211
239
|
entries: results.flatMap((result) => result.entries),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics_service.js","sourceRoot":"","sources":["../../../src/metrics/metrics_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EACL,cAAc,EACd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AAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,qBAAqB,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAC3F,CAAC;QACF,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;YACpD,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC;SACtD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -156,5 +156,13 @@ export declare class PulseService {
|
|
|
156
156
|
* `query.topN` override the configured defaults for a single call.
|
|
157
157
|
*/
|
|
158
158
|
getHealth(query?: PulseQuery): Promise<PulseSummary>;
|
|
159
|
+
/**
|
|
160
|
+
* `entries` with content restored for those of `types` the store returned without
|
|
161
|
+
* it, read back one list per type over the same window. Each list holds the newest
|
|
162
|
+
* `scanCap` entries of its type, which covers every one of them in `entries`.
|
|
163
|
+
*/
|
|
164
|
+
private withContentFor;
|
|
165
|
+
/** The entries among `entries` that lack content, read back by id. */
|
|
166
|
+
private withContentById;
|
|
159
167
|
}
|
|
160
168
|
//# sourceMappingURL=pulse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulse.d.ts","sourceRoot":"","sources":["../../../src/metrics/pulse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"pulse.d.ts","sourceRoot":"","sources":["../../../src/metrics/pulse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAqD,MAAM,aAAa,CAAC;AAE5F,O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ED;;;;;;;GAOG;AACH,qBAAa,YAAY;IAMrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IALxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsE;IAE3F,YACmB,KAAK,EAAE,cAAc,EACtC,OAAO,GAAE,mBAAwB,EAalC;IAED;;;OAGG;IACG,SAAS,CAAC,KAAK,GAAE,UAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAyB7D;IAED;;;;OAIG;YACW,cAAc;IAkB5B,sEAAsE;YACxD,eAAe;CAQ9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntryType, isExceptionType } from '../entry.js';
|
|
1
|
+
import { EntryType, EXCEPTION_ENTRY_TYPES, isExceptionType } from '../entry.js';
|
|
2
2
|
import { detectNPlusOne } from '../query/n_plus_one.js';
|
|
3
3
|
import { percentile, summarizeStats, } from './stats.js';
|
|
4
4
|
import { bucketTimeseries } from './timeseries.js';
|
|
@@ -125,6 +125,54 @@ function emptyRequestHealth() {
|
|
|
125
125
|
* {@link percentile}, and {@link detectNPlusOne} for the heavy lifting.
|
|
126
126
|
*/
|
|
127
127
|
export function summarizePulse(entries, windowStart, windowEnd, options, truncated = false) {
|
|
128
|
+
return finishPulse(draftPulse(entries, windowStart, windowEnd, options, truncated), (e) => e);
|
|
129
|
+
}
|
|
130
|
+
/** The entries whose content {@link finishPulse} reads. */
|
|
131
|
+
function draftSamples(draft) {
|
|
132
|
+
return [...draft.slowest, ...draft.nPlusOne.map((hotspot) => hotspot.sample)];
|
|
133
|
+
}
|
|
134
|
+
/** Label the draft's slowest entries and N+1 hotspots, reading content through `withContent`. */
|
|
135
|
+
function finishPulse(draft, withContent) {
|
|
136
|
+
const { summary } = draft;
|
|
137
|
+
return {
|
|
138
|
+
windowStart: summary.windowStart,
|
|
139
|
+
windowEnd: summary.windowEnd,
|
|
140
|
+
windowMs: summary.windowMs,
|
|
141
|
+
counts: summary.counts,
|
|
142
|
+
throughput: summary.throughput,
|
|
143
|
+
requests: summary.requests,
|
|
144
|
+
...(summary.cache !== undefined ? { cache: summary.cache } : {}),
|
|
145
|
+
slowest: draft.slowest.map((entry) => ({
|
|
146
|
+
id: entry.id,
|
|
147
|
+
type: entry.type,
|
|
148
|
+
durationMs: entry.durationMs,
|
|
149
|
+
label: truncate(labelFrom(withContent(entry))),
|
|
150
|
+
traceId: entry.traceId,
|
|
151
|
+
})),
|
|
152
|
+
slowRoutes: summary.slowRoutes,
|
|
153
|
+
slowOutgoing: summary.slowOutgoing,
|
|
154
|
+
slowJobs: summary.slowJobs,
|
|
155
|
+
topExceptions: summary.topExceptions,
|
|
156
|
+
nPlusOne: draft.nPlusOne.map((h) => ({
|
|
157
|
+
familyHash: h.familyHash,
|
|
158
|
+
sql: truncate(sqlOf(withContent(h.sample))),
|
|
159
|
+
perRequest: h.perRequest,
|
|
160
|
+
traces: h.traces,
|
|
161
|
+
total: h.total,
|
|
162
|
+
totalDurationMs: h.totalDurationMs,
|
|
163
|
+
sampleTraceId: h.sampleTraceId,
|
|
164
|
+
})),
|
|
165
|
+
loadByUser: summary.loadByUser,
|
|
166
|
+
scanned: summary.scanned,
|
|
167
|
+
truncated: summary.truncated,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** The SQL of a query entry, or `''`. */
|
|
171
|
+
function sqlOf(entry) {
|
|
172
|
+
const record = asRecord(entry.content);
|
|
173
|
+
return record !== null && typeof record.sql === 'string' ? record.sql : '';
|
|
174
|
+
}
|
|
175
|
+
function draftPulse(entries, windowStart, windowEnd, options, truncated) {
|
|
128
176
|
const enabled = (card) => options.cards.has(card);
|
|
129
177
|
const windowMs = Math.max(0, windowEnd.getTime() - windowStart.getTime());
|
|
130
178
|
const counts = {};
|
|
@@ -263,13 +311,6 @@ export function summarizePulse(entries, windowStart, windowEnd, options, truncat
|
|
|
263
311
|
.slice()
|
|
264
312
|
.sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0) || a.id.localeCompare(b.id))
|
|
265
313
|
.slice(0, options.topN)
|
|
266
|
-
.map((entry) => ({
|
|
267
|
-
id: entry.id,
|
|
268
|
-
type: entry.type,
|
|
269
|
-
durationMs: entry.durationMs,
|
|
270
|
-
label: truncate(labelFrom(entry)),
|
|
271
|
-
traceId: entry.traceId,
|
|
272
|
-
}))
|
|
273
314
|
: [];
|
|
274
315
|
// Slow hotspots — reuse percentile via toHotspots.
|
|
275
316
|
const slowRoutes = enabled('slowRoutes')
|
|
@@ -307,7 +348,8 @@ export function summarizePulse(entries, windowStart, windowEnd, options, truncat
|
|
|
307
348
|
else {
|
|
308
349
|
hotspots.set(insight.familyHash, {
|
|
309
350
|
familyHash: insight.familyHash,
|
|
310
|
-
|
|
351
|
+
// detectNPlusOne reports the SQL of the family's first entry in the trace.
|
|
352
|
+
sample: traceEntries.find((entry) => entry.familyHash === insight.familyHash),
|
|
311
353
|
perRequest: insight.count,
|
|
312
354
|
traces: 1,
|
|
313
355
|
total: insight.count,
|
|
@@ -322,16 +364,7 @@ export function summarizePulse(entries, windowStart, windowEnd, options, truncat
|
|
|
322
364
|
b.total - a.total ||
|
|
323
365
|
b.traces - a.traces ||
|
|
324
366
|
a.familyHash.localeCompare(b.familyHash))
|
|
325
|
-
.slice(0, options.topN)
|
|
326
|
-
.map((h) => ({
|
|
327
|
-
familyHash: h.familyHash,
|
|
328
|
-
sql: truncate(h.sql),
|
|
329
|
-
perRequest: h.perRequest,
|
|
330
|
-
traces: h.traces,
|
|
331
|
-
total: h.total,
|
|
332
|
-
totalDurationMs: h.totalDurationMs,
|
|
333
|
-
sampleTraceId: h.sampleTraceId,
|
|
334
|
-
}));
|
|
367
|
+
.slice(0, options.topN);
|
|
335
368
|
}
|
|
336
369
|
// Load by user — top users by total request time.
|
|
337
370
|
const loadByUser = enabled('loadByUser')
|
|
@@ -343,22 +376,24 @@ export function summarizePulse(entries, windowStart, windowEnd, options, truncat
|
|
|
343
376
|
.slice(0, options.topN)
|
|
344
377
|
: [];
|
|
345
378
|
return {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
379
|
+
summary: {
|
|
380
|
+
windowStart: windowStart.toISOString(),
|
|
381
|
+
windowEnd: windowEnd.toISOString(),
|
|
382
|
+
windowMs,
|
|
383
|
+
counts,
|
|
384
|
+
throughput,
|
|
385
|
+
requests,
|
|
386
|
+
...(cache !== undefined ? { cache } : {}),
|
|
387
|
+
slowRoutes,
|
|
388
|
+
slowOutgoing,
|
|
389
|
+
slowJobs,
|
|
390
|
+
topExceptions,
|
|
391
|
+
loadByUser,
|
|
392
|
+
scanned: entries.length,
|
|
393
|
+
truncated,
|
|
394
|
+
},
|
|
353
395
|
slowest,
|
|
354
|
-
slowRoutes,
|
|
355
|
-
slowOutgoing,
|
|
356
|
-
slowJobs,
|
|
357
|
-
topExceptions,
|
|
358
396
|
nPlusOne,
|
|
359
|
-
loadByUser,
|
|
360
|
-
scanned: entries.length,
|
|
361
|
-
truncated,
|
|
362
397
|
};
|
|
363
398
|
}
|
|
364
399
|
/**
|
|
@@ -399,15 +434,68 @@ export class PulseService {
|
|
|
399
434
|
}
|
|
400
435
|
const windowEnd = new Date();
|
|
401
436
|
const windowStart = new Date(windowEnd.getTime() - windowMs);
|
|
402
|
-
const listQuery = { after: windowStart, size: this.scanCap };
|
|
403
|
-
const entries = await this.store.list(listQuery);
|
|
404
|
-
const truncated = entries.length >= this.scanCap;
|
|
405
437
|
const options = {
|
|
406
438
|
...this.base,
|
|
407
439
|
topN: query.topN ?? this.base.topN,
|
|
408
440
|
};
|
|
409
|
-
|
|
441
|
+
// The window is scanned without content; only the types the cards read content
|
|
442
|
+
// from get it back, and the slowest / N+1 rows are labelled from a read by id.
|
|
443
|
+
const scanned = await this.store.list({
|
|
444
|
+
after: windowStart,
|
|
445
|
+
size: this.scanCap,
|
|
446
|
+
omitContent: true,
|
|
447
|
+
});
|
|
448
|
+
const truncated = scanned.length >= this.scanCap;
|
|
449
|
+
const entries = await this.withContentFor(scanned, contentTypes(options.cards), windowStart);
|
|
450
|
+
const draft = draftPulse(entries, windowStart, windowEnd, options, truncated);
|
|
451
|
+
const samples = await this.withContentById(draftSamples(draft));
|
|
452
|
+
return finishPulse(draft, (entry) => samples.get(entry.id) ?? entry);
|
|
410
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* `entries` with content restored for those of `types` the store returned without
|
|
456
|
+
* it, read back one list per type over the same window. Each list holds the newest
|
|
457
|
+
* `scanCap` entries of its type, which covers every one of them in `entries`.
|
|
458
|
+
*/
|
|
459
|
+
async withContentFor(entries, types, after) {
|
|
460
|
+
const missing = new Set();
|
|
461
|
+
for (const entry of entries) {
|
|
462
|
+
if (entry.content === null && types.has(entry.type))
|
|
463
|
+
missing.add(entry.type);
|
|
464
|
+
}
|
|
465
|
+
if (missing.size === 0)
|
|
466
|
+
return entries;
|
|
467
|
+
const full = new Map();
|
|
468
|
+
const lists = await Promise.all([...missing].map((type) => this.store.list({ type, after, size: this.scanCap })));
|
|
469
|
+
for (const list of lists)
|
|
470
|
+
for (const entry of list)
|
|
471
|
+
full.set(entry.id, entry);
|
|
472
|
+
return entries.map((entry) => full.get(entry.id) ?? entry);
|
|
473
|
+
}
|
|
474
|
+
/** The entries among `entries` that lack content, read back by id. */
|
|
475
|
+
async withContentById(entries) {
|
|
476
|
+
const ids = new Set();
|
|
477
|
+
for (const entry of entries)
|
|
478
|
+
if (entry.content === null)
|
|
479
|
+
ids.add(entry.id);
|
|
480
|
+
const found = await Promise.all([...ids].map((id) => this.store.get(id)));
|
|
481
|
+
const byId = new Map();
|
|
482
|
+
for (const entry of found)
|
|
483
|
+
if (entry !== null)
|
|
484
|
+
byId.set(entry.id, entry);
|
|
485
|
+
return byId;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/** The entry types whose content the enabled cards aggregate over. */
|
|
489
|
+
function contentTypes(cards) {
|
|
490
|
+
const types = new Set();
|
|
491
|
+
if (cards.has('requests') || cards.has('slowRoutes'))
|
|
492
|
+
types.add(EntryType.Request);
|
|
493
|
+
if (cards.has('cache'))
|
|
494
|
+
types.add(EntryType.Cache);
|
|
495
|
+
if (cards.has('exceptions'))
|
|
496
|
+
for (const type of EXCEPTION_ENTRY_TYPES)
|
|
497
|
+
types.add(type);
|
|
498
|
+
return types;
|
|
411
499
|
}
|
|
412
500
|
function positiveOr(value, fallback) {
|
|
413
501
|
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : fallback;
|