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

[exporter/sumologicexporter]: adds support for tracing #33021

Merged
merged 6 commits into from
May 22, 2024
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
feat: removes trace_format configuration option
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
sumo-drosiek committed May 21, 2024
commit 13200f73a520b27159c79c4c572185e8abc5687a
2 changes: 1 addition & 1 deletion exporter/sumologicexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exporters:
decompose_otlp_histograms: {true, false}

# timeout is the timeout for every attempt to send data to the backend,
# maximum connection timeout is 55s, default = 5s
# maximum connection timeout is 55s, default = 30s
Copy link
Member

Choose a reason for hiding this comment

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

Is this maximum connection timeout ever enforced or tested? It's unrelated to this PR, so no need to do anything now, just something to consider if it's not currently enforced.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we test it
Created issue so we can keep track of it: #33151

timeout: <timeout>

# defines if sticky session support is enable.
Expand Down
10 changes: 0 additions & 10 deletions exporter/sumologicexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ type Config struct {
// Decompose OTLP Histograms into individual metrics, similar to how they're represented in Prometheus format
DecomposeOtlpHistograms bool `mapstructure:"decompose_otlp_histograms"`

// Traces related configuration
// The format of traces you will be sending, currently only otlp format is supported
TraceFormat TraceFormatType `mapstructure:"trace_format"`

// Sumo specific options
// Name of the client
Client string `mapstructure:"client"`
Expand Down Expand Up @@ -119,12 +115,6 @@ func (cfg *Config) Validate() error {
return fmt.Errorf("unexpected metric format: %s", cfg.MetricFormat)
}

switch cfg.TraceFormat {
case OTLPTraceFormat:
default:
return fmt.Errorf("unexpected trace format: %s", cfg.TraceFormat)
}

if len(cfg.ClientConfig.Endpoint) == 0 && cfg.ClientConfig.Auth == nil {
return errors.New("no endpoint and no auth extension specified")
}
Expand Down
28 changes: 0 additions & 28 deletions exporter/sumologicexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func TestInitExporterInvalidConfiguration(t *testing.T) {
cfg: &Config{
LogFormat: "test_format",
MetricFormat: "otlp",
TraceFormat: "otlp",
ClientConfig: confighttp.ClientConfig{
Timeout: defaultTimeout,
Endpoint: "test_endpoint",
Expand Down Expand Up @@ -70,33 +69,6 @@ func TestInitExporterInvalidConfiguration(t *testing.T) {
},
},
},
{
name: "unexpected trace format",
expectedError: errors.New("unexpected trace format: text"),
cfg: &Config{
LogFormat: "json",
MetricFormat: "otlp",
TraceFormat: "text",
ClientConfig: confighttp.ClientConfig{
Timeout: defaultTimeout,
Endpoint: "test_endpoint",
Compression: "gzip",
},
},
},
{
name: "no endpoint and no auth extension specified",
expectedError: errors.New("no endpoint and no auth extension specified"),
cfg: &Config{
LogFormat: "json",
MetricFormat: "otlp",
TraceFormat: "otlp",
ClientConfig: confighttp.ClientConfig{
Timeout: defaultTimeout,
Compression: "gzip",
},
},
},
}

for _, tc := range testcases {
Expand Down
1 change: 0 additions & 1 deletion exporter/sumologicexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func createTestConfig() *Config {
config.LogFormat = TextFormat
config.MaxRequestBodySize = 20_971_520
config.MetricFormat = OTLPMetricFormat
config.TraceFormat = OTLPTraceFormat
return config
}

Expand Down
1 change: 0 additions & 1 deletion exporter/sumologicexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func createDefaultConfig() component.Config {
LogFormat: DefaultLogFormat,
MetricFormat: DefaultMetricFormat,
Client: DefaultClient,
TraceFormat: OTLPTraceFormat,

ClientConfig: createDefaultClientConfig(),
BackOffConfig: configretry.NewDefaultBackOffConfig(),
Expand Down
1 change: 0 additions & 1 deletion exporter/sumologicexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestCreateDefaultConfig(t *testing.T) {
LogFormat: "otlp",
MetricFormat: "otlp",
Client: "otelcol",
TraceFormat: "otlp",

ClientConfig: confighttp.ClientConfig{
Timeout: 30 * time.Second,
Expand Down
19 changes: 4 additions & 15 deletions exporter/sumologicexporter/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,7 @@ func (s *sender) appendAndMaybeSend(

// sendTraces sends traces in right format basing on the s.config.TraceFormat
func (s *sender) sendTraces(ctx context.Context, td ptrace.Traces) error {
if s.config.TraceFormat == OTLPTraceFormat {
return s.sendOTLPTraces(ctx, td)
}
return nil
return s.sendOTLPTraces(ctx, td)
}

// sendOTLPTraces sends trace records in OTLP format
Expand Down Expand Up @@ -679,14 +676,8 @@ func addMetricsHeaders(req *http.Request, mf MetricFormatType) error {
return nil
}

func addTracesHeaders(req *http.Request, tf TraceFormatType) error {
switch tf {
case OTLPTraceFormat:
req.Header.Add(headerContentType, contentTypeOTLP)
default:
return fmt.Errorf("unsupported traces format: %s", tf)
}
return nil
func addTracesHeaders(req *http.Request) {
req.Header.Add(headerContentType, contentTypeOTLP)
}

func (s *sender) addRequestHeaders(req *http.Request, pipeline PipelineType, flds fields) error {
Expand All @@ -701,9 +692,7 @@ func (s *sender) addRequestHeaders(req *http.Request, pipeline PipelineType, fld
return err
}
case TracesPipeline:
if err := addTracesHeaders(req, s.config.TraceFormat); err != nil {
return err
}
addTracesHeaders(req)
default:
return fmt.Errorf("unexpected pipeline: %v", pipeline)
}
Expand Down
Loading