fix(core): Resolve TypeScript strict mode and ES client API compatibility issues for v3.0.0

- Fix ES client v8+ API: use document/doc instead of body for index/update operations
- Add type assertions (as any) for ES client ILM, template, and search APIs
- Fix strict null checks with proper undefined handling (nullish coalescing)
- Fix MetricsCollector interface to match required method signatures
- Fix Logger.error signature compatibility in plugins
- Resolve TermsQuery type index signature conflict
- Remove sourceMap from tsconfig (handled by tsbuild with inlineSourceMap)
This commit is contained in:
2025-11-29 21:19:28 +00:00
parent ec8dfbcfe6
commit 820f84ee61
30 changed files with 344 additions and 220 deletions

View File

@@ -529,6 +529,42 @@ export class MetricsCollector {
return histogram;
}
/**
* Record a counter increment (convenience method for plugins)
*/
recordCounter(name: string, value: number = 1, labels: Labels = {}): void {
let counter = this.registry.get(name) as Counter | undefined;
if (!counter) {
counter = new Counter(name, `Counter: ${name}`, Object.keys(labels));
this.registry.register(counter);
}
counter.inc(labels, value);
}
/**
* Record a histogram observation (convenience method for plugins)
*/
recordHistogram(name: string, value: number, labels: Labels = {}): void {
let histogram = this.registry.get(name) as Histogram | undefined;
if (!histogram) {
histogram = new Histogram(name, `Histogram: ${name}`, Object.keys(labels));
this.registry.register(histogram);
}
histogram.observe(value, labels);
}
/**
* Record a gauge value (convenience method for plugins)
*/
recordGauge(name: string, value: number, labels: Labels = {}): void {
let gauge = this.registry.get(name) as Gauge | undefined;
if (!gauge) {
gauge = new Gauge(name, `Gauge: ${name}`, Object.keys(labels));
this.registry.register(gauge);
}
gauge.set(value, labels);
}
/**
* Export all metrics in Prometheus format
*/