All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you’d like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

This PR implements per-collection metrics for Prometheus, addressing issue #3322. It adds a new configuration option service.record_per_collection to enable or disable this feature. When enabled, existing metrics like rest_responses_total, grpc_responses_total, and various operation durations will include a collection label. Additionally, collection_points and collection_vectors metrics now consistently use the collection label instead of id.

Key Changes

Settings

  • settings.rs: Added record_per_collection to ServiceConfig (default: false).

Telemetry

  • requests_telemetry.rs:
    • Updated WebApiTelemetry and GrpcTelemetry to support per-collection statistics.
    • Updated ActixWorkerTelemetryCollector and TonicWorkerTelemetryCollector to collect stats per collection.
  • telemetry_context.rs:
    • Added CollectionName struct for passing collection names via gRPC response extensions.
  • actix_telemetry.rs:
    • Updated ActixTelemetryService to extract the collection name from the request path.
  • tonic_telemetry.rs:
    • Updated TonicTelemetryService to extract the collection name from response extensions.

Metrics

  • metrics.rs:
    • Updated WebApiTelemetry::add_metrics and GrpcTelemetry::add_metrics to generate Prometheus metrics with the collection label.
    • Standardized CollectionsTelemetry and HardwareTelemetry to use the collection label instead of id.

gRPC API

  • points_api.rs:
    • Updated gRPC handlers (e.g., upsert, search, get) to attach the CollectionName to response extensions.

Verification

Automated Tests

  • Added tests/per_collection_metrics_test.sh to verify that metrics are correctly reported when the feature is enabled.

Manual Verification

  1. Enable record_per_collection: true in config or via env var QDRANT_SERVICE__RECORD_PER_COLLECTION=true.
  2. Run Qdrant.
  3. Perform operations on a collection.
  4. Check /metrics for collection="..." labels.

/fixes #3322 /claim #3322

Test Results:

USER@DESKTOP-1PHUG1C MINGW64 ~/3D Objects/qdrant (per-collection-metrics)
$ ./tests/per_collection_metrics_test.sh
Using Qdrant host: localhost:6333
Creating collection test_collection_metrics...
{"result":true,"status":"ok","time":0.1608115}Inserting points...
{"result":{"operation_id":1,"status":"completed"},"status":"ok","time":0.0146744}Searching points...
{"result":[{"id":1,"version":1,"score":1.273},{"id":2,"version":1,"score":0.871}],"status":"ok","time":0.0026512}Fetching metrics...
Verifying per-collection metrics...
Found per-collection rest_responses_total
Found per-collection collection_points
All per-collection metrics verification passed!
Cleaning up...
{"result":true,"status":"ok","time":0.0086086}

Server Response when running tests:

2026-01-19T03:39:57.557828Z INFO actix_web::middleware::logger: 127.0.0.1 "PUT /collections/test_collection_metrics HTTP/1.1" 200 46 "-" "curl/8.12.1" 0.159817
2026-01-19T03:39:57.853769Z DEBUG memory::madvise: Ignore Random on this platform
2026-01-19T03:39:57.854546Z DEBUG memory::madvise: Ignore Sequential on this platform
2026-01-19T03:39:57.859148Z INFO actix_web::middleware::logger: 127.0.0.1 "PUT /collections/test_collection_metrics/points?wait=true HTTP/1.1" 200 81 "-" "curl/8.12.1" 0.011381
2026-01-19T03:39:58.183047Z INFO actix_web::middleware::logger: 127.0.0.1 "POST /collections/test_collection_metrics/points/search HTTP/1.1" 200 113 "-" "curl/8.12.1" 0.002535
2026-01-19T03:39:58.930919Z INFO storage::content_manager::toc::collection_meta_ops: Deleting collection test_collection_metrics
2026-01-19T03:39:58.931639Z DEBUG collection::update_workers::flush_workers: Stopping flush worker for shard ./storage\collections\test_collection_metrics\0
2026-01-19T03:39:58.939728Z INFO actix_web::middleware::logger: 127.0.0.1 "DELETE /collections/test_collection_metrics HTTP/1.1" 200 46 "-" "curl/8.12.1" 0.009151

Claim

Total prize pool $150
Total paid $0
Status Pending
Submitted January 19, 2026
Last updated January 19, 2026

Contributors

EX

Excellencedev

@Excellencedev

100%

Sponsors

QD

Qdrant

@Qdrant

$150