cloud-bulldozer / go-commons

Code repository with all go common packages and libraries
Apache License 2.0
4 stars 9 forks source link

Initial draft for go-commons with indexer #2

Closed vishnuchalla closed 1 year ago

vishnuchalla commented 1 year ago

Description

Adding indexers to go commons.

Testing

Tested integrating with kube-burner for elastic indexer.

time="2023-04-18 08:49:14" level=info msg="📁 Creating indexer: elastic" file="factory.go:31"
time="2023-04-18 08:49:18" level=info msg="👽 Initializing prometheus client with URL: https://prometheus-k8s-openshift-monitoring.apps.vchalla-quay-test-2.perfscale.devcluster.openshift.com" file="prometheus.go:55"
time="2023-04-18 08:49:21" level=info msg="Scraping for the prometheus entry with params - Endpoint: https://prometheus-k8s-openshift-monitoring.apps.vchalla-quay-test-2.perfscale.devcluster.openshift.com, Profile: /home/vchalla/quay-metrics.yaml, Start: 2023-04-18T07:49:14-04:00, End: 2023-04-18T08:49:14-04:00" file="utils.go:67"
time="2023-04-18 08:49:21" level=info msg="Indexing metrics with UUID test-uuid" file="utils.go:72"
time="2023-04-18 08:49:21" level=info msg="🔍 Scraping prometheus metrics for benchmark from 2023-04-18T07:49:14-04:00 to 2023-04-18T08:49:14-04:00" file="prometheus.go:115"
time="2023-04-18 08:49:22" level=info msg="Indexing metric QuayRequestDuration" file="elastic.go:86"
time="2023-04-18 08:49:29" level=info msg="Indexing metric QuaySecScanIndexDuration" file="elastic.go:86"
time="2023-04-18 08:49:35" level=info msg="Indexing metric QuayModelCacheTotalRate" file="elastic.go:86"
time="2023-04-18 08:49:35" level=info msg="Indexing metric QuayModelCacheTotalSum" file="elastic.go:86"
time="2023-04-18 08:49:36" level=info msg="Indexing metric QuayDbConnectCallsRate" file="elastic.go:86"
time="2023-04-18 08:49:43" level=info msg="Indexing metric QuayDbConnectCallsSum" file="elastic.go:86"
time="2023-04-18 08:49:47" level=info msg="Indexing metric QuayDbCloseCallsRate" file="elastic.go:86"
time="2023-04-18 08:49:56" level=info msg="Indexing metric QuayDbCloseCallsSum" file="elastic.go:86"
time="2023-04-18 08:50:00" level=info msg="Indexing metric QuayDbPooledConnectionsAvailableRate" file="elastic.go:86"
time="2023-04-18 08:50:04" level=info msg="Indexing metric QuayDbPooledConnectionsAvailableSum" file="elastic.go:86"
time="2023-04-18 08:50:10" level=info msg="Indexing metric QuayDbPooledConnectionsInUseRate" file="elastic.go:86"
time="2023-04-18 08:50:14" level=info msg="Indexing metric QuayDbPooledConnectionsInUseSum" file="elastic.go:86"
time="2023-04-18 08:50:20" level=info msg="👋 Exiting kube-burner test-uuid" file="kube-burner.go:198"

Tested integrating with kube-buner for opensearch indexer as well.

