Skip to main content
Version: 10.0

Metrics Configuration

Metrics are configured in the application configuration file (conf/application.xml) under the <metrics> element:

<application>
<metrics enabled="true">
<!-- Layer Configuration -->
<httpMetrics enabled="true"/>
<apiMetrics enabled="true"/>
<serviceMetrics enabled="true"/>
<threadPoolMetrics enabled="true"/>

<!-- Event and DLQ metrics can be disabled in cluster mode via th environment settings. -->

<!-- System Metrics -->
<jvmMetrics enabled="true"/>
<systemMetrics enabled="true"/>

<!-- Application Settings -->
<application percentilesEnabled="true"
maxEndpoints="100"
maxUris="500"
maxStatusCodes="20"
tag="webPDF"
logMetricsOnStartup="false"
metricCountWarningThreshold="10000">
<percentiles>
<percentile>0.5</percentile>
<percentile>0.95</percentile>
<percentile>0.99</percentile>
</percentiles>
</application>

<!-- Authentication Configuration -->
<auth enabled="true"
username="prometheus"
password="your-secure-password"/>

<!-- Registry Configuration -->
<prometheus enabled="true"/>
<jmx enabled="true" domain="webpdf.metrics"/>
</metrics>
</application>
Admin Portal

Currently, the configuration cannot be managed via the Admin Portal in the "Metrics" section.

Configuration Parameters

Global Settings

AttributeDefaultDescription
enabledtrueMaster switch for the complete metrics subsystem
preset(none)Predefined configuration preset: production, development, minimal, or custom

Layer Configuration

Control which metric layers are active via element attributes:

ElementAttribute enabledDefaultOverheadDescription
<httpMetrics>enabledtrueMediumHTTP-layer metrics (request duration, size, errors)
<apiMetrics>enabledtrueLowREST API-layer metrics (endpoint timing)
<serviceMetrics>enabledtrueLowBusiness logic metrics (web service operations)
<threadPoolMetrics>enabledtrueVery LowThread pool and worker execution metrics

Event and DLQ metrics are enabled by default with the metrics subsystem and can be disabled with the WEBPDF_METRICS_EVENT_PIPELINE_ENABLED Environment Setting.

Overhead Explanation

Overhead indicates the performance impact of metric collection per request:

  • Very Low: < 0.05 ms per request (gauges, minimal computation)
  • Low: 0.05-0.1 ms per request (simple timers, counters)
  • Medium: 0.1-0.2 ms per request (multiple metrics, active tracking)

The HTTP layer has the highest overhead because it executes on every request at the earliest stage and tracks multiple metrics (duration, size, errors, active requests). For performance-critical deployments, consider disabling HTTP metrics while keeping other layers active.

System Metrics

ElementAttribute enabledDefaultDescription
<jvmMetrics>enabledtrueJVM metrics (memory, GC, threads, class loader)
<systemMetrics>enabledtrueSystem metrics (CPU, disk space, file descriptors, uptime, Log4j2)

Application Settings

Configured via <application> element and its attributes:

AttributeDefaultDescription
percentilesEnabledtrueEnable percentile histogram collection
maxEndpoints-1 (unlimited)Maximum unique endpoints to track
maxUris-1 (unlimited)Maximum unique URIs to track
maxStatusCodes-1 (unlimited)Maximum unique HTTP status codes to track
tagwebPDFApplication tag for all metrics
endpointEnabledtrueExpose the Prometheus-compatible HTTP endpoint
logMetricsOnStartupfalseLog all metrics at startup
metricCountWarningThreshold10000Warning threshold for total metric count

Child element <percentiles>:

  • Contains multiple <percentile> elements with values between 0.0 and 1.0
  • Default percentiles: 0.5, 0.95, 0.99 (if percentilesEnabled="true")
Memory Impact

Percentile histograms consume approximately 1 MB per timer. With default settings, expect 500-1000 MB memory overhead. Consider disabling in memory-constrained environments.

Production Recommendation

Set percentilesEnabled="false" or limit to single percentile, and configure cardinality limits: maxEndpoints="100", maxUris="500", maxStatusCodes="20".

Authentication Configuration

Configured via <auth> element and its attributes:

AttributeDefaultDescription
enabledtrueRequire authentication for metrics endpoint
usernameprometheusBasic Auth username
password(none)Basic Auth password
token(none)Bearer Token (alternative to username/password)

See Authentication Guide for detailed authentication configuration.

Registry Configuration

ElementAttribute enabledOther AttributesDescription
<prometheus>enabled-Enable Prometheus registry for time-series metrics
<jmx>enableddomainEnable JMX registry (default domain: webpdf.metrics)

Configuration Presets

Production Configuration

Optimized for low memory usage:

<metrics enabled="true" preset="production">
<prometheus enabled="true"/>
</metrics>

Or with explicit settings:

<metrics enabled="true">
<application percentilesEnabled="false"
maxEndpoints="100"
maxUris="500"
maxStatusCodes="20"/>
<prometheus enabled="true"/>
</metrics>

Memory overhead: ~150-200 MB

Development Configuration

All features enabled for detailed analysis:

<metrics enabled="true" preset="development">
<auth enabled="false"/>
<prometheus enabled="true"/>
</metrics>

Or with explicit settings:

<metrics enabled="true">
<application percentilesEnabled="true"
logMetricsOnStartup="true">
<percentiles>
<percentile>0.5</percentile>
<percentile>0.95</percentile>
<percentile>0.99</percentile>
</percentiles>
</application>
<auth enabled="false"/>
<prometheus enabled="true"/>
</metrics>

Memory overhead: ~800-1200 MB

Minimal Configuration

Only essential metrics:

