Skip to content

Commit

Permalink
Fix type for uwsgi.status.worker.rss field (elastic#24468)
Browse files Browse the repository at this point in the history
It was defined as keyword, but it is a number.

Generate different data files for the different kinds of events
generated by this metricset: overall, cores and workers.

(cherry picked from commit a9c98e2)
  • Loading branch information
jsoriano committed Mar 10, 2021
1 parent bea9a9b commit 1740863
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ https:/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Unskip s3_request integration test. {pull}23887[23887]
- Add system.hostfs configuration option for system module. {pull}23831[23831]
- Fix GCP not able to request Cloudfunctions metrics if a region filter was set {pull}24218[24218]
- Fix type of `uwsgi.status.worker.rss` type. {pull}24468[24468]

*Packetbeat*

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46301,7 +46301,7 @@ type: keyword
Resident Set Size. memory currently used by a process. if always zero try `--memory-report` option of uwsgi


type: keyword
type: long

--

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/uwsgi/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions metricbeat/module/uwsgi/status/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@
"module": "uwsgi"
},
"metricset": {
"name": "status"
"name": "status",
"period": 10000
},
"service": {
"address": "127.0.0.1:9192",
"address": "172.28.0.3:9191",
"type": "uwsgi"
},
"uwsgi": {
"status": {
"core": {
"id": 1,
"total": {
"exceptions": 0,
"pid": 1,
"read_errors": 0,
"requests": {
"offloaded": 0,
"routed": 0,
"static": 0,
"total": 941
},
"worker_pid": 7,
"requests": 2,
"write_errors": 0
}
}
Expand Down
32 changes: 32 additions & 0 deletions metricbeat/module/uwsgi/status/_meta/data_core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"event": {
"dataset": "uwsgi.status",
"duration": 115000,
"module": "uwsgi"
},
"metricset": {
"name": "status",
"period": 10000
},
"service": {
"address": "172.28.0.3:9191",
"type": "uwsgi"
},
"uwsgi": {
"status": {
"core": {
"id": 1,
"read_errors": 0,
"requests": {
"offloaded": 0,
"routed": 0,
"static": 0,
"total": 1
},
"worker_pid": 8,
"write_errors": 0
}
}
}
}
38 changes: 38 additions & 0 deletions metricbeat/module/uwsgi/status/_meta/data_worker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"event": {
"dataset": "uwsgi.status",
"duration": 115000,
"module": "uwsgi"
},
"metricset": {
"name": "status",
"period": 10000
},
"service": {
"address": "172.28.0.3:9191",
"type": "uwsgi"
},
"uwsgi": {
"status": {
"worker": {
"accepting": 1,
"avg_rt": 74,
"delta_requests": 2,
"exceptions": 0,
"harakiri_count": 0,
"id": 1,
"pid": 8,
"requests": 2,
"respawn_count": 1,
"rss": 6791168,
"running_time": 202,
"signal_queue": 0,
"signals": 0,
"status": "idle",
"tx": 110,
"vsz": 9187328
}
}
}
}
2 changes: 1 addition & 1 deletion metricbeat/module/uwsgi/status/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
description: >
Worker status (cheap, pause, sig, busy, idle)
- name: worker.rss
type: keyword
type: long
description: >
Resident Set Size. memory currently used by a process. if always zero try `--memory-report` option of uwsgi
- name: worker.vsz
Expand Down
19 changes: 14 additions & 5 deletions metricbeat/module/uwsgi/status/status_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/tests/compose"
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
)
Expand All @@ -46,11 +47,19 @@ func TestFetchTCP(t *testing.T) {
func TestData(t *testing.T) {
service := compose.EnsureUp(t, "uwsgi_http")

f := mbtest.NewReportingMetricSetV2Error(t, getConfig("http", service.Host()))

if err := mbtest.WriteEventsReporterV2Error(f, t, ""); err != nil {
t.Fatal("write", err)
}
f := mbtest.NewFetcher(t, getConfig("http", service.Host()))
f.WriteEventsCond(t, "", func(event common.MapStr) bool {
isOverall, _ := event.HasKey("uwsgi.status.total")
return isOverall
})
f.WriteEventsCond(t, "_meta/data_core.json", func(event common.MapStr) bool {
isCore, _ := event.HasKey("uwsgi.status.core")
return isCore
})
f.WriteEventsCond(t, "_meta/data_worker.json", func(event common.MapStr) bool {
isWorker, _ := event.HasKey("uwsgi.status.worker")
return isWorker
})
}

func TestFetchHTTP(t *testing.T) {
Expand Down

0 comments on commit 1740863

Please sign in to comment.