Skip to content

Core binary footprint increased significantly between v0.158.0 and v0.159.0 #16075

Closed

Description

@nozomi-gedimitr

Component(s)

service

Describe the issue you're reporting

After upgrading to the latest release for some custom collector builds, noticed that the binary size increased significantly. An investigation has pinpointed this between the v0.158.0 and v0.159.0 releases.

To demonstrate the issue, the following configuration YAML was built under these two tags:

dist:
  name: otelcol-custom
  description: Local OpenTelemetry Collector binary
  output_path: /tmp/dist

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter <tag>

receivers:
  - gomod:  go.opentelemetry.io/collector/receiver/otlpreceiver <tag>

processors:
  - gomod: go.opentelemetry.io/collector/processor/batchprocessor <tag>

Builds were done in a golang:trixie container under go version:

root@9a4974680dba:/go# go version
go version go1.27.1 linux/arm64

The resulting binary sizes were

v0.158.0 --> 26M
v0.159.0 --> 30M

By investigating deeper, it was found that most of the additional size can be attributed to package go.opentelemetry.io/contrib/otelconf which got upgraded from v0.24.0 to v0.25.0:

  • This package now has got full support for interfacing to the most popular cloud environments for fetching resource related information.
  • From what I understood, this package is used for the telemetry information that the collector emits on itself.

We are making a custom, lean build of the collector, embedding it in a resources poor environment so every MB that we can spare counts. I was wondering, would it be possible to make this diverse cloud environments support opt-in, so that they are included only when they are actually needed / used?

Thank you!

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Activity

  1. codeboten commented on Oct 1, 2026

    @codeboten
    Member

    Thanks for the report, this was something that was on my radar with #15869, but I missed that the update of v0.25.0 also bumped the size up.

  2. added
    collector-telemetryhealthchecker and other telemetry collection issues
    and removed
    needs triageNew item requiring triage
    on Oct 1, 2026
  3. self-assigned this
    on Oct 1, 2026
  4. ps-mir commented on Oct 1, 2026

    @ps-mir
    Member

    oletconf(Go Contrib) has added popular cloud resource detectors since July. A sequence of how otelconf size has changed

    otelconf build (added in that release) Collector version Default Stripped Δ vs previous, default Δ vs previous, stripped
    v0.24.0 (baseline, none) v0.155.0–v0.158.0 25.92 MB 17.70 MB n/a n/a
    v0.25.0 (+ecs, azurevm, gcp, eks) v0.159.0–v0.162.0, and main 31.86 MB 21.79 MB +5.94 MB +4.09 MB
    v0.26.0 (+ec2) none yet 36.28 MB 24.95 MB +4.42 MB +3.16 MB

    Analysis done using Claude.

  5. nozomi-gedimitr commented on Oct 1, 2026

    @nozomi-gedimitr
    Author

    The other package whose upgrade has made a significant bump in output size is github.com/felixge/httpsnoop

    • Upgrading from v1.0.4 to v1.1.0 has brought an increase of ~1.3 MB

    Base lean v0.159.0 build

    Doing the same barebones v0.159.0 build as in the description, to get more detailed output binary sizes

    dist:
      name: otelcol-custom
      description: Local OpenTelemetry Collector binary
      output_path: /tmp/dist
    
    exporters:
      - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.159.0
    
    receivers:
      - gomod:  go.opentelemetry.io/collector/receiver/otlpreceiver v0.159.0
    
    processors:
      - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.159.0
    

    The output binary was:

    root@552803a24046:/go# ls -l /tmp/dist/otelcol-custom 
    -rwxr-xr-x 1 root root 31260832 Oct  1 19:28 /tmp/dist/otelcol-custom
    

    Replacing otelconf to 0.24.0

    The same configuration was built, but a replaces section was added to move otelconf to the v0.24.0 release

    ...
    processors:
      - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.159.0
     
    replaces:
      - go.opentelemetry.io/contrib/otelconf => go.opentelemetry.io/contrib/otelconf v0.24.0
    

    The output binary was

    root@552803a24046:/go# ls -l /tmp/dist/otelcol-custom 
    -rwxr-xr-x 1 root root 28115104 Oct  1 19:30 /tmp/dist/otelcol-custom
    

    Replacing also httpsnoop to v1.0.4

    Another line was added in the replaces section to move httpsnoop to v1.0.4

    ...
    processors:
      - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.159.0
     
    replaces:
      - go.opentelemetry.io/contrib/otelconf => go.opentelemetry.io/contrib/otelconf v0.24.0
      - github.com/felixge/httpsnoop => github.com/felixge/httpsnoop v1.0.4
    

    The output binary was

    root@552803a24046:/go# ls -l /tmp/dist/otelcol-custom 
    -rwxr-xr-x 1 root root 26869920 Oct  1 19:32 /tmp/dist/otelcol-custom
    
  6. codeboten commented on Oct 1, 2026

    @codeboten
    Member

    Although this isn't ideal, one option to avoid taking on the additional size for the resource detectors is to use a replace statement at build time, essentially replacing resource detectors via some kind of no-op implementation, something like this:

    package noop
    
    import (
    	"context"
    
    	"go.opentelemetry.io/otel/sdk/resource"
    )
    
    // NewDetector returns a no-op resource detector.
    func NewDetector() resource.Detector {
    	return &detector{}
    }
    
    func NewResourceDetector() resource.Detector {
    	return NewDetector()
    }
    
    func New() resource.Detector {
    	return NewDetector()
    }
    
    type detector struct{}
    
    func (d *detector) Detect(context.Context) (*resource.Resource, error) {
    	return nil, nil
    }
    
    

    And replacing all the detectors in the build file:

    replace go.opentelemetry.io/contrib/detectors/azure/azurevm => ../noopdetector
    

    This approach is kinda hacky but in the short term it might unblock you until a better solution is decided upon. I've added this to the next SIG meeting agenda.

  7. aetherxeg-source commented on Oct 2, 2026

    @aetherxeg-source

    A useful build-integrity invariant here is: component set selected != dependency capability set selected.

    A lean custom distribution can omit every cloud-specific component yet still inherit their transitive detector code, so the binary artifact carries capabilities the distribution never asked for.

    I’d add one reproducible “minimal distribution footprint” test that records both:

    • final stripped binary size;
    • symbol/package provenance for the largest newly linked dependency groups.

    Then a dependency update that increases the minimal artifact beyond a threshold can fail with evidence showing which package families became reachable. That is more actionable than a raw size delta and avoids treating all growth as equivalent.

    The stronger contract is:

    declared distribution features -> reachable dependency graph -> artifact footprint

    with unexpected reachability visible in CI.

    Related runtime-integrity work: https://github.com/AETHERXGLOBAL/execsurface

  8. codeboten commented on Oct 5, 2026

    @codeboten
    Member

    @nozomi-gedimitr i submitted a PR to the otel-go-contrib repo to introduce build tags that would support omitting individual resource detectors: open-telemetry/opentelemetry-go-contrib#9818

  9. iblancasa commented on Nov 16, 2026

    @iblancasa
    Member

    I think this ticket can be closed now, right?

  10. codeboten commented on Nov 16, 2026

    @codeboten
    Member

    @iblancasa correct, the documentation for the builder has been updated to demonstrate how to configure resource detectors: https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder#configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

collector-telemetryhealthchecker and other telemetry collection issues

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions