Skip to content

Commit

Permalink
Query label values and names are now fetched from the store. (#521)
Browse files Browse the repository at this point in the history
* Query label values and names are now fetched from the store.

A time range is now required by the /api/prom/label with a sane default (6 hours from now).

* fix http querystring and update doc

* update vendor

* rebased
  • Loading branch information
cyriltovena authored Jul 8, 2019
1 parent d3ab486 commit 86bc3c0
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 86 deletions.
61 changes: 2 additions & 59 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The Loki server has the following API endpoints (_Note:_ Authentication is out o

Responses looks like this:

```
```json
{
"streams": [
{
Expand All @@ -59,11 +59,14 @@ The Loki server has the following API endpoints (_Note:_ Authentication is out o

- `GET /api/prom/label`

For retrieving the names of the labels one can query on.
For doing label name queries, accepts the following parameters in the query-string:

- `start`: the start time for the query, as a nanosecond Unix epoch (nanoseconds since 1970). Default is always 6 hour ago.
- `end`: the end time for the query, as a nanosecond Unix epoch (nanoseconds since 1970). Default is current time.

Responses looks like this:

```
```json
{
"values": [
"instance",
Expand All @@ -74,11 +77,15 @@ The Loki server has the following API endpoints (_Note:_ Authentication is out o
```

- `GET /api/prom/label/<name>/values`
For retrieving the label values one can query on.

For doing label values queries, accepts the following parameters in the query-string:

- `start`: the start time for the query, as a nanosecond Unix epoch (nanoseconds since 1970). Default is always 6 hour ago.
- `end`: the end time for the query, as a nanosecond Unix epoch (nanoseconds since 1970). Default is current time.

Responses looks like this:

```
```json
{
"values": [
"default",
Expand Down
159 changes: 147 additions & 12 deletions pkg/logproto/logproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/logproto/logproto.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ message QueryResponse {
message LabelRequest {
string name = 1;
bool values = 2; // True to fetch label values, false for fetch labels names.
google.protobuf.Timestamp start = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp end = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
}

message LabelResponse {
Expand Down
Loading

0 comments on commit 86bc3c0

Please sign in to comment.