формат архива показателей производительности (performance metrics archive format)
METADATA FILE (.meta) RECORDS
After the archive log label record, the metadata file contains
interleaved metric-description and timestamped instance-domain
descriptors. File size is limited to 2GiB, due to storage of
32-bit offsets within the temporal index. Unlike the data
volumes, these records are not forced to 32-bit alignment. See
also libpcp/logmeta.c.
pmDesc
Instances of this record represent the metric description, giving
a name, type, instance-domain identifier, and a set of names to
each PMID used in the archive volume.
┌───────┬────────┬───────────────────────────────────────────────────┐
│Offset │ Length │ Name │
├───────┼────────┼───────────────────────────────────────────────────┤
│ 0 │ 4 │ tag, TYPE_DESC=1 │
│ 4 │ 4 │ PMID │
│ 8 │ 4 │ type (PM_TYPE_*) │
│ 12 │ 4 │ instance domain number │
│ 16 │ 4 │ semantics of value (PM_SEM_*) │
│ 20 │ 4 │ units: bit-packed pmUnits │
│ 4 │ 4 │ number of alternative names for this PMID │
│ 28 │ 4 │ N: number of bytes in this name │
│ 32 │ N │ bytes of the name, no NULL terminator nor padding │
│ 32+N │ 4 │ N2: number of bytes in next name │
│ 36+N │ N2 │ bytes of the name, no NULL terminator nor padding │
│ ... │ ... │ ... │
└───────┴────────┴───────────────────────────────────────────────────┘
pmLogIndom
Instances of this record represent the number-string mapping
table of an instance domain. The instance domain number will
have already been mentioned in a prior pmDesc record. As new
instances may appear over a long archiving run these records are
timestamped, and must be searched when decoding pmResult records
from the archive data volumes. Instance names may be reused
between instance numbers, so an offset-based string table is used
that facilitates sharing.
┌─────────┬────────┬───────────────────────────────────────────────┐
│ Offset │ Length │ Name │
├─────────┼────────┼───────────────────────────────────────────────┤
│ 0 │ 4 │ tag, TYPE_INDOM=2 │
│ 4 │ 4 │ timestamp, seconds part (past UNIX epoch) │
│ 8 │ 4 │ timestamp, microseconds part │
│ 12 │ 4 │ instance domain number │
│ 16 │ 4 │ N: number of instances in domain, normally >0 │
│ 20 │ 4 │ first instance number │
│ 24 │ 4 │ second instance number (if appropriate) │
│ ... │ ... │ ... │
│ 20+4*N │ 4 │ first offset into string table (see below) │
│20+4*N+4 │ 4 │ second offset into string table (etc.) │
│ ... │ ... │ ... │
│ 20+8*N │ M │ base of string table, containing │
│ │ │ packed, NULL-terminated instance names │
└─────────┴────────┴───────────────────────────────────────────────┘
Records of this form replace the existing instance-domain: prior
records are not searched for resolving instance numbers in
measurements after this timestamp.
pmLogLabelSet
Instances of this record represent sets of name:value pairs
associated with labels of the context, instance domains and
individual performance metrics - refer to pmLookupLabels(3) for
further details.
Any instance domain number will have already been mentioned in a
prior pmDesc record. As new labels can appear during an
archiving session, these records are timestamped and must be
searched when decoding pmResult records from the archive data
volumes.
┌────────────┬────────┬────────────────────────────────────────────────┐
│ Offset │ Length │ Name │
├────────────┼────────┼────────────────────────────────────────────────┤
│ 0 │ 4 │ tag, TYPE_LABEL=3 │
│ 4 │ 4 │ timestamp, seconds part (past UNIX epoch) │
│ 8 │ 4 │ timestamp, microseconds part │
│ 12 │ 4 │ label type (PM_LABEL_* type macros.) │
│ 16 │ 4 │ numeric identifier - domain, PMID, etc │
│ │ │ or PM_IN_NULL=-1 for context labels │
│ 20 │ 4 │ N: number of label sets in this record, │
│ │ │ usually 1 except in the case of instances │
│ 24 │ 4 │ offset to the start of the JSONB labels string │
│ 28 │ L1 │ first labelset array entry (see below) │
│ ... │ ... │ ... │
│ 28+L1 │ LN │ N-th labelset array entry (see below) │
│ ... │ ... │ ... │
│28+L1+...LN │ M │ concatenated JSONB strings for all labelsets │
└────────────┴────────┴────────────────────────────────────────────────┘
Records of this form replace the existing labels for a given
type: prior records are not searched for resolving that class of
label in measurements after this timestamp.
The individual labelset array entries are variable length,
depending on the number of labels present within that set. These
entries contain the instance identifiers (in the case of type
PM_LABEL_INSTANCES labels), lengths and offsets of each label
name and value, and also any flags set for each label.
┌───────┬────────┬───────────────────────────────────────────┐
│Offset │ Length │ Name │
├───────┼────────┼───────────────────────────────────────────┤
│ 0 │ 4 │ instance identifier (or PM_IN_NULL=-1) │
│ 4 │ 4 │ length of JSONB label string │
│ 8 │ 4 │ N: number of labels in this labelset │
│ 12 │ 2 │ first label name offset │
│ 14 │ 1 │ first label name length │
│ 15 │ 1 │ first label flags (e.g. optionality) │
│ 16 │ 2 │ first label value offset │
│ 18 │ 2 │ first label value length │
│ 20 │ 2 │ second label name offset (if appropriate) │
│ ... │ ... │ ... │
└───────┴────────┴───────────────────────────────────────────┘
pmLogText
This record stores help text associated with a metric or an
instance domain - as provided by pmLookupText(3) and
pmLookupInDomText(3).
The metric identifier and instance domain number will have
already been mentioned in a prior pmDesc record.
┌───────┬────────┬──────────────────────────────────────────────┐
│Offset │ Length │ Name │
├───────┼────────┼──────────────────────────────────────────────┤
│ 0 │ 4 │ tag, TYPE_TEXT=4 │
│ 4 │ 4 │ text and identifier type (PM_TEXT_* macros.) │
│ 8 │ 4 │ numeric identifier - PMID or instance domain │
│ 12 │ M │ help text string, arbitrary text │
└───────┴────────┴──────────────────────────────────────────────┘