diff options
| author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2023-07-21 10:41:17 +0000 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2023-07-24 06:24:36 +0000 |
| commit | b03242d7ab98645d2c936e1899aac9f0aeb9813e (patch) | |
| tree | 4f74d0da1ea42a38a125b3a972b44c434b2a38fa /vendor/github.com/prometheus/common/model/value_float.go | |
| parent | f0f7d1e0a67964f4733690290b236755148b8188 (diff) | |
mod: do: bump github.com/prometheus/client_golang from 1.14.0 to 1.16.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.14.0 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.14.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/github.com/prometheus/common/model/value_float.go')
| -rw-r--r-- | vendor/github.com/prometheus/common/model/value_float.go | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/vendor/github.com/prometheus/common/model/value_float.go b/vendor/github.com/prometheus/common/model/value_float.go index 8b59571a3..0f615a705 100644 --- a/vendor/github.com/prometheus/common/model/value_float.go +++ b/vendor/github.com/prometheus/common/model/value_float.go @@ -18,15 +18,8 @@ import ( "fmt" "math" "strconv" - "unsafe" - - jsoniter "github.com/json-iterator/go" ) -func init() { - jsoniter.RegisterTypeEncoderFunc("model.SamplePair", marshalSamplePairJSON, marshalJSONIsEmpty) -} - var ( // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a // non-existing sample pair. It is a SamplePair with timestamp Earliest and @@ -78,18 +71,16 @@ type SamplePair struct { Value SampleValue } -// marshalSamplePairJSON writes `[ts, "val"]`. -func marshalSamplePairJSON(ptr unsafe.Pointer, stream *jsoniter.Stream) { - p := *((*SamplePair)(ptr)) - stream.WriteArrayStart() - MarshalTimestamp(int64(p.Timestamp), stream) - stream.WriteMore() - MarshalValue(float64(p.Value), stream) - stream.WriteArrayEnd() -} - func (s SamplePair) MarshalJSON() ([]byte, error) { - return jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(s) + t, err := json.Marshal(s.Timestamp) + if err != nil { + return nil, err + } + v, err := json.Marshal(s.Value) + if err != nil { + return nil, err + } + return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil } // UnmarshalJSON implements json.Unmarshaler. |
