Skip to content

Commit

Permalink
Rename ProcessorObsReport to Processor (open-telemetry#2657)
Browse files Browse the repository at this point in the history
since obsreport is the package name.

Fixes open-telemetry#2639

Signed-off-by: naseemkullah <[email protected]>
  • Loading branch information
Naseem authored Mar 10, 2021
1 parent ca439f8 commit 84f74ef
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion obsreport/obsreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func Configure(level configtelemetry.Level) (views []*view.View) {
gLevel = level

if gLevel != configtelemetry.LevelNone {
gProcessorObsReport.level = level
gProcessor.level = level
views = append(views, AllViews()...)
}

Expand Down
26 changes: 13 additions & 13 deletions obsreport/obsreport_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,22 @@ func ProcessorMetricViews(configType string, legacyViews []*view.View) []*view.V
return allViews
}

var gProcessorObsReport = &ProcessorObsReport{level: configtelemetry.LevelNone}
var gProcessor = &Processor{level: configtelemetry.LevelNone}

type ProcessorObsReport struct {
type Processor struct {
level configtelemetry.Level
mutators []tag.Mutator
}

func NewProcessorObsReport(level configtelemetry.Level, processorName string) *ProcessorObsReport {
return &ProcessorObsReport{
func NewProcessor(level configtelemetry.Level, processorName string) *Processor {
return &Processor{
level: level,
mutators: []tag.Mutator{tag.Upsert(tagKeyProcessor, processorName, tag.WithTTL(tag.TTLNoPropagation))},
}
}

// TracesAccepted reports that the trace data was accepted.
func (por *ProcessorObsReport) TracesAccepted(ctx context.Context, numSpans int) {
func (por *Processor) TracesAccepted(ctx context.Context, numSpans int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -142,7 +142,7 @@ func (por *ProcessorObsReport) TracesAccepted(ctx context.Context, numSpans int)
}

// TracesRefused reports that the trace data was refused.
func (por *ProcessorObsReport) TracesRefused(ctx context.Context, numSpans int) {
func (por *Processor) TracesRefused(ctx context.Context, numSpans int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -155,7 +155,7 @@ func (por *ProcessorObsReport) TracesRefused(ctx context.Context, numSpans int)
}

// TracesDropped reports that the trace data was dropped.
func (por *ProcessorObsReport) TracesDropped(ctx context.Context, numSpans int) {
func (por *Processor) TracesDropped(ctx context.Context, numSpans int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -168,7 +168,7 @@ func (por *ProcessorObsReport) TracesDropped(ctx context.Context, numSpans int)
}

// MetricsAccepted reports that the metrics were accepted.
func (por *ProcessorObsReport) MetricsAccepted(ctx context.Context, numPoints int) {
func (por *Processor) MetricsAccepted(ctx context.Context, numPoints int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -181,7 +181,7 @@ func (por *ProcessorObsReport) MetricsAccepted(ctx context.Context, numPoints in
}

// MetricsRefused reports that the metrics were refused.
func (por *ProcessorObsReport) MetricsRefused(ctx context.Context, numPoints int) {
func (por *Processor) MetricsRefused(ctx context.Context, numPoints int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -194,7 +194,7 @@ func (por *ProcessorObsReport) MetricsRefused(ctx context.Context, numPoints int
}

// MetricsDropped reports that the metrics were dropped.
func (por *ProcessorObsReport) MetricsDropped(ctx context.Context, numPoints int) {
func (por *Processor) MetricsDropped(ctx context.Context, numPoints int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -207,7 +207,7 @@ func (por *ProcessorObsReport) MetricsDropped(ctx context.Context, numPoints int
}

// LogsAccepted reports that the logs were accepted.
func (por *ProcessorObsReport) LogsAccepted(ctx context.Context, numRecords int) {
func (por *Processor) LogsAccepted(ctx context.Context, numRecords int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -220,7 +220,7 @@ func (por *ProcessorObsReport) LogsAccepted(ctx context.Context, numRecords int)
}

// LogsRefused reports that the logs were refused.
func (por *ProcessorObsReport) LogsRefused(ctx context.Context, numRecords int) {
func (por *Processor) LogsRefused(ctx context.Context, numRecords int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand All @@ -233,7 +233,7 @@ func (por *ProcessorObsReport) LogsRefused(ctx context.Context, numRecords int)
}

// LogsDropped reports that the logs were dropped.
func (por *ProcessorObsReport) LogsDropped(ctx context.Context, numRecords int) {
func (por *Processor) LogsDropped(ctx context.Context, numRecords int) {
if por.level != configtelemetry.LevelNone {
stats.RecordWithTags(
ctx,
Expand Down
6 changes: 3 additions & 3 deletions obsreport/obsreport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func TestProcessorTraceData(t *testing.T) {
const refusedSpans = 19
const droppedSpans = 13

obsrep := obsreport.NewProcessorObsReport(configtelemetry.LevelNormal, processor)
obsrep := obsreport.NewProcessor(configtelemetry.LevelNormal, processor)
obsrep.TracesAccepted(context.Background(), acceptedSpans)
obsrep.TracesRefused(context.Background(), refusedSpans)
obsrep.TracesDropped(context.Background(), droppedSpans)
Expand All @@ -568,7 +568,7 @@ func TestProcessorMetricsData(t *testing.T) {
const refusedPoints = 11
const droppedPoints = 17

obsrep := obsreport.NewProcessorObsReport(configtelemetry.LevelNormal, processor)
obsrep := obsreport.NewProcessor(configtelemetry.LevelNormal, processor)
obsrep.MetricsAccepted(context.Background(), acceptedPoints)
obsrep.MetricsRefused(context.Background(), refusedPoints)
obsrep.MetricsDropped(context.Background(), droppedPoints)
Expand Down Expand Up @@ -639,7 +639,7 @@ func TestProcessorLogRecords(t *testing.T) {
const refusedRecords = 11
const droppedRecords = 17

obsrep := obsreport.NewProcessorObsReport(configtelemetry.LevelNormal, processor)
obsrep := obsreport.NewProcessor(configtelemetry.LevelNormal, processor)
obsrep.LogsAccepted(context.Background(), acceptedRecords)
obsrep.LogsRefused(context.Background(), refusedRecords)
obsrep.LogsDropped(context.Background(), droppedRecords)
Expand Down
4 changes: 2 additions & 2 deletions processor/memorylimiter/memorylimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type memoryLimiter struct {
logger *zap.Logger
configMismatchedLogged bool

obsrep *obsreport.ProcessorObsReport
obsrep *obsreport.Processor
}

// Minimum interval between forced GC when in soft limited mode. We don't want to
Expand Down Expand Up @@ -118,7 +118,7 @@ func newMemoryLimiter(logger *zap.Logger, cfg *Config) (*memoryLimiter, error) {
readMemStatsFn: runtime.ReadMemStats,
procName: cfg.Name(),
logger: logger,
obsrep: obsreport.NewProcessorObsReport(configtelemetry.GetMetricsLevelFlagValue(), cfg.Name()),
obsrep: obsreport.NewProcessor(configtelemetry.GetMetricsLevelFlagValue(), cfg.Name()),
}

ml.startMonitoring()
Expand Down
6 changes: 3 additions & 3 deletions processor/memorylimiter/memorylimiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestMetricsMemoryPressureResponse(t *testing.T) {
readMemStatsFn: func(ms *runtime.MemStats) {
ms.Alloc = currentMemAlloc
},
obsrep: obsreport.NewProcessorObsReport(configtelemetry.LevelNone, ""),
obsrep: obsreport.NewProcessor(configtelemetry.LevelNone, ""),
logger: zap.NewNop(),
}
mp, err := processorhelper.NewMetricsProcessor(
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestTraceMemoryPressureResponse(t *testing.T) {
readMemStatsFn: func(ms *runtime.MemStats) {
ms.Alloc = currentMemAlloc
},
obsrep: obsreport.NewProcessorObsReport(configtelemetry.LevelNone, ""),
obsrep: obsreport.NewProcessor(configtelemetry.LevelNone, ""),
logger: zap.NewNop(),
}
tp, err := processorhelper.NewTraceProcessor(
Expand Down Expand Up @@ -252,7 +252,7 @@ func TestLogMemoryPressureResponse(t *testing.T) {
readMemStatsFn: func(ms *runtime.MemStats) {
ms.Alloc = currentMemAlloc
},
obsrep: obsreport.NewProcessorObsReport(configtelemetry.LevelNone, ""),
obsrep: obsreport.NewProcessor(configtelemetry.LevelNone, ""),
logger: zap.NewNop(),
}
lp, err := processorhelper.NewLogsProcessor(
Expand Down

0 comments on commit 84f74ef

Please sign in to comment.