Skip to main content

Apache Solr

Monitor Apache Solr — query rates, cache hit ratios, index size, JVM heap, and replication status — using the Solr Prometheus Exporter.

Pattern: solr-exporter → Prometheus scrape → xScaler remote_write


Prerequisites

  • Apache Solr 7.x+
  • xScaler tenant credentials (token + tenant ID)

Option A — Prometheus Exporter

The Solr Prometheus Exporter ships with Solr (in contrib/prometheus-exporter/):

./bin/solr-exporter \
-p 9983 \
-b http://localhost:8983/solr \
-f contrib/prometheus-exporter/conf/solr-exporter-config.xml

Add to prometheus.yml:

scrape_configs:
- job_name: solr
static_configs:
- targets: ['localhost:9983']

remote_write:
- url: https://euw1-01.m.xscalerlabs.com/api/v1/push
authorization:
credentials: <token>
headers:
X-Scope-OrgID: <tenant-id>

Option B — Grafana Alloy

prometheus.scrape "solr" {
targets = [{"__address__" = "localhost:9983"}]
forward_to = [prometheus.remote_write.xscaler.receiver]
}

prometheus.remote_write "xscaler" {
endpoint {
url = "https://euw1-01.m.xscalerlabs.com/api/v1/push"
authorization {
type = "Bearer"
credentials = "<token>"
}
headers = { "X-Scope-OrgID" = "<tenant-id>" }
}
}

Option C — OpenTelemetry Collector

receivers:
prometheus:
config:
scrape_configs:
- job_name: solr
static_configs:
- targets: ['localhost:9983']

processors:
batch:
timeout: 10s

exporters:
otlphttp/xscaler:
endpoint: https://euw1-01.m.xscalerlabs.com
headers:
Authorization: "Bearer <token>"
X-Scope-OrgID: "<tenant-id>"
compression: gzip

service:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlphttp/xscaler]

Logs

Collect Solr server log. Add the following to your Alloy config:

local.file_match "solr_logs" {
path_targets = [{
__address__ = "localhost",
__path__ = "/var/solr/logs/solr.log",
instance = constants.hostname,
job = "integrations/solr",
}]
}

loki.source.file "solr_logs" {
targets = local.file_match.solr_logs.targets
forward_to = [loki.write.xscaler.receiver]
}

loki.write "xscaler" {
endpoint {
url = "https://euw1-01.l.xscalerlabs.com/api/v1/logs/push"

http_client_config {
authorization {
type = "Bearer"
credentials = env("XSCALER_TOKEN")
}
}

headers = { "X-Scope-OrgID" = env("XSCALER_TENANT_ID") }
}
}

Key metrics

MetricDescription
solr_requests_totalTotal requests by handler
solr_errors_totalRequest errors
solr_request_time_secondsRequest latency histogram
solr_cache_hit_ratioFilter/query cache hit ratio
solr_searcher_numdocsDocuments in current searcher
solr_jvm_memory_heap_used_bytesJVM heap usage
solr_replication_index_size_bytesIndex size for replication