Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

posthog-rails logs: /i/v1/logs returns JSON {} to protobuf OTLP requests, causing ExportLogsServiceResponse decode ERROR on every export

未关闭
#291 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
ruby
领域
api, backend

调研方向

The report identifies the /i/v1/logs ingestion endpoint and the OTLP logs exporter as the relevant entry points, but does not name repository files or tests. Start by tracing how the endpoint handles application/x-protobuf requests and compare its response with the OTLP/HTTP expectation described here. Done means protobuf requests receive a valid protobuf response (or an empty body) with the appropriate content type, without triggering the exporter decode error.

由索引模型根据 Issue 内容生成。

描述

bug team/logs

Summary

With config.logs_enabled = true, posthog-rails sets up OpenTelemetry::Exporter::OTLP::Logs::LogsExporter pointed at https://us.i.posthog.com/i/v1/logs. The exporter sends Content-Type: application/x-protobuf, but the endpoint replies 200 with content-type: application/json and a body of {}. The exporter then tries to decode that body as a protobuf ExportLogsServiceResponse and fails, which logs an ERROR on every batch export.

Environment

  • Ruby 3.3
  • posthog-ruby 3.23.x
  • posthog-rails 3.18.6
  • opentelemetry-exporter-otlp-logs 0.6.0 (latest)
  • opentelemetry-logs-sdk 0.8.0

Repro

curl -s -D - -X POST https://us.i.posthog.com/i/v1/logs \
  -H 'Content-Type: application/x-protobuf' \
  -H 'Authorization: Bearer phc_test' \
  --data-binary @/dev/null

Response:

HTTP/2 200
content-type: application/json
content-length: 2

{}

On a 2xx response the exporter calls log_partial_success(response.body), which runs ExportLogsServiceResponse.decode("{}") and raises Google::Protobuf::ParseError. Every export then logs:

ERROR -- : OpenTelemetry error: unexpected error decoding ExportLogsServiceResponse in OTLP::Exporter#log_partial_success - Error occurred during parsing - .../opentelemetry-exporter-otlp-logs-0.6.0/lib/opentelemetry/exporter/otlp/logs/logs_exporter.rb:246:in 'decode'

Expected vs actual

  • Expected: Per the OTLP/HTTP spec, the response uses the request's Content-Type, so a protobuf request gets back a protobuf-encoded ExportLogsServiceResponse. An empty body is a valid empty message. No error is logged.
  • Actual: The JSON {} body causes an ERROR-level log line on every batch export from every process. Records are still ingested, because the exporter has already returned SUCCESS. But the noise is constant and hides real export failures.

Suggested fix

  • Ingestion endpoint: for application/x-protobuf requests, return an empty body or a protobuf-encoded ExportLogsServiceResponse with content-type: application/x-protobuf.
  • Until then, posthog-rails could install a scoped OpenTelemetry.error_handler filter for this specific decode error, or document the noise.
主要语言
Ruby
星标
37
派生
34
平均合并
20 小时 30 分钟
30 天内合并 PR
24

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PostHog/posthog-ruby 的其他 Issue

查看 PostHog/posthog-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。