<metrics enabled="true" preset="minimal">
<prometheus enabled="true"/>
</metrics>

Or with explicit settings:

<metrics enabled="true">
<httpMetrics enabled="false"/>
<apiMetrics enabled="false"/>
<serviceMetrics enabled="true"/>
<threadPoolMetrics enabled="true"/>
<jvmMetrics enabled="false"/>
<systemMetrics enabled="false"/>
<application percentilesEnabled="false"/>
<prometheus enabled="true"/>
</metrics>

Memory overhead: ~50-100 MB

Environment Settings

All configuration parameters can also be set via environment variables as an alternative to conf/application.xml:

Core Metrics Settings

XML Element/AttributeEnvironment VariableTypeDescription
<metrics enabled="...">WEBPDF_METRICS_ENABLEDbooleanMaster switch for metrics subsystem
<httpMetrics enabled="...">WEBPDF_METRICS_HTTP_METRICS_ENABLEDbooleanEnable HTTP layer metrics
<apiMetrics enabled="...">WEBPDF_METRICS_API_METRICS_ENABLEDbooleanEnable API layer metrics
<serviceMetrics enabled="...">WEBPDF_METRICS_SERVICE_METRICS_ENABLEDbooleanEnable Service layer metrics
<threadPoolMetrics enabled="...">WEBPDF_METRICS_THREAD_POOL_METRICS_ENABLEDbooleanEnable Thread Pool metrics
Metrics event pipeline settingWEBPDF_METRICS_EVENT_PIPELINE_ENABLEDbooleanEnable event consumer and DLQ metrics
<jvmMetrics enabled="...">WEBPDF_METRICS_JVM_METRICS_ENABLEDbooleanEnable JVM metrics
<systemMetrics enabled="...">WEBPDF_METRICS_SYSTEM_METRICS_ENABLEDbooleanEnable System metrics

Application Settings

XML Element/AttributeEnvironment VariableTypeDescription
<application percentilesEnabled="...">WEBPDF_METRICS_APPLICATION_PERCENTILES_ENABLEDbooleanEnable percentile histogram collection
<application><percentiles>WEBPDF_METRICS_APPLICATION_PERCENTILESdouble[]Array of percentile values (e.g., [0.5,0.95,0.99])
<application maxEndpoints="...">WEBPDF_METRICS_APPLICATION_MAX_ENDPOINTSintMaximum unique endpoints to track
<application maxUris="...">WEBPDF_METRICS_APPLICATION_MAX_URISintMaximum unique URIs to track
<application maxStatusCodes="...">WEBPDF_METRICS_APPLICATION_MAX_STATUS_CODESintMaximum unique status codes to track
<application tag="...">WEBPDF_METRICS_APPLICATION_TAGStringApplication tag for metrics
<application endpointEnabled="...">WEBPDF_METRICS_APPLICATION_ENDPOINT_ENABLEDbooleanExpose the Prometheus-compatible HTTP endpoint
<application logMetricsOnStartup="...">WEBPDF_METRICS_LOG_METRICS_ON_STARTUPbooleanLog metrics configuration at startup
<application metricCountWarningThreshold="...">WEBPDF_METRICS_APPLICATION_METRIC_COUNT_WARNING_THRESHOLDintWarning threshold for metric count

Authentication Configuration

XML Element/AttributeEnvironment VariableTypeDescription
<auth enabled="...">WEBPDF_METRICS_AUTH_ENABLEDbooleanRequire authentication for endpoint
<auth username="...">WEBPDF_METRICS_AUTH_USERNAMEStringBasic Auth username (default: prometheus)
<auth password="...">WEBPDF_METRICS_AUTH_PASSWORDStringBasic Auth password
<auth token="...">WEBPDF_METRICS_AUTH_TOKENStringBearer Token (alternative to username/password)

Registry Configuration

XML Element/AttributeEnvironment VariableTypeDescription
<prometheus enabled="...">WEBPDF_METRICS_PROMETHEUS_ENABLEDbooleanEnable Prometheus registry
<jmx enabled="...">WEBPDF_METRICS_JMX_ENABLEDbooleanEnable JMX registry
<jmx domain="...">WEBPDF_METRICS_JMX_DOMAINStringJMX domain name

Notation

  • Prefix: WEBPDF_METRICS_
  • Always UPPERCASE
  • Element names are converted: httpMetricsHTTP_METRICS, apiMetricsAPI_METRICS
  • Attribute names are converted: percentilesEnabledPERCENTILES_ENABLED
  • CamelCase is converted to SNAKE_CASE
  • Dots (.) in configuration paths are replaced by underscores (_)

Example

# Enable metrics and Prometheus registry
export WEBPDF_METRICS_ENABLED=true
export WEBPDF_METRICS_PROMETHEUS_ENABLED=true

# Configure authentication
export WEBPDF_METRICS_AUTH_ENABLED=true
export WEBPDF_METRICS_AUTH_USERNAME=prometheus
export WEBPDF_METRICS_AUTH_PASSWORD=your-secure-password

# Optimize for production (disable percentiles, set limits)
export WEBPDF_METRICS_APPLICATION_PERCENTILES_ENABLED=false
export WEBPDF_METRICS_APPLICATION_MAX_ENDPOINTS=100
export WEBPDF_METRICS_APPLICATION_MAX_URIS=500

# Or enable with custom percentile values (array notation with square brackets)
export WEBPDF_METRICS_APPLICATION_PERCENTILES_ENABLED=true
export WEBPDF_METRICS_APPLICATION_PERCENTILES="[0.95,0.99]"
Priority

If both conf/application.xml and environment variables are provided, environment variables take precedence.

See Also