in telemetry/vscode/src/generate.ts [275:311]
function generateMetricRecorder(metadataType: TypeAliasDeclarationStructure): InterfaceDeclarationStructure {
return {
name: 'Metric',
isExported: true,
typeParameters: [`T extends ${baseName} = ${baseName}`],
properties: [
{
name: 'name',
type: 'string',
isReadonly: true,
}
],
methods: [
{
docs: ['Sends the metric to the telemetry service'],
name: 'emit',
returnType: 'void',
parameters: [{
name: 'data',
type: 'T',
hasQuestionToken: true,
}],
},
{
docs: ['Executes a callback, automatically sending the metric after completion'],
name: 'run',
typeParameters: ['U'],
returnType: 'U',
parameters: [{
name: 'fn',
type: `(span: Span<T>) => U`,
}],
}
],
kind: StructureKind.Interface,
}
}