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

Add Logstash Telemetry #6562

Merged
merged 9 commits into from
Apr 21, 2023
Merged

Conversation

robbavey
Copy link
Member

@robbavey robbavey commented Mar 22, 2023

This PR adds telemetry related to Logstash

@botelastic botelastic bot added the triage label Mar 22, 2023
@pebrc pebrc added >enhancement Enhancement of existing functionality >feature Adds or discusses adding a feature to the product labels Mar 22, 2023
@botelastic botelastic bot removed the triage label Mar 22, 2023
@pebrc pebrc removed the >feature Adds or discusses adding a feature to the product label Mar 22, 2023
@robbavey robbavey force-pushed the eck_telemetry branch 5 times, most recently from 8a2bd10 to b2bf2d9 Compare March 22, 2023 19:07
@robbavey robbavey requested review from kaisecheng, pebrc and barkbay April 3, 2023 13:24
@robbavey
Copy link
Member Author

robbavey commented Apr 3, 2023

PR ready for review

}

for _, ls := range logstashList.Items {
ls := ls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was caught by the linter, and is related to loop variable semantics in go - there is a great summary of the issue (and proposal for "fixing" it in future versions of golang) here. I don't actually think that that behaviour will bite us here, given what we are doing, but I'm still happy keeping this "odd" looking assignment in here and keep the linter satisfied

@robbavey
Copy link
Member Author

robbavey commented Apr 4, 2023

@pebrc @barkbay This is ready for review by the ECK team

Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a few nits.

It's not from your PR, but I realize that we started having duplicates and making the stats slightly different from app to app, causing us to miss some stats (stack mon for Kibana, or helm for agent and beats).

I think we could improve that by creating some reusable structs like this.

type baseStats struct {
	ResourceCount int32 `json:"resource_count"`
	PodCount      int32 `json:"pod_count"`
}

type helmStats struct {
	HelmManagedResourceCount int32 `json:"helm_resource_count"`
}
type stackMonStats struct {
	StackMonitoringLogsCount    int32 `json:"stack_monitoring_logs_count"`
	StackMonitoringMetricsCount int32 `json:"stack_monitoring_metrics_count"`
}

func logstashStats(k8sClient k8s.Client, managedNamespaces []string) (string, interface{}, error) {
	logstashStats := struct {
		baseStats
		helmStats
		stackMonStats
		ServiceCount     int32 `json:"service_count"`
		PipelineCount    int32 `json:"pipeline_count"`
		PipelineRefCount int32 `json:"pipeline_ref_count"`
	}{}
...

I made a sketch here.

It's not completely trivial so it can be done in another PR, unless you're motivated to do it in this one :).

pkg/telemetry/telemetry.go Outdated Show resolved Hide resolved
pkg/telemetry/telemetry.go Outdated Show resolved Hide resolved
@robbavey
Copy link
Member Author

@thbkrkr Ready for another round

@robbavey robbavey merged commit adca107 into elastic:feature/logstash Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality :logstash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants