Skip to content

Commit

Permalink
Syntax cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: John <john.dorman@sony.com>
  • Loading branch information
boostchicken authored and jpkrohling committed Jan 18, 2022
1 parent 4ba3a6a commit f0f8e91
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion processor/filterprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,5 @@ processors:
- hello/world
attributes:
- Key: container.name
Value: (app_container_1|app_container_1)
Value: (app_container_1|app_container_2)
```
2 changes: 1 addition & 1 deletion processor/filterprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type MetricFilters struct {
RegexpConfig *regexp.Config `mapstructure:"regexp"`
}

// MetricFilters filters by Metric properties.
// SpanFilters filters by Span attributes and various other fields
type SpanFilters struct {
// Include match properties describe metrics that should be included in the Collector Service pipeline,
// all other metrics should be dropped from further processing.
Expand Down
2 changes: 1 addition & 1 deletion processor/filterprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func createTracesProcessor(
cfg config.Processor,
nextConsumer consumer.Traces,
) (component.TracesProcessor, error) {
fp, err := newFilterTracesProcessor(set.Logger, cfg.(*Config))
fp, err := newFilterSpansProcessor(set.Logger, cfg.(*Config))
if err != nil {
return nil, err
}
Expand Down
13 changes: 5 additions & 8 deletions processor/filterprocessor/filter_processor_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type filterSpanProcessor struct {
logger *zap.Logger
}

func newFilterTracesProcessor(logger *zap.Logger, cfg *Config) (*filterSpanProcessor, error) {
func newFilterSpansProcessor(logger *zap.Logger, cfg *Config) (*filterSpanProcessor, error) {
inc, err := createSpanMatcher(cfg.Spans.Include)
if err != nil {
return nil, err
Expand All @@ -48,9 +48,10 @@ func newFilterTracesProcessor(logger *zap.Logger, cfg *Config) (*filterSpanProce
}

excludeMatchType := ""
if cfg.Metrics.Exclude != nil {
if cfg.Spans.Exclude != nil {
excludeMatchType = string(cfg.Spans.Exclude.MatchType)
}

logger.Info(
"Span filter configured",
zap.String("include match_type", includeMatchType),
Expand All @@ -66,18 +67,14 @@ func newFilterTracesProcessor(logger *zap.Logger, cfg *Config) (*filterSpanProce
}

func createSpanMatcher(sp *filterconfig.MatchProperties) (filterspan.Matcher, error) {
var matcher filterspan.Matcher
var err error
if sp == nil {
panic("No Match Properties for Filter")
return nil, nil
}
matcher, err = filterspan.NewMatcher(sp)
return matcher, err
return filterspan.NewMatcher(sp)
}

// processTraces filters the given spans of a traces based off the filterSpanProcessor's filters.
func (fsp *filterSpanProcessor) processTraces(_ context.Context, pdt pdata.Traces) (pdata.Traces, error) {

for i := 0; i < pdt.ResourceSpans().Len(); i++ {
resSpan := pdt.ResourceSpans().At(i)
for x := 0; x < resSpan.InstrumentationLibrarySpans().Len(); x++ {
Expand Down

0 comments on commit f0f8e91

Please sign in to comment.