MetricsCollector
Defined in: packages/core/src/core/events/metrics.ts:6
Constructors
Section titled âConstructorsâConstructor
Section titled âConstructorânew MetricsCollector(
agentHandler,config,logger):MetricsCollector
Defined in: packages/core/src/core/events/metrics.ts:7
Parameters
Section titled âParametersâagentHandler
Section titled âagentHandlerâAgentHandlerProtocol | null
agentApiKey
Section titled âagentApiKeyâstring | null = ...
agentBackoffFactor
Section titled âagentBackoffFactorânumber | null = ...
agentBufferOverflowPolicy
Section titled âagentBufferOverflowPolicyâ"drop" | "block" | "raise" | null = ...
agentBufferSize
Section titled âagentBufferSizeânumber = ...
agentCompressionEnabled
Section titled âagentCompressionEnabledâboolean | null = ...
agentCompressionThreshold
Section titled âagentCompressionThresholdânumber | null = ...
agentEnableEvents
Section titled âagentEnableEventsâboolean = ...
agentEnableMetrics
Section titled âagentEnableMetricsâboolean = ...
agentEndpoint
Section titled âagentEndpointâstring = ...
agentFlushInterval
Section titled âagentFlushIntervalânumber = ...
agentGuardVersion
Section titled âagentGuardVersionâstring | null = ...
agentHighWatermarkRatio
Section titled âagentHighWatermarkRatioânumber | null = ...
agentInstallId
Section titled âagentInstallIdâstring | null = ...
agentMaxConcurrentFlushes
Section titled âagentMaxConcurrentFlushesânumber | null = ...
agentMaxPayloadSize
Section titled âagentMaxPayloadSizeânumber | null = ...
agentPayloadSigningSecret
Section titled âagentPayloadSigningSecretâstring | null = ...
agentProjectEncryptionKey
Section titled âagentProjectEncryptionKeyâstring | null = ...
agentProjectId
Section titled âagentProjectIdâstring | null = ...
agentRetryAttempts
Section titled âagentRetryAttemptsânumber = ...
agentSensitiveHeaders
Section titled âagentSensitiveHeadersâstring[] | null = ...
agentStatusInterval
Section titled âagentStatusIntervalânumber = ...
agentStrict
Section titled âagentStrictâboolean = ...
agentTimeout
Section titled âagentTimeoutânumber = ...
authVerifier?
Section titled âauthVerifier?â(request, credential) => unknown = ...
autoBanDuration
Section titled âautoBanDurationânumber = ...
autoBanThreshold
Section titled âautoBanThresholdânumber = ...
behaviorMaxResponseBodyInspectBytes
Section titled âbehaviorMaxResponseBodyInspectBytesânumber = ...
behaviorScanResponseBody
Section titled âbehaviorScanResponseBodyâboolean = ...
blacklist
Section titled âblacklistâstring[] = ...
blockCloudProviders
Section titled âblockCloudProvidersâSet<"AWS" | "GCP" | "Azure"> = ...
blockedCountries
Section titled âblockedCountriesâstring[] = ...
blockedUserAgents
Section titled âblockedUserAgentsâstring[] = ...
bodyReadMaxConcurrent
Section titled âbodyReadMaxConcurrentânumber = ...
bodyReadTimeout
Section titled âbodyReadTimeoutânumber = ...
cloudIpRefreshInterval
Section titled âcloudIpRefreshIntervalânumber = ...
corsAllowCredentials
Section titled âcorsAllowCredentialsâboolean = ...
corsAllowHeaders
Section titled âcorsAllowHeadersâstring[] = ...
corsAllowMethods
Section titled âcorsAllowMethodsâstring[] = ...
corsAllowOrigins
Section titled âcorsAllowOriginsâstring[] = ...
corsExposeHeaders
Section titled âcorsExposeHeadersâstring[] = ...
corsMaxAge
Section titled âcorsMaxAgeânumber = ...
customErrorResponses
Section titled âcustomErrorResponsesâRecord<number, string> = ...
customLogFile
Section titled âcustomLogFileâstring | null = ...
customRequestCheck?
Section titled âcustomRequestCheck?â(req) => Promise<GuardResponse | null> = ...
customResponseModifier?
Section titled âcustomResponseModifier?â(res) => Promise<GuardResponse> = ...
detectionAnomalyEmissionCooldown
Section titled âdetectionAnomalyEmissionCooldownânumber = ...
detectionAnomalyThreshold
Section titled âdetectionAnomalyThresholdânumber = ...
detectionBinaryMinRunLength
Section titled âdetectionBinaryMinRunLengthânumber = ...
detectionCompilerTimeout
Section titled âdetectionCompilerTimeoutânumber = ...
detectionMaxBodyInspectBytes
Section titled âdetectionMaxBodyInspectBytesânumber = ...
detectionMaxContentLength
Section titled âdetectionMaxContentLengthânumber = ...
detectionMaxJsonDepth
Section titled âdetectionMaxJsonDepthânumber = ...
detectionMaxScanChars
Section titled âdetectionMaxScanCharsânumber = ...
detectionMaxScanValues
Section titled âdetectionMaxScanValuesânumber = ...
detectionMaxTrackedPatterns
Section titled âdetectionMaxTrackedPatternsânumber = ...
detectionMinSamplesForAnomaly
Section titled âdetectionMinSamplesForAnomalyânumber = ...
detectionMonitorHistorySize
Section titled âdetectionMonitorHistorySizeânumber = ...
detectionPatternValidationCachePath
Section titled âdetectionPatternValidationCachePathâstring | null = ...
detectionPreserveAttackPatterns
Section titled âdetectionPreserveAttackPatternsâboolean = ...
detectionScanBody
Section titled âdetectionScanBodyâboolean = ...
detectionScanWorkerPool
Section titled âdetectionScanWorkerPoolâboolean = ...
detectionSemanticThreshold
Section titled âdetectionSemanticThresholdânumber = ...
detectionSlowPatternThreshold
Section titled âdetectionSlowPatternThresholdânumber = ...
detectionThreatScoreThreshold
Section titled âdetectionThreatScoreThresholdânumber = ...
dynamicRuleInterval
Section titled âdynamicRuleIntervalânumber = ...
dynamicRulesCachePath
Section titled âdynamicRulesCachePathâstring | null = ...
emergencyMode
Section titled âemergencyModeâboolean = ...
emergencyWhitelist
Section titled âemergencyWhitelistâstring[] = ...
enableAgent
Section titled âenableAgentâboolean = ...
enableCors
Section titled âenableCorsâboolean = ...
enabledDetectionCategories
Section titled âenabledDetectionCategoriesâstring[] = ...
enableDynamicRules
Section titled âenableDynamicRulesâboolean = ...
enableEnrichment
Section titled âenableEnrichmentâboolean = ...
enableIpBanning
Section titled âenableIpBanningâboolean = ...
enableLogfire
Section titled âenableLogfireâboolean = ...
enableOtel
Section titled âenableOtelâboolean = ...
enablePenetrationDetection
Section titled âenablePenetrationDetectionâboolean = ...
enableRateLimitAutoBan
Section titled âenableRateLimitAutoBanâboolean = ...
enableRateLimiting
Section titled âenableRateLimitingâboolean = ...
enableRedis
Section titled âenableRedisâboolean = ...
endpointRateLimits
Section titled âendpointRateLimitsâRecord<string, [number, number]> = ...
enforceHttps
Section titled âenforceHttpsâboolean = ...
excludedDetectionBodyFields
Section titled âexcludedDetectionBodyFieldsâstring[] = ...
excludedDetectionHeaders
Section titled âexcludedDetectionHeadersâstring[] = ...
excludedDetectionParams
Section titled âexcludedDetectionParamsâstring[] = ...
excludePaths
Section titled âexcludePathsâstring[] = ...
exemptIps
Section titled âexemptIpsâstring[] = ...
failSecure
Section titled âfailSecureâboolean = ...
geoIpDbMaxAge
Section titled âgeoIpDbMaxAgeânumber = ...
geoIpHandler?
Section titled âgeoIpHandler?âGeoIPHandler = ...
geoResolver?
Section titled âgeoResolver?â(ip) => string | null = ...
globalBehaviorRules
Section titled âglobalBehaviorRulesâobject[] = ...
ipinfoDbPath
Section titled âipinfoDbPathâstring = ...
ipinfoToken
Section titled âipinfoTokenâstring | null = ...
lazyInit
Section titled âlazyInitâboolean = ...
logCountryCheckLevel
Section titled âlogCountryCheckLevelâ"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
logfireServiceName
Section titled âlogfireServiceNameâstring = ...
logFormat
Section titled âlogFormatâ"text" | "json" = ...
logger?
Section titled âlogger?âLogger = ...
logRequestLevel
Section titled âlogRequestLevelâ"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
logSensitiveBodyFields
Section titled âlogSensitiveBodyFieldsâstring[] = ...
logSensitiveHeaders
Section titled âlogSensitiveHeadersâstring[] = ...
logSensitiveParams
Section titled âlogSensitiveParamsâstring[] = ...
logSuspiciousLevel
Section titled âlogSuspiciousLevelâ"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
mutedCheckLogs
Section titled âmutedCheckLogsâstring[] = ...
mutedEventTypes
Section titled âmutedEventTypesâstring[] = ...
mutedMetricTypes
Section titled âmutedMetricTypesâstring[] = ...
onBlock?
Section titled âonBlock?â(request, payload) => unknown = ...
onError?
Section titled âonError?â(stage, error, context) => void = ...
otelExporterEndpoint
Section titled âotelExporterEndpointâstring | null = ...
otelResourceAttributes
Section titled âotelResourceAttributesâRecord<string, string> = ...
otelServiceName
Section titled âotelServiceNameâstring = ...
passiveMode
Section titled âpassiveModeâboolean = ...
rateLimit
Section titled ârateLimitânumber = ...
rateLimitWindow
Section titled ârateLimitWindowânumber = ...
redisFailOpen
Section titled âredisFailOpenâboolean = ...
redisHealthCheckInterval
Section titled âredisHealthCheckIntervalânumber = ...
redisMaxConnections
Section titled âredisMaxConnectionsânumber | null = ...
redisPrefix
Section titled âredisPrefixâstring = ...
redisRetries
Section titled âredisRetriesânumber = ...
redisSocketConnectTimeout
Section titled âredisSocketConnectTimeoutânumber | null = ...
redisSocketTimeout
Section titled âredisSocketTimeoutânumber | null = ...
redisUrl
Section titled âredisUrlâstring = ...
routeResolutionStrict
Section titled ârouteResolutionStrictâboolean = ...
securityHeaders
Section titled âsecurityHeadersâ{ contentTypeOptions: string; csp: Record<string, string[]> | null; custom: Record<string, string> | null; enabled: boolean; frameOptions: "DENY" | "SAMEORIGIN"; hsts?: { includeSubdomains: boolean; maxAge: number; preload: boolean; }; permissionsPolicy: string; referrerPolicy: string; xssProtection: string; } | null = ...
threatBanConfig
Section titled âthreatBanConfigâRecord<string, { duration: number; threshold: number; }> = ...
trustedProxies
Section titled âtrustedProxiesâstring[] = ...
trustedProxyDepth
Section titled âtrustedProxyDepthânumber = ...
trustXForwardedProto
Section titled âtrustXForwardedProtoâboolean = ...
whitelist
Section titled âwhitelistâstring[] | null = ...
whitelistCountries
Section titled âwhitelistCountriesâstring[] = ...
Returns
Section titled âReturnsâMetricsCollector
Methods
Section titled âMethodsâcollectRequestMetrics()
Section titled âcollectRequestMetrics()âcollectRequestMetrics(
request,responseTime,statusCode):Promise<void>
Defined in: packages/core/src/core/events/metrics.ts:32
Parameters
Section titled âParametersârequest
Section titled ârequestâresponseTime
Section titled âresponseTimeânumber
statusCode
Section titled âstatusCodeânumber
Returns
Section titled âReturnsâPromise<void>
sendMetric()
Section titled âsendMetric()âsendMetric(
metricType,value,tags?):Promise<void>
Defined in: packages/core/src/core/events/metrics.ts:13
Parameters
Section titled âParametersâmetricType
Section titled âmetricTypeâstring
number
Record<string, string>
Returns
Section titled âReturnsâPromise<void>