time="2023-04-18 15:23:51" level=info msg="📁 Creating indexer: opensearch" file="factory.go:31"
time="2023-04-18 15:23:55" level=info msg="👽 Initializing prometheus client with URL: https://prometheus-k8s-openshift-monitoring.apps.vchalla-quay-test-2.perfscale.devcluster.openshift.com" file="prometheus.go:55"
time="2023-04-18 15:23:56" level=info msg="Scraping for the prometheus entry with params - Endpoint: https://prometheus-k8s-openshift-monitoring.apps.vchalla-quay-test-2.perfscale.devcluster.openshift.com, Profile: /home/vchalla/quay-metrics.yaml, Start: 2023-04-18T09:55:04-04:00, End: 2023-04-18T15:16:04-04:00" file="utils.go:67"
time="2023-04-18 15:23:56" level=info msg="Indexing metrics with UUID f0c5e8ca-51f7-41fe-ad70-7c16289a6cc5" file="utils.go:72"
time="2023-04-18 15:23:56" level=info msg="🔍 Scraping prometheus metrics for benchmark from 2023-04-18T09:55:04-04:00 to 2023-04-18T15:16:04-04:00" file="prometheus.go:115"
time="2023-04-18 15:23:58" level=info msg="Indexing metric QuayRequestDuration" file="opensearch.go:74"
time="2023-04-18 15:24:09" level=info msg="Indexing metric QuaySecScanIndexDuration" file="opensearch.go:74"
time="2023-04-18 15:24:15" level=info msg="Indexing metric QuayModelCacheTotalRate" file="opensearch.go:74"
time="2023-04-18 15:24:21" level=info msg="Indexing metric QuayModelCacheTotalSum" file="opensearch.go:74"
time="2023-04-18 15:24:25" level=info msg="Indexing metric QuayDbConnectCallsRate" file="opensearch.go:74"
time="2023-04-18 15:24:33" level=info msg="Indexing metric QuayDbConnectCallsSum" file="opensearch.go:74"
time="2023-04-18 15:24:40" level=info msg="Indexing metric QuayDbCloseCallsRate" file="opensearch.go:74"
time="2023-04-18 15:24:45" level=info msg="Indexing metric QuayDbCloseCallsSum" file="opensearch.go:74"
time="2023-04-18 15:24:49" level=info msg="Indexing metric QuayDbPooledConnectionsAvailableRate" file="opensearch.go:74"
time="2023-04-18 15:24:54" level=info msg="Indexing metric QuayDbPooledConnectionsAvailableSum" file="opensearch.go:74"
time="2023-04-18 15:25:00" level=info msg="Indexing metric QuayDbPooledConnectionsInUseRate" file="opensearch.go:74"
time="2023-04-18 15:25:04" level=info msg="Indexing metric QuayDbPooledConnectionsInUseSum" file="opensearch.go:74"
time="2023-04-18 15:25:09" level=info msg="👋 Exiting kube-burner f0c5e8ca-51f7-41fe-ad70-7c16289a6cc5" file="kube-burner.go:198"
vishnuchalla commented 1 year ago

@rook and @rsevilla87 - Both elasticsearch and opensearch APIs share exactly same code (See elastic.go and opensearch.go). We can have any one of them for indexing functionality or else both in case we want to have some backward compatability. My idea is to fully migrate to opensearch. Related blogs:

Please feel free to share your thoughts here. Thanks!

rsevilla87 commented 1 year ago

@rook and @rsevilla87 - Both elasticsearch and opensearch APIs share exactly same code (See elastic.go and opensearch.go). We can have any one of them for indexing functionality or else both in case we want to have some backward compatability. My idea is to fully migrate to opensearch. Related blogs:

* https://dattell.com/data-architecture-blog/opensearch-vs-elasticsearch/

* https://logit.io/blog/post/aws-elasticsearch-vs-opensearch/

Please feel free to share your thoughts here. Thanks!

thanks for the research!, I don't have a strong opinion on this, but I think we can keep both for backwards compatibility in case any user is using a recent version of elasticsearch (OpenSearch is compatible up to the 7.10 version). I'll add some notes to the kube-burner docs about this.

jtaleric commented 1 year ago

@rook and @rsevilla87 - Both elasticsearch and opensearch APIs share exactly same code (See elastic.go and opensearch.go). We can have any one of them for indexing functionality or else both in case we want to have some backward compatability. My idea is to fully migrate to opensearch. Related blogs:

Please feel free to share your thoughts here. Thanks!

Yeah - opensearch works fine for me... k8s-netperf started with opensearch, so I would defer to @rsevilla87 on eventually moving to opensearch from es.

rsevilla87 commented 1 year ago

Hey @vishnuchalla, I just sent a PR to your fork's branch containing the logger interface abstraction we discussed about in yesterday's meeting. https://github.com/vishnuchalla/go-commons/pull/1

vishnuchalla commented 1 year ago

Hey @vishnuchalla, I just sent a PR to your fork's branch containing the logger interface abstraction we discussed about in yesterday's meeting. vishnuchalla#1

@rsevilla87 - Thanks for the quick help. IMHO, I don't think we should be passing logger as an argument to functions in go-commons (because we do not do it for any of the go imports in our code). Instead, either

Open for other thoughts too. Please let me know your thoughts here. Thank you!

cc: @jtaleric