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==1.0.0
Python 3.12, 3.13, and 3.14 are supported. Runtime Meridian dependencies are exactly pinned to their compatible 1.0.0 releases.
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
partitionedrecords deterministic per-event outcomes and is portable to append-oriented placements such as ClickHouse.atomicopens 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meridian_plugin_usage-1.0.0.tar.gz.
File metadata
- Download URL: meridian_plugin_usage-1.0.0.tar.gz
- Upload date:
- Size: 56.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e94ea30a4a6133757f5ad8cb158ae7a9b748d2657179eeaddff357de0cdf2b17
|
|
| MD5 |
f07ed7a6c7fc8f631f6a75d2adc64861
|
|
| BLAKE2b-256 |
8ab42a177a3b7b9d5ce1b0dd1696d427c014e105856db7eb4645b569d9c25f80
|
Provenance
The following attestation bundles were made for meridian_plugin_usage-1.0.0.tar.gz:
Publisher:
release.yml on zephytiju/meridian-plugin-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meridian_plugin_usage-1.0.0.tar.gz -
Subject digest:
e94ea30a4a6133757f5ad8cb158ae7a9b748d2657179eeaddff357de0cdf2b17 - Sigstore transparency entry: 2609306233
- Sigstore integration time:
-
Permalink:
zephytiju/meridian-plugin-usage@289dd5bdbd97f319eec202dd31e4f2227c7d65b7 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/zephytiju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@289dd5bdbd97f319eec202dd31e4f2227c7d65b7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file meridian_plugin_usage-1.0.0-py3-none-any.whl.
File metadata
- Download URL: meridian_plugin_usage-1.0.0-py3-none-any.whl
- Upload date:
- Size: 40.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7f14e1997c18f32d8fb5cf14cbaada4f82c2dfc60c18ba956f350955b8dee33
|
|
| MD5 |
193b437026d22a704233ddbdb846e75b
|
|
| BLAKE2b-256 |
3626cef743ce14d6d95c542adc9fde02666ca56619525d5df0f6efad6a1e1de6
|
Provenance
The following attestation bundles were made for meridian_plugin_usage-1.0.0-py3-none-any.whl:
Publisher:
release.yml on zephytiju/meridian-plugin-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meridian_plugin_usage-1.0.0-py3-none-any.whl -
Subject digest:
b7f14e1997c18f32d8fb5cf14cbaada4f82c2dfc60c18ba956f350955b8dee33 - Sigstore transparency entry: 2609306383
- Sigstore integration time:
-
Permalink:
zephytiju/meridian-plugin-usage@289dd5bdbd97f319eec202dd31e4f2227c7d65b7 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/zephytiju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@289dd5bdbd97f319eec202dd31e4f2227c7d65b7 -
Trigger Event:
push
-
Statement type: