Skip to content

Commit 782cc19

Browse files
authored
[refactor] Move sanitizer (#7158)
## Which problem is this PR solving? - The need for "sanitizer" concept some up in other scenarios, e.g. #7128, but currently it was hidden under jaeger binary internal. ## Description of the changes - Move it instead to internal/jptrace/sanitizer, which is a reasonably logical place considering that it affects the data model ## How was this change tested? - CI --------- Signed-off-by: Yuri Shkuro <[email protected]>
1 parent 463d928 commit 782cc19

File tree

11 files changed

+8
-32
lines changed

11 files changed

+8
-32
lines changed

cmd/collector/app/span_processor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
2121
"github.com/jaegertracing/jaeger/cmd/collector/app/queue"
2222
"github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer"
23-
sanitizerv2 "github.com/jaegertracing/jaeger/cmd/jaeger/sanitizer"
2423
"github.com/jaegertracing/jaeger/internal/jptrace"
24+
sanitizerv2 "github.com/jaegertracing/jaeger/internal/jptrace/sanitizer"
2525
"github.com/jaegertracing/jaeger/internal/storage/v2/api/tracestore"
2626
"github.com/jaegertracing/jaeger/internal/storage/v2/v1adapter"
2727
"github.com/jaegertracing/jaeger/internal/telemetry"

cmd/jaeger/internal/exporters/storageexporter/exporter.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"go.uber.org/zap"
1313

1414
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
15-
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/sanitizer"
15+
"github.com/jaegertracing/jaeger/internal/jptrace/sanitizer"
1616
"github.com/jaegertracing/jaeger/internal/storage/v2/api/tracestore"
1717
)
1818

@@ -25,11 +25,9 @@ type storageExporter struct {
2525

2626
func newExporter(config *Config, otel component.TelemetrySettings) *storageExporter {
2727
return &storageExporter{
28-
config: config,
29-
logger: otel.Logger,
30-
sanitizer: sanitizer.NewChainedSanitizer(
31-
sanitizer.NewStandardSanitizers()...,
32-
),
28+
config: config,
29+
logger: otel.Logger,
30+
sanitizer: sanitizer.Sanitize,
3331
}
3432
}
3533

cmd/jaeger/sanitizer/package_test.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

cmd/jaeger/sanitizer/sanitizer.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

cmd/jaeger/internal/sanitizer/sanitizer.go renamed to internal/jptrace/sanitizer/sanitizer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
// Func is a function that performs enrichment, clean-up, or normalization of trace data.
1111
type Func func(traces ptrace.Traces) ptrace.Traces
1212

13+
// Sanitize is a function that applies all sanitizers to the given trace data.
14+
var Sanitize = NewChainedSanitizer(NewStandardSanitizers()...)
15+
1316
// NewStandardSanitizers returns a list of all the sanitizers that are used by the
1417
// storage exporter.
1518
func NewStandardSanitizers() []Func {

0 commit comments

Comments
 (0)