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

Change field type system.process.cpu.start_time from keyword to date #2191

Merged
merged 1 commit into from
Aug 9, 2016
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.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ https://github.com/elastic/beats/compare/v5.0.0-alpha5...master[Check the HEAD d
- Change Elasticsearch output index configuration to be based on format strings. If index has been configured, no date will be appended anymore to the index name. {pull}2119[2119]

*Metricbeat*
- Change field type system.process.cpu.start_time from keyword to date. {issue}1565[1565]

*Packetbeat*

Expand Down
4 changes: 2 additions & 2 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2802,9 +2802,9 @@ The total CPU time spent by the process.
[float]
=== system.process.cpu.start_time

type: keyword
type: date

The time when the process was started. Example: "17:45".
The time when the process was started.


[float]
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/etc/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1681,9 +1681,9 @@
description: >
The total CPU time spent by the process.
- name: start_time
type: keyword
type: date
description: >
The time when the process was started. Example: "17:45".
The time when the process was started.
- name: memory
type: group
description: Memory-specific statistics per process.
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/etc/kibana/index-pattern/metricbeat.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -1383,9 +1383,7 @@
"cpu": {
"properties": {
"start_time": {
"ignore_above": 1024,
"index": "not_analyzed",
"type": "string"
"type": "date"
},
"system": {
"type": "long"
Expand Down
3 changes: 1 addition & 2 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,7 @@
"cpu": {
"properties": {
"start_time": {
"ignore_above": 1024,
"type": "keyword"
"type": "date"
},
"system": {
"type": "long"
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/process/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"process": {
"cmdline": "go test -tags=integration github.com/elastic/beats/metricbeat/module/... -data",
"cpu": {
"start_time": "07:16",
"start_time": "2016-08-08T16:39:13.040Z",
"total": {
"pct": 0.01
}
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/system/process/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
description: >
The total CPU time spent by the process.
- name: start_time
type: keyword
type: date
description: >
The time when the process was started. Example: "17:45".
The time when the process was started.
- name: memory
type: group
description: Memory-specific statistics per process.
Expand Down
10 changes: 8 additions & 2 deletions metricbeat/module/system/process/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ func (procStats *ProcStats) GetProcessEvent(process *Process, last *Process) com
"ticks": process.Cpu.Total,
"pct": GetProcCpuPercentage(last, process),
},
"start_time": process.Cpu.FormatStartTime(),
"start_time": unixTimeMsToTime(process.Cpu.StartTime),
}
} else {
proc["cpu"] = common.MapStr{
"total": common.MapStr{
"pct": GetProcCpuPercentage(last, process),
},
"start_time": process.Cpu.FormatStartTime(),
"start_time": unixTimeMsToTime(process.Cpu.StartTime),
}
}

Expand Down Expand Up @@ -304,3 +304,9 @@ func (procStats *ProcStats) GetProcStatsEvents() ([]common.MapStr, error) {

return events, nil
}

// unixTimeMsToTime converts a unix time given in milliseconds since Unix epoch
// to a common.Time value.
func unixTimeMsToTime(unixTimeMs uint64) common.Time {
return common.Time(time.Unix(0, int64(unixTimeMs*1000000)))
}