Skip to content

Fix empty time ranges from 500 exceptions - #145

Merged
gmunoz merged 1 commit into
masterfrom
fix-empty-time-ranges
Sep 29, 2026
Merged

gmunoz merged 1 commit into
masterfrom
fix-empty-time-ranges

Conversation

@gmunoz

@gmunoz gmunoz commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #144

A divide by zero scenario when the time range is empty.

Tested an empty result set using:

curl -k -u dev:dev -i --get \
    'https://192.168.121.189:4433/api/metrics/nodes_cores/summary' \
    --data-urlencode 'serviceName=local-dev' \
    --data-urlencode 'startTime=2030-01-01T00:00:00Z' \
    --data-urlencode 'endTime=2030-01-01T01:00:00Z' \
    --data-urlencode 'ignoreZeros=true'

The zero-duration case requires an existing profiler-process record with ts == last_seen, or an active process queried with identical startTime and endTime. In that scenario a curl such as the following can exercise the path:

t="$(date -u -d '1 minute ago' '+%Y-%m-%dT%H:%M:%SZ')"; \
  curl -k -u dev:dev -i --get \
    'https://192.168.121.189:4433/api/metrics/nodes_cores/summary' \
    --data-urlencode 'serviceName=local-dev' \
    --data-urlencode "startTime=$t" \
    --data-urlencode "endTime=$t" \
    --data-urlencode 'ignoreZeros=true'

Fixes a divide by zero scenario when the time range is empty.
@gmunoz
gmunoz merged commit 025382b into master Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/api/metrics/nodes_cores/summary 500s on empty time ranges

2 participants