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

Splunkent client refactor #27205

Merged
merged 28 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed maxWaitTime
  • Loading branch information
shalper2 committed Oct 16, 2023
commit 25cbeb9981eccaad571762439656963f0a41ff99
2 changes: 0 additions & 2 deletions receiver/splunkenterprisereceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"net/url"
"strings"
"time"

"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/receiver/scraperhelper"
Expand All @@ -26,7 +25,6 @@ type Config struct {
confighttp.HTTPClientSettings `mapstructure:",squash"`
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
metadata.MetricsBuilderConfig `mapstructure:",squash"`
MaxSearchWaitTime time.Duration `mapstructure:"max_search_wait_time"`
}

func (cfg *Config) Validate() (errors error) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkenterprisereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func createDefaultConfig() component.Config {
}
scfg := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type)
scfg.CollectionInterval = defaultInterval
scfg.Timeout = defaultMaxSearchWaitTime

return &Config{
HTTPClientSettings: confighttp.HTTPClientSettings{
Headers: defaultHeaders,
},
ScraperControllerSettings: scfg,
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
MaxSearchWaitTime: defaultMaxSearchWaitTime,
}
}

Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkenterprisereceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *splunkScraper) scrapeLicenseUsageByIndex(ctx context.Context, now pcomm
time.Sleep(2 * time.Second)
}

if time.Since(start) > s.conf.MaxSearchWaitTime {
if time.Since(start) > s.conf.ScraperControllerSettings.Timeout {
errs.Add(errMaxSearchWaitTimeExceeded)
return
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkenterprisereceiver/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ splunkenterprise:
endpoint: "https://localhost:8089"
# Optional settings
collection_interval: 10s
max_search_wait_time: 11s
timeout: 11s
# Also optional: metric settings
metrics:
splunk.license.index.usage:
Expand Down