Conversation
| secondsStr := strconv.FormatFloat(totalSeconds, 'f', -1, 64) | ||
| builder.WriteString(fmt.Sprintf("%sS", secondsStr)) | ||
| } | ||
|
|
There was a problem hiding this comment.
I am kinda curious about the edge case of zero duration for Prometheus inputs. Specifically, cases like "0s", "0m", or an empty string. Shouldn't this ideally be parsed as zero duration, resulting in the ISO 8601 representation of PT0S? 🤔
In code it would look like this:
if isoDuration == "P" {
isoDuration = "PT0S"
}
There was a problem hiding this comment.
Specifically, cases like "0s", "0m", or an empty string
The first 2 don't make sense in the context of promQL, but we can definitely add them to the tests.
| {"1ms", "PT0.001S"}, | ||
| {"1000ms", "PT1S"}, | ||
| {"1y2w3d4h5m6s", "P1Y2W3DT4H5M6S"}, | ||
| {"1y2w3d4h5m6s7ms", "P1Y2W3DT4H5M6.007S"}, |
There was a problem hiding this comment.
Regarding this: https://github.com/Altinn/altinn-platform/pull/1018/files#r1812522355
Also another test case may need to get added here:
{"0", "PT0S"},
There was a problem hiding this comment.
Go ahead, you can just add them. See what happens in those tests.
|
Is this PR still in work? |
Description
Related Issue(s)
Verification
Documentation