Skip to main content

meridian-plugin-usage

Meridian V1's open-source Usage plugin provides immutable metering events, exact unit normalization, bounded queries, deterministic window aggregation, retention inputs, and OpenTelemetry/Evidence correlation over logical Meridian Resources.

This distribution is a Python library and Meridian plugin. It is not a service or a Usage Catalog. It owns no database, provisions no engine, accepts no engine credentials, calculates no prices, and uses only released mapping-first Meridian Expressions.

Install

python -m pip install meridian-plugin-usage==2.0.1

See decimal replay compatibility for the storage roundtrip fix, unchanged v1 event fingerprints and legacy verification.

Python 3.12, 3.13, and 3.14 are supported. Runtime Meridian dependencies are exactly pinned to the compatible releases listed in compatibility.

Record immutable usage

Platform IaC renders the Meridian runtime, logical Resource placements, identity/ACL, migrations, retention, and engine lifecycle. Application code only creates the ready runtime and uses this library:

from datetime import UTC, datetime
from decimal import Decimal

from meridian_storage.plugins.usage import (
    DimensionSpec,
    MeterV1,
    UnitTransform,
    Usage,
    UsageEvent,
    UsageScope,
    UsageWindow,
)

usage = Usage(ready_meridian)

meter = MeterV1(
    meter_id="api.requests",
    version=1,
    quantity="requests",
    canonical_unit="request",
    transforms={"kilorequest": UnitTransform(Decimal("1000"))},
    dimensions=(DimensionSpec("region", required=True),),
    scale=6,
    active_from=datetime(2026, 1, 1, tzinfo=UTC),
)
usage.repository.register_meter(meter)

event = UsageEvent(
    event_id="publisher-event-0001",
    scope=UsageScope({"tenant": "acme", "environment": "prod"}),
    subject_id="account-42",
    meter_id=meter.meter_id,
    meter_version=meter.version,
    window=UsageWindow(
        datetime(2026, 8, 26, 10, 0, tzinfo=UTC),
        datetime(2026, 8, 26, 10, 1, tzinfo=UTC),
    ),
    value=Decimal("2"),
    unit="kilorequest",
    dimensions={"region": "us-west"},
    source="publisher",
)
receipt = usage.recorder.record(event)
assert receipt.event.value == Decimal("2000.000000")

An identical replay returns RecordStatus.REPLAYED. The same scoped event_id with different normalized content raises the stable MERIDIAN_USAGE_IMMUTABLE_CONFLICT error. Corrections are new signed events referencing correction_of; existing events are never mutated.

Query and aggregate

page = usage.queries.events(
    event.scope,
    datetime(2026, 8, 26, 10, 0, tzinfo=UTC),
    datetime(2026, 8, 26, 11, 0, tzinfo=UTC),
    where={"meterId": meter.meter_id},
).page(limit=100).execute()

Every query is scope-bound, time-bounded, cursor-paginated, and exposed both as a mapping-first Expression and a serialized Query 1.0.0 logical plan. Aggregation is a library worker with deterministic claims, immutable aggregate versions, and compare-and-set watermark checkpoints. Retrying after a crash replays identical outputs; late events create a new version that names the version it supersedes.

Batch profiles

  • partitioned records deterministic per-event outcomes and is portable to append-oriented placements such as ClickHouse.
  • atomic opens one Meridian transaction on the events Resource and is accepted only when the rendered placement advertises the transaction capability.

Batch manifests and aggregation control records are logical structured Resources. They are not a private database.

Contracts and evidence

The package ships released Semantics schemas, plugin/schema-provider entry points, JSON Schema compatibility evidence, deterministic golden fingerprints, unit/integration/conformance tests, reproducible build checks, and Apache-2.0 LICENSE/NOTICE material.

See architecture, recording, aggregation, configuration, compatibility, and conformance.

Licensed under the Apache License, Version 2.0.

Metadata

Release files for meridian-plugin-usage 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meridian-plugin-usage 2.0.1
File Size Uploaded
meridian_plugin_usage-2.0.1.tar.gz 77.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meridian-plugin-usage 2.0.1
File Interpreter ABI Platform
meridian_plugin_usage-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 120.0 kB

Release files / meridian_plugin_usage-2.0.1.tar.gz

Download URL meridian_plugin_usage-2.0.1.tar.gz
Size 77.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4f59b1b55406f899ccaa7146b682c9252e13051985ce13748f7bfd8ca2f6119d
BLAKE2b-256 checksum
How to use checksums
8701c9d873ee94ff31448869232fcec448fd885f386a7fb5c26185def0c7a8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / meridian_plugin_usage-2.0.1-py3-none-any.whl

Download URL meridian_plugin_usage-2.0.1-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf4d31fb67f2b0957f8f585f282b1a5a4e5745af46185ae6f3cf263bba7867dc
BLAKE2b-256 checksum
How to use checksums
696d1142e5aa66a85ca5b99c1d0b5da7dc9b0062bb5d9241ef0b0dc96d82d44c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.2

2 release files

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page