MCPcopy
hub / github.com/FlowiseAI/Flowise / emitEvent

Function emitEvent

packages/server/src/utils/telemetry.ts:140–165  ·  view source on GitHub ↗
(input: TelemetryEventInput)

Source from the content-addressed store, hash-verified

138 * @returns Resolves when the event has been handed off to the logger transport.
139 */
140export async function emitEvent(input: TelemetryEventInput): Promise<void> {
141 try {
142 const geo = input.ipAddress ? getGeolocation(input.ipAddress) : {}
143
144 const event: TelemetryEventOutput = {
145 eventId: uuidv4(),
146 timestamp: new Date().toISOString(),
147 version: await getAppVersion(),
148 category: input.category,
149 eventType: input.eventType,
150 actionType: input.actionType,
151 userId: input.userId,
152 orgId: input.orgId,
153 resourceId: input.resourceId,
154 ipAddress: input.ipAddress ? sanitizeIPAddress(input.ipAddress) : undefined,
155 countryCode: geo.countryCode,
156 region: geo.region,
157 result: input.result,
158 metadata: input.metadata ? sanitizeAuditMetadata(input.metadata) : undefined
159 }
160
161 auditLogger.log({ level: 'info', message: event.eventType, ...event })
162 } catch (error) {
163 logger.error(`Failed to emit event: ${error}`)
164 }
165}

Callers 3

telemetry.test.tsFile · 0.90
deleteMethod · 0.90
deleteMethod · 0.90

Calls 4

getAppVersionFunction · 0.90
sanitizeIPAddressFunction · 0.90
sanitizeAuditMetadataFunction · 0.90
getGeolocationFunction · 0.85

Tested by

no test coverage detected