|
@ -29,6 +29,7 @@ interface QueuedEvent { |
|
|
type: 'sendEvent'; |
|
|
type: 'sendEvent'; |
|
|
name: string; |
|
|
name: string; |
|
|
data?: Record<string, AttributeValue | null | undefined>; |
|
|
data?: Record<string, AttributeValue | null | undefined>; |
|
|
|
|
|
global: Map<string, AttributeValue>; |
|
|
startTime: TimeInput; |
|
|
startTime: TimeInput; |
|
|
endTime: TimeInput; |
|
|
endTime: TimeInput; |
|
|
} |
|
|
} |
|
@ -102,18 +103,19 @@ export class TelemetryService implements Disposable { |
|
|
container.debugging, |
|
|
container.debugging, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
this.provider.setGlobalAttributes(this.globalAttributes); |
|
|
|
|
|
|
|
|
|
|
|
if (this.eventQueue.length) { |
|
|
if (this.eventQueue.length) { |
|
|
const queue = [...this.eventQueue]; |
|
|
const queue = [...this.eventQueue]; |
|
|
this.eventQueue.length = 0; |
|
|
this.eventQueue.length = 0; |
|
|
|
|
|
|
|
|
for (const { type, name, data } of queue) { |
|
|
|
|
|
|
|
|
for (const { type, name, data, global } of queue) { |
|
|
if (type === 'sendEvent') { |
|
|
if (type === 'sendEvent') { |
|
|
|
|
|
this.provider.setGlobalAttributes(global); |
|
|
this.provider.sendEvent(name, stripNullOrUndefinedAttributes(data)); |
|
|
this.provider.sendEvent(name, stripNullOrUndefinedAttributes(data)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.provider.setGlobalAttributes(this.globalAttributes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sendEvent( |
|
|
sendEvent( |
|
@ -122,13 +124,14 @@ export class TelemetryService implements Disposable { |
|
|
startTime?: TimeInput, |
|
|
startTime?: TimeInput, |
|
|
endTime?: TimeInput, |
|
|
endTime?: TimeInput, |
|
|
): void { |
|
|
): void { |
|
|
if (!this.enabled) return; |
|
|
|
|
|
|
|
|
if (!this._enabled) return; |
|
|
|
|
|
|
|
|
if (this.provider == null) { |
|
|
if (this.provider == null) { |
|
|
this.eventQueue.push({ |
|
|
this.eventQueue.push({ |
|
|
type: 'sendEvent', |
|
|
type: 'sendEvent', |
|
|
name: name, |
|
|
name: name, |
|
|
data: data, |
|
|
data: data, |
|
|
|
|
|
global: new Map([...this.globalAttributes]), |
|
|
startTime: startTime ?? Date.now(), |
|
|
startTime: startTime ?? Date.now(), |
|
|
endTime: endTime ?? Date.now(), |
|
|
endTime: endTime ?? Date.now(), |
|
|
}); |
|
|
}); |
|
|