MCPcopy Create free account
hub / github.com/simstudioai/sim / createSafeAttributes

Function createSafeAttributes

apps/sim/app/api/telemetry/route.ts:32–51  ·  view source on GitHub ↗

* Creates a safe attribute object for OpenTelemetry

(
  data: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

30 * Creates a safe attribute object for OpenTelemetry
31 */
32function createSafeAttributes(
33 data: Record<string, unknown>
34): Array<{ key: string; value: { stringValue: string } }> {
35 if (!data || typeof data !== 'object') {
36 return []
37 }
38
39 const attributes: Array<{ key: string; value: { stringValue: string } }> = []
40
41 Object.entries(data).forEach(([key, value]) => {
42 if (value !== undefined && value !== null && key) {
43 attributes.push({
44 key,
45 value: { stringValue: safeStringValue(value) },
46 })
47 }
48 })
49
50 return attributes
51}
52
53/**
54 * Forwards telemetry data to OpenTelemetry collector

Callers 1

forwardToCollectorFunction · 0.85

Calls 2

safeStringValueFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected