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

Function getEventProperties

packages/cloud/src/TelemetryClient.ts:43–68  ·  view source on GitHub ↗
(event: TelemetryEvent)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 5

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

Tested by

no test coverage detected