in telemetry/vscode/src/generate.ts [313:339]
function generateTelemetryHelper(recorder: InterfaceDeclarationStructure, metrics: Metric[]): ClassDeclarationStructure {
const getMetric: MethodDeclarationStructure = {
name: 'getMetric',
scope: Scope.Protected,
kind: StructureKind.Method,
parameters: [{ name: 'name', type: 'string' }],
returnType: recorder.name,
isAbstract: true,
}
return {
name: 'TelemetryBase',
kind: StructureKind.Class,
isAbstract: true,
methods: [getMetric],
getAccessors: metrics.map(m => {
return {
scope: Scope.Public,
name: m.name,
docs: [m.description],
returnType: `${recorder.name}<${metricToTypeName(m)}>`,
statements: `return this.${getMetric.name}('${m.name}')`,
}
}),
isExported: true,
}
}