kind: Metric — count
A metric declares once the number everyone must read the same way: what it counts or sums, over which rows, in which unit.
Before and after
The desk's orders come from an old ERP. Its users typed the status by hand: En cours, encours,
TERMINE. Ask the chat how many orders are in progress. It cannot say:
$ lm --context desk ask "Combien de commandes sont en cours ?" --scope desk
I can't answer that from the data available for this scope — the question doesn't map to the declared schema.
The metric declares that number once:
# 10-open-orders.yaml — what the desk still has to deliver.
#
# Over the typed orders (entities/56-order.yaml). `status~cours` keeps En cours, encours and
# EN COURS alike: `~` is a case-insensitive substring.
apiVersion: apps.lumnik.io/v1
kind: Metric
metadata:
name: open_orders
spec:
scope: desk
title: Commandes en cours
description: Ce que le desk doit encore livrer.
source:
entity: DeskOrder
where:
- status~cours
measures:
open_amount: { sum: amount, unit: EUR }
open_orders: { count: rows }
scopeis who may read the metric. It must be one of the entity's scopes.where: status~courskeeps every status that containscours, in any case. One filter catchesEn cours,encours, and anEN COURStyped tomorrow.count: rowscounts the orders that passwhere.sum: amountadds their amounts. A sum always carries aunit. A count has none.
Ask the same question again. Look at the metric: line under the answer:
$ lm --context desk ask "Combien de commandes sont en cours ?" --scope desk
4
data as of: 2026-11-23T15:58:48.165282Z (last completed run)
metric: Commandes en cours — count(rows) where status~cours
OPEN_ORDERS
4
1 row returned
SQL: SELECT "open_orders" FROM (SELECT "open_amount", "open_orders" FROM connector."metric_open_orders") AS "metric_open_orders"
LIMIT 500
The amount comes with its unit, taken from the manifest:
$ lm --context desk ask "Quel est le montant total des commandes en cours ?" --scope desk
The total amount of open orders is 1960.75.
data as of: 2026-11-23T15:58:48.165282Z (last completed run)
metric: Commandes en cours — sum(amount) where status~cours (EUR)
TOTAL_AMOUNT
1960.75
1 row returned
SQL: SELECT SUM("open_amount") AS total_amount FROM (SELECT "open_amount", "open_orders" FROM connector."metric_open_orders") AS "metric_open_orders"
LIMIT 500
The desk context above is an integrator bound to scope:desk. lm ask needs lm_integrator.
Set it up yourself
Land the typed orders
The orders come from docs/apps/demo/data/acme-orders.csv. Copy it as the
demo desk does. This source reads it with amount typed as a
number, because a metric sums numbers only:
# 31-orders-typed.yaml — the same orders export as 30-orders.yaml, its amount and date typed at the door.
#
# Lands connector.t_acme_desk_orders_typed: `amount` a number, `ordered_on` a date, so a metric can sum
# them. The status column stays as the ERP spells it. 30-orders.yaml is left as it is: other demo pieces
# read its table.
apiVersion: connectors.lumnik.io/v1
kind: Connector
metadata:
name: acme-desk-orders-typed
connector_type: csv-file
scopes: [desk]
spec:
transport:
kind: local
path: acme-desk/acme-orders.csv # the same file as 30-orders.yaml
parser:
has_header: true
after_process: none
mapping:
cell:
- parse-number: { column: amount, decimal-separator: "." }
- parse-date: { column: ordered_on, formats: ["yyyy-MM-dd"] }
$ lm apply -f docs/apps/demo/sources/31-orders-typed.yaml
Applied connector "acme-desk-orders-typed" — 1 endpoint
$ lm connector run acme-desk-orders-typed
run scheduled: 15ac3d26-9c3f-4a7c-97f4-99af09113b67
Wait until the run says Completed:
$ lm run list
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED
15ac3d26 acme-desk-orders-typed default Completed 12 12 0 0 2026-11-23 16:58 2026-11-23 16:58
Apply the entity
# 56-order.yaml — the desk's orders, typed: what metrics/10-open-orders.yaml counts and sums.
#
# Over the typed source (sources/31-orders-typed.yaml): `amount` is a number, `ordered_on` a date.
kind: Entity
name: DeskOrder
match: [order_no]
scopes: [desk]
sources:
- table: t_acme_desk_orders_typed
map: { order_no: order_no, code: code, status: status, amount: amount, ordered_on: ordered_on }
Look at the STATUS column. The four orders in progress are spelled three ways:
$ lm entity apply -f docs/apps/demo/entities/56-order.yaml
Applied entity "DeskOrder" → connector."v_deskorder"
$ lm --context desk entity get deskorder
ORDER_NO CODE STATUS AMOUNT ORDERED_ON _CONFLICTS
SO-000001 P-1000 En cours 1250 2026-08-02 {}
SO-000002 P-1001 fini 380.5 2026-08-03 {}
SO-000003 P-1002 TERMINE 2200 2026-08-03 {}
SO-000004 P-1003 BROUILLON 90 2026-08-05 {}
SO-000005 P-1000 encours 640 2026-08-06 {}
SO-000006 P-1008 EN LITIGE 4100 2026-08-07 {}
SO-000007 P-1005 En cours 15.75 2026-08-09 {}
SO-000008 P-1009 Terminé 999.99 2026-08-10 {}
SO-000009 P-1010 120 2026-08-11 {}
SO-000010 P-1004 EN LITIGE 77 2026-08-12 {}
SO-000011 P-1006 BROUILLON 3000 2026-08-12 {}
SO-000012 P-1011 En cours 55 2026-08-13 {}
SO-000001, SO-000005, SO-000007 and SO-000012 come to 1960.75.
Apply the metric
$ lm metric apply -f docs/apps/demo/metrics/10-open-orders.yaml
Applied metric "open_orders" (definition version 1)
$ lm metric list
NAME TITLE ENTITY SCOPE STATUS REASON
open_orders Commandes en cours DeskOrder desk valid
Read it without the chat
lm metric get prints the numbers, the unit, how each one is computed, and the date of the data:
$ lm --context desk metric get open_orders
Commandes en cours
OPEN_AMOUNT OPEN_ORDERS _DISPUTED
1960.75 4 0
open_amount: EUR
open_amount = sum(amount) where status~cours
open_orders = count(rows) where status~cours
data as of: 2026-11-23T15:58:48.165282Z (last completed run)
_DISPUTEDcounts the orders whose sources disagree on a column the metric reads.data as ofis the last completed run of the connectors under the entity.
Reading the metric: line
The line is there
Each row of the answer is a row the metric holds, whole. The line gives its title, how it is computed and its unit, as in Before and after.
The line says (disputed)
Some records behind the metric disagree between their sources. The demo's OrderDue fuses the ERP's
orders and a partner's copy. They disagree on the due date of SO-2. Land both sources, the entity,
and a metric that reads the due date:
# 20-due-orders.yaml — the orders due, over the ERP's and a partner's copy of them (entities/55-order-due.yaml).
#
# One row, no `by`: the amount due and how many orders carry a due date. The partner typed (sources/72) disagrees
# with the ERP on SO-2's due day, so the metric's line says (disputed).
apiVersion: apps.lumnik.io/v1
kind: Metric
metadata:
name: due_orders
spec:
scope: desk
title: Commandes à échéance
source:
entity: OrderDue
measures:
due_amount: { sum: amount, unit: EUR }
dated_orders: { count: due }
$ lm apply -f docs/apps/demo/sources/70-due-erp.yaml
Applied connector "due-erp" — 1 endpoint
$ lm apply -f docs/apps/demo/sources/72-due-partner-typed.yaml
Applied connector "due-partner" — 1 endpoint
$ lm connector run due-erp
run scheduled: 1b6f2148-bbfe-4781-a0d8-6b59c3336544
$ lm connector run due-partner
run scheduled: 7ee0077c-8e14-479f-b3f1-f21b012c5c89
Wait until lm run list shows both runs Completed. Then apply the entity and the metric:
$ lm entity apply -f docs/apps/demo/entities/55-order-due.yaml
Applied entity "OrderDue" → connector."v_orderdue"
$ lm metric apply -f docs/apps/demo/metrics/20-due-orders.yaml
Applied metric "due_orders" (definition version 1)
_DISPUTED counts one order:
$ lm --context desk metric get due_orders
Commandes à échéance
DUE_AMOUNT DATED_ORDERS _DISPUTED
2480.5 2 1
due_amount: EUR
due_amount = sum(amount)
dated_orders = count(due)
data as of: 2026-11-23T15:59:04.878504Z (last completed run)
The chat says it on the metric: line, and points to the conflicts:
$ lm --context desk ask "Quel est le montant des Commandes à échéance ?" --scope desk
The amount of Due Orders is 2480.5.
data as of: 2026-11-23T15:59:04.878504Z (last completed run)
metric: Commandes à échéance — sum(amount) (EUR) (disputed)
DUE_AMOUNT
2480.5
1 row returned
SQL: SELECT "due_amount" FROM (SELECT "due_amount", "dated_orders" FROM connector."metric_due_orders") AS "metric_due_orders"
LIMIT 500
try: lm conflicts list — where this scope has source conflicts or lookup ambiguities, row by row
lm conflicts list names the record and the column:
$ lm --context desk conflicts list --entity OrderDue
ENTITY KEY COLUMNS SOURCES
OrderDue SO-2 due t_due_erp,t_due_partner
(disputed) also shows when the hub could not check the answer in time. Then lm conflicts list
lists nothing. Ask again, or read the number with lm metric get.
There is no line
The chat computed something the metric does not hold: a share, a spread, a count of the metric's rows, or a figure read from another table. A row is not a row of the metric when it adds:
- a label joined from the entity;
- a second metric on the same row;
- a pivot;
- a constant or a translated value.
A text is cited only when a row of the metric holds exactly that text, so a number written inside a
text (36.00 EUR) is not cited unless the metric holds it as is. A text longer than 256 characters
cancels the line. The answer may still be right, but it is not the metric's row.
A row can also be the metric's, whole, and still cancel the line. A row that shows a value of a measure's kind must also show a measure. A number measure is a count, a sum, an average, a formula, or a min or max of numbers. A date measure is a min or max of dates. A text holding a digit counts as a number. So, on a row that shows no measure:
- in a metric with a number measure, a number found only in a dimension, like a warehouse number,
cancels the line, and so does a label holding a digit, like
M8 bolt; - in a metric with a date measure, a date found only in a date dimension cancels the line.
The row is the metric's, but no value it shows is a measure.
Ask the same question with a lower-case commandes. The chat sums the ERP's table on its own:
$ lm --context desk ask "Quel est le montant des commandes à échéance ?" --scope desk
The total amount of orders due is 2480.50.
data as of: 2026-11-23T15:59:04.803786Z (last completed run)
DUE_AMOUNT
2480.50
1 row returned
SQL: SELECT SUM("amount") AS "due_amount" FROM (SELECT "order_no", "due_at", "amount" FROM connector."t_due_erp") AS "t_due_erp"
LIMIT 500
The figure matches, but it is one source's sum, and nobody declared it. Read the SQL line.
When the chat counts the metric's own row instead of reading its number, the hub does not run it:
$ lm --context desk ask "How many open orders are there?" --scope desk
I won't run this: 'Commandes en cours' is a declared metric that already holds its figures in one row: counting that row does not count the records. Ask for its value instead: open_amount, open_orders.
no rows returned
SQL: SELECT COUNT(*) FROM "connector"."metric_open_orders"
LIMIT 500
Ask in the metric's words. The French question above reads 4.
When the entity changes
A metric follows its entity. Remove amount: amount from the entity's map and apply it again:
map: { order_no: order_no, code: code, status: status, ordered_on: ordered_on }
The entity is applied. The metric it can no longer compute is named on the way:
$ lm entity apply -f docs/apps/demo/entities/56-order.yaml
Applied entity "DeskOrder" → connector."v_deskorder"
metric open_orders is now invalid: spec.measures.open_amount.sum: DeskOrder has no column 'amount'
$ lm metric list
NAME TITLE ENTITY SCOPE STATUS REASON
open_orders Commandes en cours DeskOrder desk invalid spec.measures.open_amount.sum: DeskOrder has no column 'amount'
$ lm --context desk metric get open_orders
Error: API error 409: metric open_orders is invalid: spec.measures.open_amount.sum: DeskOrder has no column 'amount'
An invalid metric serves no number, to lm or to the chat. Put amount: amount back and apply the
entity again. The metric is valid again, with no gesture of its own:
$ lm entity apply -f docs/apps/demo/entities/56-order.yaml
Applied entity "DeskOrder" → connector."v_deskorder"
$ lm metric list
NAME TITLE ENTITY SCOPE STATUS REASON
open_orders Commandes en cours DeskOrder desk valid
A metric never blocks its entity.
Refusals
A metric the hub cannot compute honestly is refused at apply. Nothing is created.
A text column in a sum
The demo's first orders source, 30-orders.yaml, lands every column as text. An entity over it,
raw-order.yaml:
kind: Entity
name: RawOrder
match: [order_no]
scopes: [desk]
sources:
- table: t_acme_desk_orders
map: { order_no: order_no, status: status, amount: amount }
A metric that sums its amount, raw-open-amount.yaml:
apiVersion: apps.lumnik.io/v1
kind: Metric
metadata:
name: raw_open_amount
spec:
scope: desk
title: Open amount
source:
entity: RawOrder
where:
- status~cours
measures:
open_amount: { sum: amount, unit: EUR }
$ lm apply -f docs/apps/demo/sources/30-orders.yaml
Applied connector "acme-desk-orders" — 1 endpoint
$ lm connector run acme-desk-orders
run scheduled: 8d2fc6e8-5a52-4afd-88bb-4d3d34c0c4fb
Once the run is Completed:
$ lm entity apply -f raw-order.yaml
Applied entity "RawOrder" → connector."v_raworder"
$ lm metric apply -f raw-open-amount.yaml
Error: API error 400: spec.measures.open_amount.sum: amount is text in RawOrder. To retype it: type it in the connector's mapping (`parse-number`), delete the entities over its table, `lm connector delete <connector> --force` (drops the table and its rows), apply the connector, run it, apply the entities, then the metrics again.
$ lm entity delete RawOrder --force
deleted: RawOrder
The hub never turns text into a number for you: a value such as 1 234,56 € would break the read
for everyone. Type the column where it lands. 31-orders-typed.yaml above does exactly that, with
parse-number on amount.
An unknown column
measures:
open_total: { sum: total, unit: EUR }
$ lm metric apply -f unknown-column.yaml
Error: API error 400: spec.measures.open_total.sum: DeskOrder has no column 'total'
The columns are the entity's, as its manifest maps them.
A unit that does not match
A formula keeps the unit of the measure it reads:
measures:
open_amount: { sum: amount, unit: EUR }
open_weight: { formula: open_amount, unit: kg }
$ lm metric apply -f unit-mismatch.yaml
Error: API error 400: spec.measures.open_weight.unit: the unit is kg, but open_amount is EUR
The name apply
metadata:
name: apply
$ lm metric apply -f apply.yaml
Error: API error 400: metadata.name: 'apply' is reserved (it is the apply door's own path)
Choose another name: lower case, digits and _, starting with a letter, 40 characters at most.
Heavy metrics
A metric is computed when it is read. On a large entity, that read takes time. With
materialize: true, the hub computes the metric after a run of its sources changes its rows, and
stores the computed result. A read then returns the stored numbers.
When to set it
There is no fixed threshold. These all count:
- the entity's size;
- its fusion: over an entity fused from several sources, a
whereapplies after every row is fused, unless it filters on the entity'smatchcolumn; - how many rows
bymakes; - how often its sources change: each run that changes a row of a table the metric's entity reads computes it again.
As a guide: on the hub's bench, a read over an entity fused from two sources takes more than 1 s from about 100 000 rows. Between 500 000 and 600 000 rows, it passes the reader's 5 s timeout, and the read fails.
A metric without the flag is not computed after a run. It is computed when it is read, from the data as it is then. Keep small metrics that way.
Set it
# 30-orders-by-week.yaml — the desk's orders per week, computed again after a run of their source changes them.
#
# Over the typed orders (entities/56-order.yaml). `materialize: true` stores the computed result: a read takes the
# stored numbers instead of computing them over the entity.
apiVersion: apps.lumnik.io/v1
kind: Metric
metadata:
name: orders_by_week
spec:
scope: desk
title: Commandes par semaine
materialize: true
source:
entity: DeskOrder
by:
- week: ordered_on
measures:
weekly_amount: { sum: amount, unit: EUR }
weekly_orders: { count: rows }
materialize: truestores the computed result.false, the default, computes at read.by: [{ week: ordered_on }]gives one row per week.
Land the typed orders and apply the entity, as in Set it up yourself. Then apply the metric. Right after the apply, it is not computed yet:
$ lm metric apply -f docs/apps/demo/metrics/30-orders-by-week.yaml
Applied metric "orders_by_week" (definition version 1)
$ lm metric get orders_by_week
Error: metric orders_by_week is not computed yet (since 2026-11-24T15:33:11.666656Z) — retry in a moment
$ lm metric list
NAME TITLE ENTITY SCOPE STATUS MATERIALIZED REASON
orders_by_week Commandes par semaine DeskOrder desk valid yes
The hub computes it in the background. A moment later:
$ lm metric get orders_by_week
Commandes par semaine
WEEK WEEKLY_AMOUNT WEEKLY_ORDERS _DISPUTED
2026-07-27 1250 1 0
2026-08-03 7426.25 6 0
2026-08-10 4251.99 5 0
weekly_amount: EUR
weekly_amount = sum(amount), by week of ordered_on, UTC
weekly_orders = count(rows), by week of ordered_on, UTC
data as of: 2026-11-24T15:33:10.554679Z (last completed run)
computed 2026-11-24T15:34:09.022516Z
computedis when the hub computed this result.data as ofis the last completed run of its sources, as its line says. It is not the time of the computation.
These captures were taken with a 1-minute computation interval, so that each state stays long enough to show. The default interval is 5 seconds.
After a new run
A run of a source the entity reads either changes a row of a table the entity reads, or it does not. The hub looks at the table, not at the rows the metric selects:
- A run that changed a row of such a table makes the metric refreshing, even when the metric's
wherefilters that row out. The hub computes it again. - A run that changed no row only moves
data as of. The numbers andcomputedstay.
A run counts when it ends, whatever its status. A run that ends Failed or Cancelled may have
written rows before it stopped. Those rows count too. The metric becomes refreshing within about a
minute.
A run that changes nothing
The ERP exports the same file again. Run the connector. The file has not changed, so the run reads
nothing: IN 0.
$ lm connector run acme-desk-orders-typed
run scheduled: f34f4172-ff37-4cf5-a0c3-e6492d8dd27a
$ lm run list
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED
f34f4172 acme-desk-orders-typed default Completed 0 0 0 0 2026-11-24 16:34 2026-11-24 16:34
cffab801 acme-desk-orders-typed default Completed 12 12 0 0 2026-11-24 16:33 2026-11-24 16:33
$ lm metric get orders_by_week
Commandes par semaine
WEEK WEEKLY_AMOUNT WEEKLY_ORDERS _DISPUTED
2026-07-27 1250 1 0
2026-08-03 7426.25 6 0
2026-08-10 4251.99 5 0
weekly_amount: EUR
weekly_amount = sum(amount), by week of ordered_on, UTC
weekly_orders = count(rows), by week of ordered_on, UTC
data as of: 2026-11-24T15:34:29.239266Z (last completed run)
computed 2026-11-24T15:34:09.022516Z
The numbers and computed are the same. data as of moved to the end of the new run.
A run that changes a row
The ERP exports again, with one more order. Add it to the file in your tenant's folder (demo desk):
docker compose -f docker-compose.selfhost.yml exec hub sh -c \
'echo "SO-000013,P-1012,En cours,410.00,2026-08-14" >> /tmp/drop/1/acme-desk/acme-orders.csv'
Run the connector. The run writes the new order to a table the entity reads. The metric is refreshing at once.
While refreshing, the metric serves the numbers computed before the run. Its data as of is the
last completed run those numbers reflect, as its line says. It is older than the run just listed:
$ lm connector run acme-desk-orders-typed
run scheduled: 173af2ed-cce0-4223-afb5-56c6581e853d
$ lm run list
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED
173af2ed acme-desk-orders-typed default Completed 13 13 0 0 2026-11-24 16:35 2026-11-24 16:35
f34f4172 acme-desk-orders-typed default Completed 0 0 0 0 2026-11-24 16:34 2026-11-24 16:34
cffab801 acme-desk-orders-typed default Completed 12 12 0 0 2026-11-24 16:33 2026-11-24 16:33
$ lm metric get orders_by_week
Commandes par semaine
WEEK WEEKLY_AMOUNT WEEKLY_ORDERS _DISPUTED
2026-07-27 1250 1 0
2026-08-03 7426.25 6 0
2026-08-10 4251.99 5 0
weekly_amount: EUR
weekly_amount = sum(amount), by week of ordered_on, UTC
weekly_orders = count(rows), by week of ordered_on, UTC
data as of: 2026-11-24T15:34:29.239266Z (last completed run reflected)
computed 2026-11-24T15:34:09.022516Z, refreshing since 2026-11-24T15:35:10.091485Z
refreshing since is when the result became stale. Once the new result is computed, it replaces
the old one whole. The week of 2026-08-10 now counts the new order:
$ lm metric get orders_by_week
Commandes par semaine
WEEK WEEKLY_AMOUNT WEEKLY_ORDERS _DISPUTED
2026-07-27 1250 1 0
2026-08-03 7426.25 6 0
2026-08-10 4661.99 6 0
weekly_amount: EUR
weekly_amount = sum(amount), by week of ordered_on, UTC
weekly_orders = count(rows), by week of ordered_on, UTC
data as of: 2026-11-24T15:35:10.071246Z (last completed run)
computed 2026-11-24T15:36:09.011712Z
What data as of tells you
data as ofis the newest run that endedCompletedorPartialand that the numbers take into account. It says how fresh they are.- A metric that is computed and not refreshing has no known ended run that changed its rows since.
- A run still running is not counted yet. The rows it wrote count when it ends.
- The hub checks when a run ends, when a computation ends, and again every minute.
- A run that changed data and ended while the metric was being computed makes it refreshing again as soon as that computation ends.
While a run is still running, another run that changes nothing can move data as of. The rows the
running run already wrote are not in the numbers yet. Over the HTTP API, this date is the
dataAsOf field:
dataAsOf is a completed-run freshness marker, not a transactional cutoff proving that no concurrent run has committed visible chunks.
The three states
Each tenant has its own computed result, so each tenant has its own state. The hub's own tenant,
hubadmin, has no computed result of a shared materialised metric: it reads not computed yet.
Read the metric from another tenant.
| State | lm metric get |
The chat |
|---|---|---|
| computed | the numbers, computed <when> |
answers from them |
| refreshing | the numbers computed before, computed <when>, refreshing since <when> |
answers from the numbers computed before, with their date |
| not computed yet | metric <name> is not computed yet (since <when>) — retry in a moment |
does not answer: it says the metric is being computed, and since when |
A metric is not computed yet:
- right after its apply;
- after each apply of its entity;
- after
lm endpoint purgeof a table its entity reads. The numbers computed from the purged rows are withdrawn at once.
It never reads as zero while it is not computed yet. Over the HTTP API, the read answers 503
with Retry-After: 60 (errors).
Re-applying the same manifest
Each apply of a metric gives it a new definition version, even when the manifest has not changed. A materialised metric is then computed again, and reads not computed yet until it is:
$ lm metric apply -f docs/apps/demo/metrics/30-orders-by-week.yaml
Applied metric "orders_by_week" (definition version 2)
$ lm metric get orders_by_week
Error: metric orders_by_week is not computed yet (since 2026-11-24T15:36:09.620858Z) — retry in a moment
Apply a materialised metric when its manifest changes, not on every deployment.
When a computation fails
The result computed before keeps serving. lm metric get gives the reason on a last error: line.
The hub tries again after 1 minute, then waits twice as long after each failure, up to 1 hour.
Two settings of the hub stop a computation:
lumnik.metric.materialize.timeout(envLUMNIK_METRIC_MATERIALIZE_TIMEOUT), 2 minutes by default. The error istimeout.lumnik.metric.materialize.max-points(envLUMNIK_METRIC_MATERIALIZE_MAX_POINTS), 1 000 000 rows of the metric by default.
Here the hub was restarted with lumnik.metric.materialize.max-points=2. The metric has three
weeks. A new order landed, and its computation failed. The identical re-apply above computed the
metric again in between, so computed is later than in the captures before:
$ lm metric get orders_by_week
Commandes par semaine
WEEK WEEKLY_AMOUNT WEEKLY_ORDERS _DISPUTED
2026-07-27 1250 1 0
2026-08-03 7426.25 6 0
2026-08-10 4661.99 6 0
weekly_amount: EUR
weekly_amount = sum(amount), by week of ordered_on, UTC
weekly_orders = count(rows), by week of ordered_on, UTC
data as of: 2026-11-24T15:35:10.071246Z (last completed run reflected)
computed 2026-11-24T15:37:09.011240Z, refreshing since 2026-11-24T15:37:14.236761Z
last error: the metric has more than 2 groups
data as of is still the last completed run the served numbers reflect. The run that just
landed is not in them.
Limits
- Size. A metric without
materialize: trueis computed when it is read. Between 500 000 and 600 000 rows of a fused entity, a read takes longer than the reader's 5 s timeout. See Heavy metrics. - No
!=inwhere. "Every order not finished" cannot be declared yet. Filter on what the rows contain, such asstatus~cours. - A column named
rows.count: rowsalways counts the rows. A column literally namedrowscannot be counted withcount:. - Dates and text. A
minormaxof a date or a text is not shown as ametric:line in the chat.lm metric getshows it. - The metric's words. The chat reads a metric reliably when the question uses the metric's own words. The demo's titles are French, so a French question finds them more reliably.
Other tables on the same scope
The demo desk also lands 30-orders.yaml. Its untyped orders
table sits on the same desk scope, with the same column names. There, the count question
abstains:
$ lm --context desk ask "Combien de commandes sont en cours ?" --scope desk
I can't answer that from the data available for this scope — the question doesn't map to the declared schema.
The amount question still reads the metric. lm metric get open_orders reads the number without the
chat, whatever else the scope holds.
Reference
| Kind | Metric — apps.lumnik.io/v1 |
| Over | one Entity, in one of its scopes |
| Declares | measures (count, count_distinct, sum, avg, min, max, formula), an optional where, optional by columns, a unit on every amount, an optional materialize: true (Heavy metrics) |
| Commands | lm metric apply -f · lm metric delete — lm_integrator. lm metric list · lm metric get — lm_user, only the scopes you hold |
| Edition | Open. The chat (lm ask) needs Pro |
See also
- Entities — what a metric reads.
- Scopes — who reads a metric.
- When Ask refuses — the
metric:line among the others. - HTTP API — the
metricsfield of an Ask answer.