Skip to content

Commit

Permalink
add sniff switch to es client
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderTreeTech committed Sep 14, 2021
1 parent a7da9d5 commit 9eb04ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/database/es/client.go
Expand Up @@ -39,6 +39,8 @@ type Config struct {
URLs []string
// Plugins enabled plugins
Plugins []string
// Sniff enabled or disabled sniffer
Sniff bool
}

// Client es client struct
Expand All @@ -61,6 +63,7 @@ func NewClient(config *Config) *Client {
es7.SetURL(config.URLs...),
es7.SetScheme(config.Schema),
es7.SetRequiredPlugins(config.Plugins...),
es7.SetSniff(config.Sniff),
)
client := &Client{
config: config,
Expand Down
6 changes: 3 additions & 3 deletions pkg/database/es/stats.go
Expand Up @@ -80,11 +80,11 @@ func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error
} else {
resp, err = http.DefaultTransport.RoundTrip(req)
}

if resp != nil {
span = span.SetTag("http.status_code", resp.StatusCode)
span = span.SetTag("http.status_code", resp.StatusCode)
}

if err != nil {
ext.Error.Set(span, true)
span.LogFields(log.String("event", "error"), log.String("message", err.Error()))
Expand Down

0 comments on commit 9eb04ca

Please sign in to comment.