doc/api/graphql/value_stream_analytics.md
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
Use the GraphQL API to request metrics from your configured value streams and value stream stages. This data can be useful if you want to export Value Stream Analytics data to an external system or for a report.
The following metrics are available:
Prerequisites:
First, you must determine which value stream you want to use in the reporting.
To request the configured value streams for a group, run:
group(fullPath: "your-group-path") {
valueStreams {
nodes {
id
name
}
}
}
Similarly, to request metrics for a project, run:
project(fullPath: "your-project-path") {
valueStreams {
nodes {
id
name
}
}
}
To request metrics for stages of a value stream, run:
group(fullPath: "your-group-path") {
valueStreams(id: "your-value-stream-id") {
nodes {
stages {
id
name
}
}
}
}
Depending on how you want to consume the data, you can request metrics for one specific stage or all stages in your value stream.
[!note] Requesting metrics for all stages might be too slow for some installations. The recommended approach is to request metrics stage by stage.
Requesting metrics for the stage:
group(fullPath: "your-group-path") {
valueStreams(id: "your-value-stream-id") {
nodes {
stages(id: "your-stage-id") {
id
name
metrics(timeframe: { start: "2024-03-01", end: "2024-03-31" }) {
average {
value
unit
}
median {
value
unit
}
count {
value
unit
}
}
}
}
}
}
[!note] You should always request metrics with a given time frame. The longest supported time frame is 180 days.
The metrics node supports additional filtering options:
Example request with filters:
group(fullPath: "your-group-path") {
valueStreams(id: "your-value-stream-id") {
nodes {
stages(id: "your-stage-id") {
id
name
metrics(
labelNames: ["backend"],
milestoneTitle: "17.0",
timeframe: { start: "2024-03-01", end: "2024-03-31" }
) {
average {
value
unit
}
median {
value
unit
}
count {
value
unit
}
}
}
}
}
}