Open kristofre opened 3 years ago
@kristofre Can you provide more details? This part of the code, is a simple error trap, if the return does not have any data. Can you provide the Console output from Jenkins?
@pcjeffmac, currently the statement looks for []
, even if it is within a larger response body. The sample response body I added in the OP highlights that. So even though I got an evaluation result, because in there it contains []
the library would not exit the loop and keep on checking.
The issue seems to be related to the metric result and that the API is not returning a result,
Metric= "Response Time of InvokeAPI Method".
Can you share your SLI file? Are you able to pull values for this metric from the API directly?
"Dynatrace Metrics API returned 0 result values, expected 1 for query: https://DEDACTED/e/DEDACTED/api/v2/metrics/query/?entitySelector=tag% 28keptn_project%3Asimplenodeproject%29%2Ctag%28keptn_stage%3Astaging%29% 2Ctag%28keptn_service%3Asimplenodeservice%29%2Ctype%28SERVICE%29\ u0026from=1620200968000\u0026metricSelector=calc%3Aservice.simplenode. staging%3Afilter%28eq%28method%2C%2Fapi%2Finvoke%29%29%3Amerge%280%29% 3Apercentile%2895%29\u0026resolution=Inf\u0026to=1620201159000.\nPlease ensure the response contains exactly one value (e.g., by using :merge(0):avg for the metric). Here is the output for troubleshooting: {\"metricId\":\"calc:service.simplenode.staging:filter(eq(method,/api/ invoke)):merge(0):percentile(95)\",\"data\":[]}","metric":"".
I have created a fix for this issue and the PR has been submitted. In the mean time, if you can take a look at the metric result from the API. I think you would need to correct this calculated service metric and ensuring it returns one value.
Thank you for your input.
The issue seems to be related to the metric result and that the API is not returning a result,
Metric= "Response Time of InvokeAPI Method".
Can you share your SLI file? Are you able to pull values for this metric from the API directly?
"Dynatrace Metrics API returned 0 result values, expected 1 for query: https://DEDACTED/e/DEDACTED/api/v2/metrics/query/?entitySelector=tag% 28keptn_project%3Asimplenodeproject%29%2Ctag%28keptn_stage%3Astaging%29% 2Ctag%28keptn_service%3Asimplenodeservice%29%2Ctype%28SERVICE%29 u0026from=1620200968000\u0026metricSelector=calc%3Aservice.simplenode. staging%3Afilter%28eq%28method%2C%2Fapi%2Finvoke%29%29%3Amerge%280%29% 3Apercentile%2895%29\u0026resolution=Inf\u0026to=1620201159000.\nPlease ensure the response contains exactly one value (e.g., by using :merge(0):avg for the metric). Here is the output for troubleshooting: {"metricId":"calc:service.simplenode.staging:filter(eq(method,/api/ invoke)):merge(0):percentile(95)","data":[]}","metric":"".
Yes I am aware that one of the SLIs did not return a value, but all the other ones did. So the evaluation still yielded a build score and should not be stopped.
@kristofre has the original problem been solved? Can we close this issue?
Tested with Keptn 0.8.2, sli service 0.10.2 and library 4.0.
Evaluation never finishes because a check on
response.content.contains("[]")
is set so it waits and tries again.https://github.com/keptn-sandbox/keptn-jenkins-library/blob/621a9ffeb2d450c377c451e94f3a8f7dbd7589db/src/sh/keptn/Keptn.groovy#L680
Sample result below.
In my case it was due to an SLI not retrieving any data, but the evaluation does finish and gets a score.
@pcjeffmac Should it be changed to an
equals
check?