Skip to content

replace json-iterator/go with reflection-free dependency to reenable dead code elimination #12747

@kruskall

Description

@kruskall

Component(s)

pdata

What happened?

Describe the bug

any binary that depends on go.opentelemetry.io/collector/pdata has DCE (dead code elimination) disabled due to a dependency on https://github.com/json-iterator/go

Any use of reflect.Value.MethodByName() or reflect.Type.MethodByName() disables DCE. The compiler assumes that these functions will look any method up, and cannot remove methods even if they are never called.

Steps to reproduce

build a binary that depends on go.opentelemetry.io/collector/pdata

What did you expect to see?

a small binary

What did you see instead?

a huge binary

Collector version

anything after #4986

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

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