@flarelog/sdk / AIInstrumentationConfig
Interface: AIInstrumentationConfig
Defined in: ai/types.ts:143
Configuration for the AI observability module.
Properties
autoFetch?
optionalautoFetch?:boolean
Defined in: ai/types.ts:148
Whether to auto-patch global fetch() to intercept AI calls. Default: true. Set to false if you only want explicit wrap().
propagateTrace?
optionalpropagateTrace?:boolean
Defined in: ai/types.ts:155
Whether to inject the W3C traceparent header on outgoing AI calls. Default: true. Lets you correlate AI spans with their parent request span across service boundaries.
captureSamples?
optionalcaptureSamples?:boolean
Defined in: ai/types.ts:162
Whether to capture truncated prompt/completion samples. Default: false (privacy-preserving). When enabled, captures the first maxPromptSampleChars of the prompt and completion as span attributes.
maxPromptSampleChars?
optionalmaxPromptSampleChars?:number
Defined in: ai/types.ts:165
Max characters of prompt/completion to capture when captureSamples is on. Default: 500.
priceOverrides?
optionalpriceOverrides?:Record<string,PriceEntry>
Defined in: ai/types.ts:172
Custom price table overrides. Merged with the built-in table. Key is the model name (exact match, case-insensitive). Value is USD per 1M tokens for each token category.
costMultiplier?
optionalcostMultiplier?:number
Defined in: ai/types.ts:179
Multiplier applied to all computed costs. Useful for baked-in margin or for tracking internal transfer cost vs customer-facing price. Default: 1.0.
sampleRate?
optionalsampleRate?:number
Defined in: ai/types.ts:186
Sample rate for AI spans (0.0 to 1.0). Independent of the logger's global sampleRate so you can capture 100% of AI calls while sampling other logs. Default: 1.0.
shouldInstrument?
optionalshouldInstrument?: (url,method) =>boolean
Defined in: ai/types.ts:192
Filter function — return false to skip instrumentation for a request. Useful for excluding internal/healthcheck calls.
Parameters
url
string
method
string
Returns
boolean
extraProviderHosts?
optionalextraProviderHosts?:object[]
Defined in: ai/types.ts:199
List of additional hostname patterns to recognize as AI providers. Each entry can be a string (substring match) or RegExp. Useful for OpenAI-compatible gateways (e.g. Together, Groq, Anyscale).
pattern
pattern:
string|RegExp
provider
provider:
string