Skip to content

Commit

Permalink
Add starttime to php-fpm metrics (influxdata#5997)
Browse files Browse the repository at this point in the history
  • Loading branch information
dupondje authored and Mathieu Lecarme committed Apr 17, 2020
1 parent 05a9633 commit 94ed88a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/inputs/phpfpm/phpfpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
const (
PF_POOL = "pool"
PF_PROCESS_MANAGER = "process manager"
PF_START_SINCE = "start since"
PF_ACCEPTED_CONN = "accepted conn"
PF_LISTEN_QUEUE = "listen queue"
PF_MAX_LISTEN_QUEUE = "max listen queue"
Expand Down Expand Up @@ -242,7 +243,8 @@ func importMetric(r io.Reader, acc telegraf.Accumulator, addr string) (poolStat,

// Start to parse metric for current pool
switch fieldName {
case PF_ACCEPTED_CONN,
case PF_START_SINCE,
PF_ACCEPTED_CONN,
PF_LISTEN_QUEUE,
PF_MAX_LISTEN_QUEUE,
PF_LISTEN_QUEUE_LEN,
Expand Down
4 changes: 4 additions & 0 deletions plugins/inputs/phpfpm/phpfpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func TestPhpFpmGeneratesMetrics_From_Http(t *testing.T) {
}

fields := map[string]interface{}{
"start_since": int64(1991),
"accepted_conn": int64(3),
"listen_queue": int64(1),
"max_listen_queue": int64(0),
Expand Down Expand Up @@ -85,6 +86,7 @@ func TestPhpFpmGeneratesMetrics_From_Fcgi(t *testing.T) {
}

fields := map[string]interface{}{
"start_since": int64(1991),
"accepted_conn": int64(3),
"listen_queue": int64(1),
"max_listen_queue": int64(0),
Expand Down Expand Up @@ -130,6 +132,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket(t *testing.T) {
}

fields := map[string]interface{}{
"start_since": int64(1991),
"accepted_conn": int64(3),
"listen_queue": int64(1),
"max_listen_queue": int64(0),
Expand Down Expand Up @@ -175,6 +178,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) {
}

fields := map[string]interface{}{
"start_since": int64(1991),
"accepted_conn": int64(3),
"listen_queue": int64(1),
"max_listen_queue": int64(0),
Expand Down

0 comments on commit 94ed88a

Please sign in to comment.