Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetExplicitRadixPoint config to json.Visitor #48

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

carsonip
Copy link
Member

@carsonip carsonip commented Aug 20, 2024

SetExplicitRadixPoint configures whether the visitor encodes floating point values with an explicit radix point.
By default, equiv to SetExplicitRadixPoint(false), the radix point will be skipped if it is not needed.
e.g. 1.0 to 1 instead of 1.0, 100000000 to 1e+8 instead of 1.0e+8.
If true is passed, the encoded number will always contain a radix point,
in either decimal form or scientific notation.
This may be useful to signal the type of the number to a json parser.

Related issue: open-telemetry/opentelemetry-collector-contrib#34680

@carsonip carsonip requested a review from a team as a code owner August 20, 2024 17:01
@carsonip carsonip force-pushed the unambiguous-float branch 2 times, most recently from c23d2ce to 5fd9f62 Compare August 20, 2024 17:09
@carsonip carsonip marked this pull request as draft August 20, 2024 17:16
@carsonip carsonip marked this pull request as ready for review August 21, 2024 11:09
@carsonip carsonip marked this pull request as draft August 21, 2024 11:12
@carsonip carsonip marked this pull request as ready for review August 21, 2024 13:42
@carsonip carsonip marked this pull request as draft August 21, 2024 13:52
@carsonip carsonip marked this pull request as ready for review August 21, 2024 14:37
@carsonip carsonip marked this pull request as draft August 21, 2024 14:39
SetUnambiguousFloat configures how the visitor encodes floating point
values to a json float unambiguously.
By default, equiv to SetUnambiguousFloat(false), the visitor will encode
with the smallest number of digits.
e.g. 1.0 to 1 instead of 1.0, 100000000 to 1e+8 instead of 1.0e+8.
If true is passed, floating point values will always contain a decimal
point, in either decimal form or scientific notation.
@carsonip carsonip marked this pull request as ready for review August 21, 2024 14:43
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Aug 21, 2024
@pierrehilbert pierrehilbert requested review from leehinman and removed request for rdner August 21, 2024 15:47
json/visitor.go Outdated Show resolved Hide resolved
Copy link

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

I'm ok with the code.

suggestion on feature name

json/visitor.go Outdated Show resolved Hide resolved
@carsonip carsonip changed the title Add SetUnambiguousFloat config to json.Visitor Add SetExplicitRadixPoint config to json.Visitor Aug 22, 2024
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

LGTM

@carsonip
Copy link
Member Author

@mauri870 @leehinman I don't have the merge button. Please merge and release as you see fit.

@leehinman leehinman merged commit cec6f9f into elastic:main Aug 22, 2024
2 checks passed
codeboten referenced this pull request in open-telemetry/opentelemetry-collector-contrib Aug 27, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/elastic/go-structform](https://togithub.com/elastic/go-structform)
| `v0.0.11` -> `v0.0.12` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2felastic%2fgo-structform/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2felastic%2fgo-structform/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2felastic%2fgo-structform/v0.0.11/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2felastic%2fgo-structform/v0.0.11/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>elastic/go-structform
(github.com/elastic/go-structform)</summary>

###
[`v0.0.12`](https://togithub.com/elastic/go-structform/releases/tag/v0.0.12)

[Compare
Source](https://togithub.com/elastic/go-structform/compare/v0.0.11...v0.0.12)

##### What's Changed

- Add SetExplicitRadixPoint config to json.Visitor by
[@&#8203;carsonip](https://togithub.com/carsonip) in
[https://github.com/elastic/go-structform/pull/48](https://togithub.com/elastic/go-structform/pull/48)

##### New Contributors

- [@&#8203;carsonip](https://togithub.com/carsonip) made their first
contribution in
[https://github.com/elastic/go-structform/pull/48](https://togithub.com/elastic/go-structform/pull/48)

**Full Changelog**:
elastic/go-structform@v0.0.11...v0.0.12

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
f7o referenced this pull request in f7o/opentelemetry-collector-contrib Sep 12, 2024
…etry#34857)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/elastic/go-structform](https://togithub.com/elastic/go-structform)
| `v0.0.11` -> `v0.0.12` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2felastic%2fgo-structform/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2felastic%2fgo-structform/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2felastic%2fgo-structform/v0.0.11/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2felastic%2fgo-structform/v0.0.11/v0.0.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>elastic/go-structform
(github.com/elastic/go-structform)</summary>

###
[`v0.0.12`](https://togithub.com/elastic/go-structform/releases/tag/v0.0.12)

[Compare
Source](https://togithub.com/elastic/go-structform/compare/v0.0.11...v0.0.12)

##### What's Changed

- Add SetExplicitRadixPoint config to json.Visitor by
[@&open-telemetry#8203;carsonip](https://togithub.com/carsonip) in
[https://github.com/elastic/go-structform/pull/48](https://togithub.com/elastic/go-structform/pull/48)

##### New Contributors

- [@&open-telemetry#8203;carsonip](https://togithub.com/carsonip) made their first
contribution in
[https://github.com/elastic/go-structform/pull/48](https://togithub.com/elastic/go-structform/pull/48)

**Full Changelog**:
elastic/go-structform@v0.0.11...v0.0.12

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants