(event: TelemetryEvent)
| 34 | } |
| 35 | |
| 36 | protected async getEventProperties(event: TelemetryEvent): Promise<TelemetryEvent["properties"]> { |
| 37 | let providerProperties: TelemetryEvent["properties"] = {} |
| 38 | const provider = this.providerRef?.deref() |
| 39 | |
| 40 | if (provider) { |
| 41 | try { |
| 42 | // Get properties from the provider |
| 43 | providerProperties = await provider.getTelemetryProperties() |
| 44 | } catch (error) { |
| 45 | // Log error but continue with capturing the event. |
| 46 | console.error( |
| 47 | `Error getting telemetry properties: ${error instanceof Error ? error.message : String(error)}`, |
| 48 | ) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Merge provider properties with event-specific properties. |
| 53 | // Event properties take precedence in case of conflicts. |
| 54 | const mergedProperties = { ...providerProperties, ...(event.properties || {}) } |
| 55 | |
| 56 | // Filter out properties that shouldn't be captured by this client |
| 57 | return Object.fromEntries(Object.entries(mergedProperties).filter(([key]) => this.isPropertyCapturable(key))) |
| 58 | } |
| 59 | |
| 60 | public abstract capture(event: TelemetryEvent): Promise<void> |
| 61 |
no test coverage detected