Skip to content

Commit b749106

Browse files
committed
Remove common.Float
Remove deprecated common.Float from 8.0. Relates #28279 Relates #28280
1 parent 058c405 commit b749106

4 files changed

Lines changed: 2 additions & 36 deletions

File tree

CHANGELOG-developer.next.asciidoc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
5555
- Remove `NumCPU` as clients should update the CPU count on the fly in case of config changes in a VM. {pull}23154[23154]
5656
- Remove Metricbeat EventFetcher and EventsFetcher interface. Use the reporter interface instead. {pull}25093[25093]
5757
- Update Darwin build image to a debian 10 base that increases the MacOS SDK and minimum supported version used in build to 10.14. {issue}24193[24193]
58+
- Removed the `common.Float` type. {issue}28279[28279] {pull}28280[28280] {pull}28376[28376]
5859

5960
==== Bugfixes
6061

@@ -123,7 +124,3 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
123124
- Update Go version to 1.16.5. {issue}26182[26182] {pull}26186[26186]
124125
- Introduce `libbeat/beat.Beat.OutputConfigReloader` {pull}28048[28048]
125126
- Update Go version to 1.17.1. {pull}27543[27543]
126-
127-
==== Deprecated
128-
129-
- Deprecated the `common.Float` type. {issue}28279[28279] {pull}28280[28280]

libbeat/common/event.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ import (
3131
"github.com/elastic/beats/v7/libbeat/logp"
3232
)
3333

34-
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
35-
36-
// Float is a float64 wrapper that implements the encoding/json Marshaler
37-
// interface to add a decimal point to all float values.
38-
//
39-
// Deprecated: This type should no longer be used and the Marshaler interface
40-
// is not consulted while marshaling to JSON in libbeat outputs.
41-
type Float float64
42-
4334
// EventConverter is used to convert MapStr objects for publishing
4435
type EventConverter interface {
4536
Convert(m MapStr) MapStr
@@ -306,11 +297,6 @@ func joinKeys(keys ...string) string {
306297
return strings.Join(keys, ".")
307298
}
308299

309-
// Defines the marshal of the Float type
310-
func (f Float) MarshalJSON() ([]byte, error) {
311-
return []byte(fmt.Sprintf("%.6f", f)), nil
312-
}
313-
314300
// DeDot a string by replacing all . with _
315301
// This helps when sending data to Elasticsearch to prevent object and key collisions.
316302
func DeDot(s string) string {

libbeat/common/event_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -396,22 +396,6 @@ func TestMarshalUnmarshalArray(t *testing.T) {
396396
}
397397
}
398398

399-
func TestMarshalFloatValues(t *testing.T) {
400-
assert := assert.New(t)
401-
402-
var f float64
403-
404-
f = 5
405-
406-
a := MapStr{
407-
"f": Float(f),
408-
}
409-
410-
b, err := json.Marshal(a)
411-
assert.Nil(err)
412-
assert.Equal(string(b), "{\"f\":5.000000}")
413-
}
414-
415399
func TestNormalizeTime(t *testing.T) {
416400
ny, err := time.LoadLocation("America/New_York")
417401
if err != nil {

libbeat/conditions/range.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"reflect"
2323
"strings"
2424

25-
"github.com/elastic/beats/v7/libbeat/common"
2625
"github.com/elastic/beats/v7/libbeat/logp"
2726
)
2827

@@ -129,7 +128,7 @@ func (c Range) Check(event ValuesMap) bool {
129128
return false
130129
}
131130

132-
case float64, float32, common.Float:
131+
case float64, float32:
133132
floatValue := reflect.ValueOf(value).Float()
134133

135134
if !checkValue(floatValue, rangeValue) {

0 commit comments

Comments
 (0)