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

Function logAPISuccess

src/services/api/logging.ts:407–588  ·  view source on GitHub ↗
({
  model,
  preNormalizedModel,
  messageCount,
  messageTokens,
  usage,
  durationMs,
  durationMsIncludingRetries,
  attempt,
  ttftMs,
  requestId,
  stopReason,
  costUSD,
  didFallBackToNonStreaming,
  querySource,
  gateway,
  queryTracking,
  permissionMode,
  globalCacheStrategy,
  textContentLength,
  thinkingContentLength,
  toolUseContentLengths,
  connectorTextBlockCount,
  fastMode,
  previousRequestId,
  betas,
}: {
  model: string
  preNormalizedModel: string
  messageCount: number
  messageTokens: number
  usage: Usage
  durationMs: number
  durationMsIncludingRetries: number
  attempt: number
  ttftMs: number | null
  requestId: string | null
  stopReason: BetaStopReason | null
  costUSD: number
  didFallBackToNonStreaming: boolean
  querySource: string
  gateway?: KnownGateway
  queryTracking?: QueryChainTracking
  permissionMode?: PermissionMode
  globalCacheStrategy?: GlobalCacheStrategy
  textContentLength?: number
  thinkingContentLength?: number
  toolUseContentLengths?: Record<string, number>
  connectorTextBlockCount?: number
  fastMode?: boolean
  previousRequestId?: string | null
  betas?: string[]
})

Source from the content-addressed store, hash-verified

405}
406
407function logAPISuccess({
408 model,
409 preNormalizedModel,
410 messageCount,
411 messageTokens,
412 usage,
413 durationMs,
414 durationMsIncludingRetries,
415 attempt,
416 ttftMs,
417 requestId,
418 stopReason,
419 costUSD,
420 didFallBackToNonStreaming,
421 querySource,
422 gateway,
423 queryTracking,
424 permissionMode,
425 globalCacheStrategy,
426 textContentLength,
427 thinkingContentLength,
428 toolUseContentLengths,
429 connectorTextBlockCount,
430 fastMode,
431 previousRequestId,
432 betas,
433}: {
434 model: string
435 preNormalizedModel: string
436 messageCount: number
437 messageTokens: number
438 usage: Usage
439 durationMs: number
440 durationMsIncludingRetries: number
441 attempt: number
442 ttftMs: number | null
443 requestId: string | null
444 stopReason: BetaStopReason | null
445 costUSD: number
446 didFallBackToNonStreaming: boolean
447 querySource: string
448 gateway?: KnownGateway
449 queryTracking?: QueryChainTracking
450 permissionMode?: PermissionMode
451 globalCacheStrategy?: GlobalCacheStrategy
452 textContentLength?: number
453 thinkingContentLength?: number
454 toolUseContentLengths?: Record<string, number>
455 connectorTextBlockCount?: number
456 fastMode?: boolean
457 previousRequestId?: string | null
458 betas?: string[]
459}): void {
460 const isNonInteractiveSession = getIsNonInteractiveSession()
461 const isPostCompaction = consumePostCompaction()
462 const hasPrintFlag =
463 process.argv.includes('-p') || process.argv.includes('--print')
464

Callers 1

logAPISuccessAndDurationFunction · 0.85

Calls 10

consumePostCompactionFunction · 0.85
consumeInvokingRequestIdFunction · 0.85
getBuildAgeMinutesFunction · 0.85
getAPIProviderForStatsigFunction · 0.85
jsonStringifyFunction · 0.85
getInferenceEnvMetadataFunction · 0.85
logEventFunction · 0.70

Tested by

no test coverage detected