Storage holds minute and hourly statistics counters, gauges and top-N rollups per node, readable for one node or all nodes #111
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
lantea-one/ninlil#111
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The dashboard needs time series, range totals and top-N lists that survive query-log pruning, for DNS and DHCP, per node and combined.
MetricEntityhas no bucket size and no node, so a minute row and an hour row cannot be told apart, and two nodes on one database would write the same row. Its only index is non-unique on(Category, Name, TimestampUtc)(src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Configuration/MetricConfiguration.cs:27-32). Nothing writes the table today, so its shape can change without a data conversion.What changes
MetricEntity: addNodeId(Guid, the writing node'sClusterOptions.NodeId, see #112) andBucketSeconds(int: 60 or 3600). Replace the index with a unique one on(NodeId, Category, Name, BucketSeconds, TimestampUtc);TimestampUtcis the bucket start. Add an index on(Category, BucketSeconds, TimestampUtc)for all-node reads.IMetricRepository:AddAsync(IReadOnlyCollection<MetricIncrement>)adds to the row'sValue, creating it when missing. Technical call: the add is atomic in the database (anUPDATE … SET Value = Value + @deltawith an insert when no row matched, retried on a unique-key race;$incwith upsert on MongoDB), so an overlapping or retried flush never loses a count.SetAsync(IReadOnlyCollection<MetricSample>)replacesValue.Guid? nodeId(null = all nodes):ListSeriesAsync(category, namePrefix, bucketSeconds, fromUtc, toUtc, nodeId, MetricAggregateEnum aggregate)returns rows (name, bucket start, value) for charts.SumByNameAsync(category, namePrefix, bucketSeconds, fromUtc, toUtc, nodeId)returns one total per name, for tiles and doughnuts.ListNodeIdsAsync(fromUtc, toUtc)returns the distinct node ids that wrote rows in the range, for the node filter.MetricAggregateEnum.Sum) and gauges take the maximum per bucket (Max). Nodes on one database read the same lease table, so summing their lease gauges would count every lease once per node.dns,dhcp-v4,dhcp-v6(the ones the entity summary already names).DnsQueryTopItemEntity(NodeId,BucketStartUtchour,KindenumDomain|BlockedDomain|Client,Key(max 255),Count), unique on(NodeId, BucketStartUtc, Kind, Key).AddAsync(batch)with the same atomic add, andTopAsync(kind, fromUtc, toUtc, take, nodeId), which sums across buckets (and across nodes whennodeIdis null) in the database.DeleteOlderThanAsync(bucketSeconds, cutoffUtc)on metrics andDeleteOlderThanAsync(cutoffUtc)on top items, across every node.AddStatisticsRollups), Mongo repository, class map and indexes inMongoIndexCatalog, and aMongoSchemaSteps.Knownentry if an older build would misread the documents.BackupEntityCatalogalready excludesMetricEntityas telemetry (src/dotnet/src/Ninlil.Dns.Server.Backup/Catalog/BackupEntityCatalog.cs:27-29); excludeDnsQueryTopItemEntitythe same way and add it to that summary.Acceptance
src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests: two hourly buckets ofexample.com(3 and 4) on one node return one top item with Count 7. Runs on every engine (SQLite without Docker, the restRequiresDocker).nodeId = Areads 5,nodeId = nullreads 8, andListNodeIdsAsyncreturns both ids.Max.AddAsynccalls of 5 to the same counter row leaveValue == 10on every engine.SetAsynctwice on one gauge row keeps the second value.bucketSeconds.Source
audit-feature-parity.md§2A #1.