Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ curl -X POST http://localhost:48888/api/v1/events \
"data": {
"method": "GET",
"route": "/hello",
"duration_ms": 10
"duration_ms": "10"
}
}
'
```

Note that numeric values where precision matters are sent as JSON strings
(`"duration_ms": "10"`) so they are parsed without floating-point precision
loss.
Comment on lines +48 to +50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Quoted Values Still Lose Precision

When a value exceeds float64's exact range, quoting it does not prevent precision loss: numeric strings are parsed with strconv.ParseFloat(..., 64), and the default query path converts them with toFloat64OrNull. The note therefore promises protection that the quickstart configuration does not provide.

Suggested change
Note that numeric values where precision matters are sent as JSON strings
(`"duration_ms": "10"`) so they are parsed without floating-point precision
loss.
Numeric event values may also be sent as JSON strings, as shown here
(`"duration_ms": "10"`).

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: quickstart/README.md
Line: 48-50

Comment:
**Quoted Values Still Lose Precision**

When a value exceeds float64's exact range, quoting it does not prevent precision loss: numeric strings are parsed with `strconv.ParseFloat(..., 64)`, and the default query path converts them with `toFloat64OrNull`. The note therefore promises protection that the quickstart configuration does not provide.

```suggestion
Numeric event values may also be sent as JSON strings, as shown here
(`"duration_ms": "10"`).
```

**Context Used:** AGENTS.md ([source](https://app.greptile.com/openmeter/github/openmeterio/openmeter/-/custom-context?memory=eb020e3b-8e3b-45ea-a8b7-4006b2b2065b))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

Comment on lines +48 to +50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Narrow the precision claim.

The ingestion parser accepts these strings but ultimately converts them to float64 (openmeter/meter/parse.go:116-129), so arbitrary-precision values can still lose precision. Please say this avoids precision loss during JSON decoding, rather than implying end-to-end precision preservation.

Suggested wording
-Note that numeric values where precision matters are sent as JSON strings
-(`"duration_ms": "10"`) so they are parsed without floating-point precision
-loss.
+Note that numeric values where precision matters are sent as JSON strings
+(`"duration_ms": "10"`) to avoid precision loss during JSON decoding.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Note that numeric values where precision matters are sent as JSON strings
(`"duration_ms": "10"`) so they are parsed without floating-point precision
loss.
Note that numeric values where precision matters are sent as JSON strings
(`"duration_ms": "10"`) to avoid precision loss during JSON decoding.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@quickstart/README.md` around lines 48 - 50, Update the numeric-value note in
the README to state that JSON strings avoid precision loss during JSON decoding,
without implying that precision is preserved through ingestion. Keep the example
and parsing guidance intact, but narrow the claim to the decoding stage.


Note how ID is different:

```sh
Expand All @@ -61,7 +65,7 @@ curl -X POST http://localhost:48888/api/v1/events \
"data": {
"method": "GET",
"route": "/hello",
"duration_ms": 20
"duration_ms": "20"
}
}
'
Expand All @@ -83,7 +87,7 @@ curl -X POST http://localhost:48888/api/v1/events \
"data": {
"method": "GET",
"route": "/hello",
"duration_ms": 30
"duration_ms": "30"
}
}
'
Expand Down
Loading