Skip to content

[connector/count] Default count config not work #41769

@Frapschen

Description

@Frapschen

Component(s)

connector/count

What happened?

Description

running otel collector with this config:

exporters:
  debug:
    verbosity: basic
  prometheus:
    endpoint: "0.0.0.0:1234"
connectors:
  count:
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
        cors:
          allowed_origins:
            - http://*
service:
  telemetry:
    logs:
      level: "info"
  pipelines:
    traces:
      exporters:
        - debug
        - count
      receivers:
        - otlp
    metrics:
      exporters:
        - prometheus
      receivers:
        - count

After sending some spans to this collector. No count metrics are generated from countconnector

I found that the Unmarshal function isn't executed when the collector starts.

func (c *Config) Unmarshal(componentParser *confmap.Conf) error {
if componentParser == nil {
// Nothing to do if there is no config given.
return nil
}
if err := componentParser.Unmarshal(c, confmap.WithIgnoreUnused()); err != nil {
return err
}
if !componentParser.IsSet("spans") {
c.Spans = defaultSpansConfig()
}
if !componentParser.IsSet("spanevents") {
c.SpanEvents = defaultSpanEventsConfig()
}
if !componentParser.IsSet("metrics") {
c.Metrics = defaultMetricsConfig()
}
if !componentParser.IsSet("datapoints") {
c.DataPoints = defaultDataPointsConfig()
}
if !componentParser.IsSet("logs") {
c.Logs = defaultLogsConfig()
}
if !componentParser.IsSet("profiles") {
c.Profiles = defaultProfilesConfig()
}
return nil
}

Steps to Reproduce

Expected Result

The countconnector works as the doc said:

The count connector may be used without any configuration settings. The following table describes the
default behavior of the connector.

Collector version

main

Environment information

Environment

dev

OpenTelemetry Collector configuration

Log output

Additional context

No response

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions