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

Changed CreationDate to string to prevent scientific notation conversion #42053

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Do not report non-existant 0 values for RSS metrics in docker/memory {pull}41449[41449]
- Log Cisco Meraki `getDevicePerformanceScores` errors without stopping metrics collection. {pull}41622[41622]
- Don't skip first bucket value in GCP metrics metricset for distribution type metrics {pull}41822[41822]
- Fixed `creation_date` scientific notation output in the `elasticsearch.index` metricset. {pull}42053[42053]


*Osquerybeat*
Expand Down
8 changes: 2 additions & 6 deletions metricbeat/module/elasticsearch/index/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package index
import (
"encoding/json"
"fmt"
"strconv"

"github.com/joeshaw/multierror"

Expand All @@ -44,7 +43,7 @@ type Index struct {
Index string `json:"index"`
Status string `json:"status"`
TierPreference string `json:"tier_preference"`
CreationDate int `json:"creation_date"`
CreationDate string `json:"creation_date"`
Version string `json:"version"`
Shards shardStats `json:"shards"`
}
Expand Down Expand Up @@ -307,10 +306,7 @@ func addIndexSettings(idx *Index, indicesSettings mapstr.M) error {
return fmt.Errorf("failed to get index creation date: %w", err)
}

idx.CreationDate, err = strconv.Atoi(indexCreationDate)
if err != nil {
return fmt.Errorf("failed to convert index creation date to int: %w", err)
}
idx.CreationDate = indexCreationDate

indexTierPreference, err := getIndexSettingForIndex(indexSettings, idx.Index, "index.routing.allocation.require._tier_preference")
if err != nil {
Expand Down
Loading