Skip to content

SimpleProcessor.OnEmit Returns nil When No Exporter is Configured #7595

@yumosx

Description

@yumosx

Description

func (s *SimpleProcessor) OnEmit(ctx context.Context, r *Record) (err error) {
	if s.exporter == nil {
		return nil
	}

	s.mu.Lock()
	defer s.mu.Unlock()

	records := simpleProcRecordsPool.Get().(*[]Record)
	(*records)[0] = *r
	defer func() {
		simpleProcRecordsPool.Put(records)
	}()

	if s.inst != nil {
		defer func() {
			s.inst.LogProcessed(ctx, err)
		}()
	}
	return s.exporter.Export(ctx, *records)
}

ref #7548 (comment)

In SimpleProcessor.OnEmit, when s.exporter == nil, the function returns nil, Should we define a custom error to describe the fact that it wasn't successfully exported (something like: simple processor has no exporter configured). or we can define a report for this situation.

cc @flc1125

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions