import {CounterFactory} from './counter';
import {GaugeFactory} from './gauge';
import {HistogramFactory} from './histogram';
import {TimerWrapperFactory} from './timed';
export class ApmFeature {
constructor(readonly envKey: string, readonly type: { name: string }) {
}
}
export class ApmFeatureRef {
}
export class ApmEnv {
readonly timer = new ApmFeature('apm.timer', TimerWrapperFactory);
readonly counter = new ApmFeature('apm.counter', CounterFactory);
readonly gauge = new ApmFeature('apm.gauge', GaugeFactory);
readonly histogram = new ApmFeature('apm.histogram', HistogramFactory);
}
// export type ApmFactoryName<T> = T extends {name:string}
export type ApmFactory<T> = T extends TimerWrapperFactory
| CounterFactory<any>
| GaugeFactory<any>
| HistogramFactory<unknown> ? { name: string } : never;
export type ApmFactoryInstance<T, I> = T extends ApmFactory<any>
? I extends T ? I : never
: any;
// type TesT<T, I> = [ApmFactory<T>, ApmFactoryInstance<T, I>];
// const t: TesT<CounterFactory, ConsoleCounterFactory> = [CounterFactory, new ConsoleCounterFactory({})]
export const APM_ENV = new ApmEnv();
export type ApmFeatures = keyof ApmEnv;
|