Skip to content

Commit

Permalink
address more @Issif feedback (cleanup)
Browse files Browse the repository at this point in the history
Signed-off-by: JuanJo Ciarlante <juanjosec@gmail.com>
  • Loading branch information
jjo committed Jan 18, 2024
1 parent 501ede9 commit 62b80d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 71 deletions.
7 changes: 0 additions & 7 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ import (
"github.com/falcosecurity/falcosidekick/types"
)

// NB: create OS interface to allow unit-testing
type OS interface {
Getenv(string) string
Setenv(string, string) error
}

func getConfig() *types.Configuration {
c := &types.Configuration{
Customfields: make(map[string]string),
Expand Down Expand Up @@ -515,7 +509,6 @@ func getConfig() *types.Configuration {
v.SetDefault("OTLP.Traces.Synced", false)
v.SetDefault("OTLP.Traces.MinimumPriority", "")
v.SetDefault("OTLP.Traces.CheckCert", true)
v.SetDefault("OTLP.Traces.TraceIDHash", "")
// NB: Unfortunately falco events don't provide endtime, artificially set
// it to 1000ms by default, override-able via OTLP_DURATION environment variable.
v.SetDefault("OTLP.Traces.Duration", 1000)
Expand Down
55 changes: 0 additions & 55 deletions outputs/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,6 @@ import (
"go.opentelemetry.io/otel/trace"
)

// Need to mock three interfaces: TracerProvider, Tracer, Span
// type (
// MockTracerProvider struct{}
// MockTracer struct{}
// MockSpan struct {
// name string
// startOpts []trace.SpanStartOption
// endOpts []trace.SpanEndOption
// ctx context.Context
// attributes map[attribute.Key]attribute.Value
// }
// )

// // TracerProvider interface {
// func (*MockTracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer {
// return &MockTracer{}
// }

// // Tracer interface
// func (*MockTracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
// return ctx, &MockSpan{
// ctx: ctx,
// name: name,
// startOpts: opts,
// attributes: make(map[attribute.Key]attribute.Value),
// }
// }

// // Span interface
// func (*MockSpan) AddEvent(string, ...trace.EventOption) {}
// func (*MockSpan) IsRecording() bool { return true }
// func (*MockSpan) RecordError(err error, opts ...trace.EventOption) {}
// func (*MockSpan) SetName(name string) {}
// func (*MockSpan) SetStatus(code codes.Code, description string) {}

// func (*MockSpan) TracerProvider() trace.TracerProvider { return &MockTracerProvider{} }

// func (m *MockSpan) End(opts ...trace.SpanEndOption) {
// m.endOpts = opts
// }

// func (m *MockSpan) SetAttributes(kv ...attribute.KeyValue) {
// for _, k := range kv {
// m.attributes[k.Key] = k.Value
// }
// }

// func (m *MockSpan) SpanContext() trace.SpanContext {
// return trace.SpanContextFromContext(m.ctx)
// }

// func MockGetTracerProvider() trace.TracerProvider {
// return &MockTracerProvider{}
// }

func startOptIn(opt trace.SpanStartOption, opts []trace.SpanStartOption) bool {

Check failure on line 28 in outputs/otlp_test.go

View workflow job for this annotation

GitHub Actions / lint

func `startOptIn` is unused (unused)
res := lo.Filter(opts, func(o trace.SpanStartOption, index int) bool {
return o == opt
Expand Down
18 changes: 9 additions & 9 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,15 @@ type OpenObserveConfig struct {

// OTLPTraces represents config parameters for OTLP Traces
type OTLPTraces struct {
Endpoint string
Protocol string
Timeout int64
Headers string
Duration int64
Synced bool
ExtraEnvVars map[string]string
CheckCert bool
MinimumPriority string
Endpoint string
Protocol string
Timeout int64
Headers string
Duration int64
Synced bool
ExtraEnvVars map[string]string
CheckCert bool
MinimumPriority string
}

// OTLPOutputConfig represents config parameters for OTLP
Expand Down

0 comments on commit 62b80d7

Please sign in to comment.