Revert "Support stopping oas/servicemesh/telemetry in flight (#867)" (#868)

This reverts commit 50c0062db4.
This commit is contained in:
RamiBerm 2022-03-02 09:48:42 +02:00 committed by GitHub
parent 50c0062db4
commit 94dfa68858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 30 deletions

View File

@ -4,14 +4,13 @@ import (
"bytes"
"crypto/tls"
"encoding/json"
"net/http"
"sync"
"time"
"github.com/elastic/go-elasticsearch/v7"
"github.com/up9inc/mizu/shared"
"github.com/up9inc/mizu/shared/logger"
"github.com/up9inc/mizu/tap/api"
"net/http"
"sync"
"time"
)
type client struct {
@ -32,9 +31,6 @@ func GetInstance() *client {
func (client *client) Configure(config shared.ElasticConfig) {
if config.Url == "" || config.User == "" || config.Password == "" {
if client.es != nil {
client.es = nil
}
logger.Log.Infof("No elastic configuration was supplied, elastic exporter disabled")
return
}
@ -50,13 +46,13 @@ func (client *client) Configure(config shared.ElasticConfig) {
es, err := elasticsearch.NewClient(cfg)
if err != nil {
logger.Log.Errorf("Failed to initialize elastic client %v", err)
logger.Log.Fatalf("Failed to initialize elastic client %v", err)
}
// Have the client instance return a response
res, err := es.Info()
if err != nil {
logger.Log.Errorf("Elastic client.Info() ERROR: %v", err)
logger.Log.Fatalf("Elastic client.Info() ERROR: %v", err)
} else {
client.es = es
client.index = "mizu_traffic_http_" + time.Now().Format("2006_01_02_15_04")

View File

@ -33,23 +33,10 @@ func (g *oasGenerator) Start() {
g.entriesChan = make(chan EntryWithSource, 100) // buffer up to 100 entries for OAS processing
g.ServiceSpecs = &sync.Map{}
g.started = true
go instance.runGenerator()
go instance.runGeneretor()
}
func (g *oasGenerator) Stop() {
if !g.started {
return
}
g.cancel()
g.Reset()
g.started = false
}
func (g *oasGenerator) IsStarted() bool {
return g.started
}
func (g *oasGenerator) runGenerator() {
func (g *oasGenerator) runGeneretor() {
for {
select {
case <-g.ctx.Done():

View File

@ -32,7 +32,6 @@ type serviceMap struct {
type ServiceMap interface {
Enable()
Disable()
IsEnabled() bool
NewTCPEntry(source *tapApi.TCP, destination *tapApi.TCP, protocol *tapApi.Protocol)
GetStatus() ServiceMapStatus
@ -160,11 +159,6 @@ func (s *serviceMap) Enable() {
s.enabled = true
}
func (s *serviceMap) Disable() {
s.Reset()
s.enabled = false
}
func (s *serviceMap) IsEnabled() bool {
return s.enabled
}