Custom Metric Provider Downstream/Upstream Stats Not calculable
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
When using the custom metrics provider template [here](https://www.consul.io/docs/connect/observability/ui-visualization#custom-metrics-providers) it seems that the function `downstreamRecentSummaryStats` doesn't receive the downstreams as a parameter, and as such, there's no good way to deduce the downstreams of the service you're calculating metrics for. This is an issue as the expected return object has a set of keys whose names are the downstream service with an array of metrics for that service.
On top of this, even hardcoding the downstream service name, and returning a promise that resolves to the expected object, results in the downstream showing "no metrics available".
#### Reproduction Steps
1. define metrics from your metric provider to query
1. query those metrics within the function named in the report
1. return a proper promise that resolves to an object in the format noted in the comments
1. `console.log` the parameters of the function
1. it will be seen that the parameters provided:
2. do not include the names of any of the downstreams of the selected service
3. the parameters are actually off in that:
4. serviceDC is actually the service name
5. namespace (open source) is actually the datacenter name
### Consul info for both Client and Server
No relevant as this relates to the UI.
Here is the async function within `downstreamRecentSummaryStats` that generates the promise:
```javascript
let summaryStats = async () => {
console.info("summaryStats Invoked")
let SuccessPromise = await calcSuccess();
let SuccessRateFloat = await SuccessPromise;
SuccessRate = Math.floor(SuccessRateFloat)
let statsObject = {
"stats": {
"cl-pepr-test-web": [
{
label: "Su",
desc: "Success Rate",
value: SuccessRate.toString() + "%"
},
{
label: "Er",
desc: "Failure Rate",
value: (100 - SuccessRate).toString() + "%"
}
]
}
}
console.log("Stats Object: ",statsObject)
return Promise.resolve(statsObject)
}
```
I then `return summaryStats()`.
The object logs in the proper format, this is also how I am generating `serviceRecentSummaryStats` which displays properly.
The downstream however once the promise resolves stats "No Metrics Available"
### Operating system and Environment details
This is seen in chrome and firefox
### Log Fragments

Contributor guide
Research direction
Start with the custom metrics provider template and the downstreamRecentSummaryStats entry point described in the issue, then reproduce the behavior in Chrome or Firefox while logging the function parameters and returned object. Compare the received serviceDC and namespace values with the documented downstream statistics shape. Done means downstream metrics resolve and display instead of showing "No Metrics Available."
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100