Skip to content

[receiver/libhoney] /1/events seems to only support array of events, not the object of event, which is not correct. #44026

@howardyoo

Description

@howardyoo

Component(s)

receiver/libhoney

What happened?

Description

In the Honeycomb's API doc, there is a distinction between submitting something as an event and batch of events in here:

Therefore, libhoney receiver also has a similar endpoint of having /1/events and /1/batch, similar to how Honeycomb's API endpoint is structured. However, when submitting a single event, a parsing error happens, which prevents one from submitting a single event at all.

Steps to Reproduce

Run a collector using the following receiver defined, and added to the pipeline.

receivers:
  libhoney:
    http:
      endpoint: 0.0.0.0:8080
      traces_url_paths:
        - "/1/events"
        - "/1/batch"
      include_metadata: true
    auth_api: https://api.honeycomb.io
    fields:
      resources:
        service_name: service_name
      scopes:
        library_name: library.name
        library_version: library.version
      attributes:
        trace_id: trace_id
        parent_id: parent_id
        span_id: span_id
        name: name
        error: error
        spankind: span.kind
        durationFields:
          - duration_ms

Now, submit a simple event into /1/events endpoint.

curl -i -X POST \
  'http://localhost:8080/1/events/browser' \
  -H 'Content-Type: application/json' \
  -H 'X-Honeycomb-Event-Time: 0' \
  -H 'X-Honeycomb-Samplerate: 0' \
  -H 'X-Honeycomb-Team: <API_KEY>' \
  -d '{    "method": "GET",    "endpoint": "/foo",    "shard": "users",     "duration_ms": 32  }'

Expected Result

HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 04 Nov 2025 12:16:54 GMT
Content-Length: 16

[{"status":202}]

Actual Result

HTTP/1.1 503 Service Unavailable
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Tue, 04 Nov 2025 12:16:24 GMT
Content-Length: 164

json: cannot unmarshal object into Go value of type []libhoneyevent.LibhoneyEvent
json: cannot unmarshal object into Go value of type []libhoneyevent.LibhoneyEvent

Collector version

v0.133.0

Environment information

Environment

OS: MacOS 15.6.1

OpenTelemetry Collector configuration

receivers:
  libhoney:
    http:
      endpoint: 0.0.0.0:8080
      traces_url_paths:
        - "/1/events"
        - "/1/batch"
      include_metadata: true
    auth_api: https://api.honeycomb.io
    fields:
      resources:
        service_name: service_name
      scopes:
        library_name: library.name
        library_version: library.version
      attributes:
        trace_id: trace_id
        parent_id: parent_id
        span_id: span_id
        name: name
        error: error
        spankind: span.kind
        durationFields:
          - duration_ms

Log output

2025-11-04T06:19:51.784-0600	error	http/server.go:3638	http: superfluous response.WriteHeader call from go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request.(*RespWriterWrapper).writeHeader (resp_writer_wrapper.go:83)	{"resource": {"service.instance.id": "cc1e0969-d3bc-4fd3-86bc-4c76bd63bc57", "service.name": "otelcol-contrib", "service.version": "0.133.0"}, "otelcol.component.id": "libhoney", "otelcol.component.kind": "receiver", "otelcol.signal": "traces"}
net/http.(*Server).logf
	net/http/server.go:3638
net/http.(*response).WriteHeader
	net/http/server.go:1201
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request.(*RespWriterWrapper).writeHeader
	go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/internal/request/resp_writer_wrapper.go:83
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request.(*RespWriterWrapper).WriteHeader
	go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/internal/request/resp_writer_wrapper.go:71
github.com/felixge/httpsnoop.(*rw).WriteHeader
	github.com/felixge/[email protected]/wrap_generated_gteq_1.8.go:372
net/http.Error
	net/http/server.go:2325
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/errorutil.HTTPError
	github.com/open-telemetry/opentelemetry-collector-contrib/internal/[email protected]/errorutil/http.go:16
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver.(*libhoneyReceiver).handleEvent
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:259
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver.(*libhoneyReceiver).startHTTPServer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:78
net/http.HandlerFunc.ServeHTTP
	net/http/server.go:2294
net/http.(*ServeMux).ServeHTTP
	net/http/server.go:2822
go.opentelemetry.io/collector/config/confighttp.(*decompressor).ServeHTTP
	go.opentelemetry.io/collector/config/[email protected]/compression.go:272
go.opentelemetry.io/collector/config/confighttp.(*ServerConfig).ToServer.maxRequestBodySizeInterceptor.func2
	go.opentelemetry.io/collector/config/[email protected]/server.go:350
net/http.HandlerFunc.ServeHTTP
	net/http/server.go:2294
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*middleware).serveHTTP
	go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:180
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.NewMiddleware.func1.1
	go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:67
net/http.HandlerFunc.ServeHTTP
	net/http/server.go:2294
go.opentelemetry.io/collector/config/confighttp.(*clientInfoHandler).ServeHTTP
	go.opentelemetry.io/collector/config/[email protected]/clientinfohandler.go:26
net/http.serverHandler.ServeHTTP
	net/http/server.go:3301
net/http.(*conn).serve
	net/http/server.go:2102

Additional context

the same data payload in array mode somehow works, such as

curl -i -X POST \
  'http://localhost:8080/1/batch/browser' \ 
  -H 'Content-Type: application/json' \
  -H 'X-Honeycomb-Event-Time: 0' \
  -H 'X-Honeycomb-Samplerate: 0' \
  -H 'X-Honeycomb-Team: <API_KEY>' \
  -d '[{
    "method": "GET",
    "endpoint": "/foo",
    "shard": "users",
    "duration_ms": 32
  }]'

which is not what it's supposed to do. for any array of events, /1/batch is the correct endpoint.

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions