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

Cherry-pick #24788 to 7.x: Expose processes and their metrics #25017

Merged
merged 4 commits into from
Apr 14, 2021

Conversation

michalpristas
Copy link
Contributor

@michalpristas michalpristas commented Apr 12, 2021

Cherry-pick of PR #24788 to 7.x branch. Original message:

What does this PR do?

Added /processes and /processes/{processID} endpoints to http server.

agent has its server on unix:///tmp/elastic-agent/elastic-agent.sock or npipe:///elastic-agent for windows.
not configurable

example of /processes

{
	"processes": [{
		"id": "filebeat-default-monitoring",
		"pid": "8025",
		"binary": "filebeat",
		"source": {
			"kind": "internal",
			"outputs": ["default"]
		}
	}, {
		"id": "metricbeat-default-monitoring",
		"pid": "8043",
		"binary": "metricbeat",
		"source": {
			"kind": "internal",
			"outputs": ["default"]
		}
	}, {
		"id": "metricbeat-default",
		"pid": "7998",
		"binary": "metricbeat",
		"source": {
			"kind": "configured",
			"outputs": ["default"]
		}
	}]
}

example of /processes/metricbeat-default

{
	"beat": {
		"cgroup": {
			"cpu": {
				"cfs": {
					"period": {
						"us": 100000
					},
					"quota": {
						"us": 0
					}
				},
				"id": "user.slice",
				"stats": {
					"periods": 0,
					"throttled": {
						"ns": 0,
						"periods": 0
					}
				}
			},
			"cpuacct": {
				"id": "user.slice",
				"total": {
					"ns": 994162833024
				}
			},
			"memory": {
				"id": "user.slice",
				"mem": {
					"limit": {
						"bytes": 9223372036854771712
					},
					"usage": {
						"bytes": 1766760448
					}
				}
			}
		},
		"cpu": {
			"system": {
				"ticks": 150,
				"time": {
					"ms": 156
				}
			},
			"total": {
				"ticks": 220,
				"time": {
					"ms": 232
				},
				"value": 220
			},
			"user": {
				"ticks": 70,
				"time": {
					"ms": 76
				}
			}
		},
		"handles": {
			"limit": {
				"hard": 1048576,
				"soft": 1024
			},
			"open": 17
		},
		"info": {
			"ephemeral_id": "aad52edf-4229-4927-bb30-c67ce9934499",
			"uptime": {
				"ms": 26728
			}
		},
		"memstats": {
			"gc_next": 16893216,
			"memory_alloc": 14370808,
			"memory_sys": 75056128,
			"memory_total": 34212120,
			"rss": 85266432
		},
		"runtime": {
			"goroutines": 58
		}
	},
	"libbeat": {
		"config": {
			"module": {
				"running": 4,
				"starts": 4,
				"stops": 0
			},
			"reloads": 1,
			"scans": 1
		},
		"output": {
			"events": {
				"acked": 0,
				"active": 0,
				"batches": 0,
				"dropped": 0,
				"duplicates": 0,
				"failed": 0,
				"toomany": 0,
				"total": 0
			},
			"read": {
				"bytes": 0,
				"errors": 0
			},
			"type": "elasticsearch",
			"write": {
				"bytes": 0,
				"errors": 0
			}
		},
		"pipeline": {
			"clients": 4,
			"events": {
				"active": 35,
				"dropped": 0,
				"failed": 0,
				"filtered": 0,
				"published": 35,
				"retry": 44,
				"total": 35
			},
			"queue": {
				"acked": 0
			}
		}
	},
	"metricbeat": {
		"system": {
			"cpu": {
				"events": 3,
				"failures": 0,
				"success": 3
			},
			"filesystem": {
				"events": 12,
				"failures": 0,
				"success": 12
			},
			"memory": {
				"events": 3,
				"failures": 0,
				"success": 3
			},
			"network": {
				"events": 17,
				"failures": 0,
				"success": 17
			}
		}
	},
	"system": {
		"cpu": {
			"cores": 4
		},
		"load": {
			"1": 0.58,
			"15": 1.43,
			"5": 1.43,
			"norm": {
				"1": 0.145,
				"15": 0.3575,
				"5": 0.3575
			}
		}
	}
}

in case of error e.g

{
	"type": "UNEXPECTED",
	"reason": "failed fetching metrics: Get \"http://unix/stats\": dial unix /tmp/elastic-agent/default/metricbeat/metricbeat.sock: connect: no such file or directory"
}

Why is it important?

Fixes: #24091

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Apr 12, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 12, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #25017 updated

  • Start Time: 2021-04-14T06:36:17.332+0000

  • Duration: 146 min 23 sec

  • Commit: 275012f

Test stats 🧪

Test Results
Failed 0
Passed 46675
Skipped 5175
Total 51850

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 46675
Skipped 5175
Total 51850

@simitt
Copy link
Contributor

simitt commented Apr 14, 2021

Is there anything blocking from merging this backport?

@michalpristas
Copy link
Contributor Author

i dont see a green test, nothing aside from that

@michalpristas michalpristas merged commit 51c860c into elastic:7.x Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants