Skip to content

Observability

CARML reports what a mapping run does through an observer interface. The carml-observability-micrometer module turns those reports into Micrometer metrics.

Library

Add carml-observability-micrometer and register a MetricsObserver with your MeterRegistry:

MeterRegistry registry = new SimpleMeterRegistry();

RdfRmlMapper mapper = RdfRmlMapper.builder()
    .mapping(mapping)
    .observer(MetricsObserver.create(registry))
    .build();

For your own logging or progress reporting, implement MappingExecutionObserver. Every method has an empty default, so override the ones you need. Call .observer(...) once per observer to register several.

CLI

java -jar carml-jar-X.jar map -m mapping.ttl -o out.nq --metrics --direct-serialization=off

--metrics does two things:

  • While the mapping runs, it serves Prometheus metrics at http://localhost:9092/metrics.
  • When the mapping completes, it pushes the final metrics to a Prometheus Pushgateway at localhost:9091. To use another gateway, write --metrics=host:port.

A failed push is logged as a warning and does not fail the run.

The carml-jar repository has a ready-made Prometheus, Pushgateway and Grafana setup with a dashboard for these metrics, in docker/. Start it with docker compose up -d in that directory and open Grafana at http://localhost:3000/d/carml-mapping.

Metrics

Metric Type Tags
carml.statements.generated Counter triples_map
carml.statements.total Counter
carml.iterations.processed Counter triples_map, evaluator
carml.iterations.deduplicated Counter triples_map
carml.errors Counter triples_map
carml.mapping.completed Counter triples_map, reason
carml.mapping.duration Timer triples_map
carml.mapping.statements Distribution summary triples_map
carml.view.evaluation.duration Timer view, evaluator
carml.view.evaluation.iterations Distribution summary view, evaluator
carml.mappings.active Gauge

These are the Micrometer names. Prometheus shows them with underscores instead of dots.

carml.iterations.processed is updated per iteration, so it shows progress during a run. The statement counters are updated when a triples map completes.

A run that uses direct serialization does not go through the engine, so it reports no statement, iteration or duration metrics. That is why the example above switches it off.