MCPcopy Create free account
hub / github.com/Noumena-Network/code / getTelemetryAttributes

Function getTelemetryAttributes

src/utils/telemetryAttributes.ts:81–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81export function getTelemetryAttributes(): Attributes {
82 const userId = getOrCreateUserID()
83 const sessionId = getSessionId()
84
85 const attributes: Attributes = {
86 'user.id': userId,
87 }
88
89 if (shouldIncludeAttribute('OTEL_METRICS_INCLUDE_SESSION_ID')) {
90 attributes['session.id'] = sessionId
91 }
92 if (shouldIncludeAttribute('OTEL_METRICS_INCLUDE_VERSION')) {
93 attributes['app.version'] = MACRO.VERSION
94 }
95
96 Object.assign(
97 attributes,
98 buildTelemetryIdentityAttributes(getAuthRuntime().getCurrentSession()),
99 )
100
101 // Add terminal type if available
102 if (envDynamic.terminal) {
103 attributes['terminal.type'] = envDynamic.terminal
104 }
105
106 return attributes
107}

Callers 3

logOTelEventFunction · 0.85
createSpanAttributesFunction · 0.85
addFunction · 0.85

Calls 6

getOrCreateUserIDFunction · 0.85
getSessionIdFunction · 0.85
shouldIncludeAttributeFunction · 0.85
getAuthRuntimeFunction · 0.85
getCurrentSessionMethod · 0.65

Tested by

no test coverage detected