Skip to content

[receiver/otlpreceiver] Option to omit detailed error response #14072

@locmai

Description

@locmai

Component(s)

receiver/otlp

Is your feature request related to a problem? Please describe.

In some environment setups, exposing detailed error information in server responses can present security and privacy risks. As we are exposing our opentelemetry-collector to some external vendors, we have this risk evaluated and the error responses include some detailed on the implementations.

Describe the solution you'd like

  • Introduce a new configuration parameter (e.g., suppress_error_details) for the otlpreceiver.
  • When this option is enabled, the otlpreceiver should respond to client errors with a generic error message, omitting stack traces, internal error codes, or other detailed information.
  • The default behavior should remain unchanged to preserve backward compatibility.
receivers:
  otlp:
    protocols:
      http:
        suppress_error_details: true

Describe alternatives you've considered

We have considered to have a proxy and override over the responses but would prefer a built-in option would reduce the need for external components or workarounds.

Additional context

We simply

curl -i -X POST https://example.com/otlp/v1/metrics \
  -H "Content-Type: application/json" \
  -d '{
    "resourceMetrics": [
      {
        "resource": {
          "attributes": [
            { "key": "service.name", "value": { "stringValue": "example-service" } }
          ]
        },
        "scopeMetrics": [
          {
            "metrics": [
              {
                "name": "broken_histogram_metric",
                "description": "A histogram with wrong bucket type",
                "unit": "1",
                "histogram": {
                  "dataPoints": [
                    {
                      "attributes": [],
                      "startTimeUnixNano": "1690000000000000000",
                      "timeUnixNano": "1690000001000000000",
                      "count": 3,
                      "sum": 42.0,
                      "bucketCounts": [1, 2, 0],
                      "explicitBounds": ["a", "b"]
                    }
                  ],
                  "aggregationTemporality": 2
                }
              }
            ]
          }
        ]
      }
    ]
  }'

And got the response with the detailed message about the ReadUint64:

{"code":3,"message":"ReadUint64: strconv.ParseFloat: parsing \"a\": invalid syntax, error found in #10 byte of ...|nds\": [\"a\", \"b\"]\n   |..., bigger context ...|, 0],\n                      \"explicitBounds\": [\"a\", \"b\"]\n                    }\n                  ],\n|..."}% 

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions