mirror of
https://github.com/redis/go-redis.git
synced 2026-10-24 07:59:20 +03:00
* chore(deps): bump golang.org/x/sys from 0.48.0 to 0.49.0 Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.48.0 to 0.49.0. - [Commits](https://github.com/golang/sys/compare/v0.48.0...v0.49.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.49.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): go mod tidy submodules for x/sys 0.49.0 Example and extra modules still pinned x/sys v0.48.0, so govulncheck failed with "go mod tidy" in each of them. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
TS.QUERYLABELS example
This example demonstrates TSQueryLabels and TSQueryLabelValues, the
client bindings for the two forms of TS.QUERYLABELS (Redis 8.10+):
TSQueryLabels(ctx, filters)— the set of label names present on the matching time series (TS.QUERYLABELS LABELS [FILTER ...]).TSQueryLabelValues(ctx, label, filters)— the set of values assigned to one label across the matching series (TS.QUERYLABELS VALUES label [FILTER ...]).
Together with the existing TSQueryIndex they form the drill-down flow
dashboarding tools such as Grafana use to populate variable dropdowns:
label names → values of the chosen label → matching series keys.
Key points shown by the example:
- Filters use the same expression language as
TSQueryIndex/TSMRangeand are passed to the server verbatim; passing no filters queries all indexed series. - Replies are unordered, deduplicated sets of strings; the
LABELSform includes the label names used in the filter itself. - A label carried by no matching series yields an empty reply, not an error.
Prerequisites
Redis 8.10+ with the TimeSeries module, listening on localhost:6379.
Run
go run .
Expected output (order within the collections may differ):
label names for type=sensor: [location type unit]
locations for type=sensor: [bedroom kitchen]
kitchen sensor series: [ts:hum:kitchen ts:temp:kitchen]
values of an absent label: 0
label names, all series: [location type unit]