Skip to content

Commit 03a97b1

Browse files
willr3johnaohara
authored andcommitted
update labelValues openapi examples and grafana tutorial
1 parent c27d081 commit 03a97b1

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

docs/site/content/en/docs/Tutorials/grafana/index.md

+8-18
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,21 @@ The `/labelValues` endpoint supports a `filter` query parameter to filter out da
8585
There are 2 ways to filter:
8686
1. provide a json object that must exist in the label values.
8787

88-
For example, if `version` is a label we can pass in `{"version":"1.2.3"}` to only include datasets where the version value is `1.2.3`
88+
For example, if `version` and `txRate` are label names then `{"version":"1.2.3"}` will only include labelValues where `version=1.2.3`
89+
and `{"version":"1.2.3","txRate":2000}` will add the `txRate=2000` requirement.
90+
91+
> curl --query-param "filter={\"version\":\"1.2.3\",\"txRate\":2000}" <horreum>:/api/test/{id}/labelValues
92+
8993

9094
2. provide a json path (an extractor path from labels) that needs to evaluate to true
9195

9296
For example, if `count` is a label we can pass in `$.count ? (@ > 10 && @ < 20)` to only include datasets where count is between 10 and 20.
9397

94-
We set the `filter` parameter by editing the Query for the grafana panel.
98+
> curl --query-param "filter=\"$.count ? (@ > 10 && @ < 20)\"" <horreum>:/api/test/{id}/labelValues
99+
100+
We set the `filter` parameter by editing the Query for the grafana panel but it will depend .
95101

96102
{{% imgproc json_api_panel_filter Fit "865x331" %}}
97103
Define filter for query
98104
{{% /imgproc %}}
99105

100-
101-
> docker run -d --name=grafana -p 3030:3000 grafana/grafana
102-
> docker exec -it grafana /bin/bash
103-
> e7ff10503ffb:/usr/share/grafana$ grafana cli plugins install marcusolsson-json-datasource
104-
>> ✔ Downloaded and extracted marcusolsson-json-datasource v1.3.10 zip successfully to /var/lib/grafana/plugins/marcusolsson-json-datasource
105-
>> Please restart Grafana after installing or removing plugins. Refer to Grafana documentation for instructions if necessary.
106-
107-
108-
> docker run -d --name=grafana --env --network="host" grafana/grafana
109-
110-
if you need to access horreum running on localhost (dev mode). Then grafana needs to run on host network so that localhost references
111-
will also need to set a port other than 3000 becuase local dev mode uses 3000
112-
113-
> docker run -d --name=grafana --env GF_SERVER_HTTP_PORT=3030 --network="host" grafana/grafana
114-
115-
infinity datasource

docs/site/content/en/openapi/openapi.yaml

+11-5
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,10 @@ paths:
978978
examples:
979979
object:
980980
description: json object that must exist in the values object
981-
value:
982-
key: requiredValue
981+
value: "{labelName:necessaryValue,...}"
983982
string:
984-
description: valid jsonpath that returns null of not found (not predicates)
983+
description: valid filtering jsonpath that returns null if not found (not
984+
predicates)
985985
value: $.count ? (@ < 20 && @ > 10)
986986
- name: sort
987987
in: query
@@ -2056,8 +2056,14 @@ paths:
20562056
schema:
20572057
default: "{}"
20582058
type: string
2059-
example:
2060-
key: requiredValue
2059+
examples:
2060+
object:
2061+
description: json object that must exist in the values object
2062+
value: "{labelName:necessaryValue,...}"
2063+
string:
2064+
description: valid filtering jsonpath that returns null if not found (not
2065+
predicates)
2066+
value: $.count ? (@ < 20 && @ > 10)
20612067
- name: before
20622068
in: query
20632069
description: ISO-like date time string or epoch millis

horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/RunService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ Object getData(@PathParam("id") int id,
104104
@Parameters(value = {
105105
@Parameter(name = "id", in =ParameterIn.PATH, description = "Run Id", example = "101"),
106106
@Parameter(name = "filter", description = "either a required json sub-document or path expression", examples = {
107-
@ExampleObject(name="object", value="{\"key\":\"requiredValue\"}", description = "json object that must exist in the values object"),
108-
@ExampleObject(name="string", value="$.count ? (@ < 20 && @ > 10)",description = "valid jsonpath that returns null of not found (not predicates)")
107+
@ExampleObject(name="object", value="{labelName:necessaryValue,...}", description = "json object that must exist in the values object"),
108+
@ExampleObject(name="string", value="$.count ? (@ < 20 && @ > 10)",description = "valid filtering jsonpath that returns null if not found (not predicates)")
109109
}),
110110
@Parameter(name = "sort", description = "label name for sorting"),
111111
@Parameter(name = "direction",description = "either Ascending or Descending",example="count"),

horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/TestService.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
2727
import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
2828
import org.eclipse.microprofile.openapi.annotations.media.Content;
29+
import org.eclipse.microprofile.openapi.annotations.media.ExampleObject;
2930
import org.eclipse.microprofile.openapi.annotations.media.Schema;
3031
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
3132
import org.eclipse.microprofile.openapi.annotations.parameters.Parameters;
@@ -202,7 +203,14 @@ void updateNotifications(@PathParam("id") int id,
202203
@Parameter(name = "id", description = "Test ID to retrieve Label Values for", example = "101"),
203204
@Parameter(name = "filtering", description = "Retrieve values for Filtering Labels", example = "true"),
204205
@Parameter(name = "metrics", description = "Retrieve values for Metric Labels", example = "false"),
205-
@Parameter(name = "filter", description = "either a required json sub-document or path expression", example = "{\"key\":\"requiredValue\"} or $.count ? (@ < 20 && @ > 10)"),
206+
@Parameter(
207+
name = "filter",
208+
description = "either a required json sub-document or path expression",
209+
examples = {
210+
@ExampleObject(name="object", value="{labelName:necessaryValue,...}", description = "json object that must exist in the values object"),
211+
@ExampleObject(name="string", value="$.count ? (@ < 20 && @ > 10)",description = "valid filtering jsonpath that returns null if not found (not predicates)")
212+
}
213+
),
206214
@Parameter(name = "before", description = "ISO-like date time string or epoch millis", example = "1970-01-01T00:00:00+00:00 or an integer"),
207215
@Parameter(name = "after", description = "ISO-like date time string or epoch millis", example = "1970-01-01T00:00:00+00:00 or an integer"),
208216
@Parameter(name = "sort", description = "json path to sortable value or start or stop for sorting by time",example = "$.label or start or stop"),

0 commit comments

Comments
 (0)