MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getEventProperties

Function getEventProperties

packages/telemetry/src/BaseTelemetryClient.ts:36–58  ·  view source on GitHub ↗
(event: TelemetryEvent)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 5

entriesMethod · 0.80
isPropertyCapturableMethod · 0.80
errorMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected