diff --git a/README.md b/README.md index 04f05c8..e6aeef3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Build & Test](https://github.com/ClusterCockpit/cc-metric-store/actions/workflows/test.yml/badge.svg)](https://github.com/ClusterCockpit/cc-metric-store/actions/workflows/test.yml) +The cc-metric-store provides a simple in-memory time series database for storing metrics of cluster nodes at preconfigured intervals. It is meant to be used as part of the [ClusterCockpit suite](https://github.com/ClusterCockpit). As all data is kept in-memory (but written to disk as compressed JSON for long term storage), accessing it is very fast. It also provides aggregations over time *and* nodes/sockets/cpus. + Go look at the `TODO.md` file and the [GitHub Issues](https://github.com/ClusterCockpit/cc-metric-store/issues) for a progress overview. Things work, but are not properly tested. The [NATS.io](https://nats.io/) based writing endpoint consumes messages in [this format of the InfluxDB line protocol](https://github.com/ClusterCockpit/cc-specifications/blob/master/metrics/lineprotocol_alternative.md). diff --git a/metric-store.go b/metric-store.go index e82a289..7ba7622 100644 --- a/metric-store.go +++ b/metric-store.go @@ -62,7 +62,7 @@ func handleLine(dec *lineprotocol.Decoder) error { return err } - var cluster, host, typeName, typeId string + var cluster, host, typeName, typeId, subType, subTypeId string for { key, val, err := dec.NextTag() if err != nil { @@ -81,18 +81,24 @@ func handleLine(dec *lineprotocol.Decoder) error { typeName = string(val) case "type-id": typeId = string(val) - case "unit", "group": - // Ignore... (Important only for ganglia) + case "subtype": + subType = string(val) + case "stype-id": + subTypeId = string(val) default: - return fmt.Errorf("unkown tag: '%s' (value: '%s')", string(key), string(val)) + // Ignore unkown tags (cc-metric-collector might send us a unit for example that we do not need) + // return fmt.Errorf("unkown tag: '%s' (value: '%s')", string(key), string(val)) } } - selector := make([]string, 0, 3) - selector = append(selector, cluster) - selector = append(selector, host) + selector := make([]string, 2, 4) + selector[0] = cluster + selector[1] = host if len(typeId) > 0 { selector = append(selector, typeName+typeId) + if len(subTypeId) > 0 { + selector = append(selector, subType+subTypeId) + } } var value Float