Skip to content

[bug-hunter] OTel Kafka hash partitioner ignores reachable_only when no hash fields are set #50699

Description

@github-actions

Impact

Users configuring the OTel Kafka partitioner with hash mode and reachable_only: true do not get the configured behavior unless they also set hash fields. This silently changes partitioning consistency semantics and can cause blocked/retried publishes against unavailable partitions.

Reproduction Steps

  1. Create x-pack/otel/extension/kafkapartitionerextension/repro_reachable_only_test.go with the following test:
package kafkapartitionerextension

import (
    "testing"

    "github.com/stretchr/testify/assert"
    "github.com/twmb/franz-go/pkg/kgo"
)

func TestHashPartitionerReachableOnlyRespected(t *testing.T) {
    _, tp := getPartitioner(t, map[string]any{
        "hash": map[string]any{
            "reachable_only": true,
        },
    })

    assert.False(
        t,
        tp.RequiresConsistency(&kgo.Record{}),
        "`reachable_only: true` should disable strict consistency requirement",
    )
}
  1. Run:
go test ./x-pack/otel/extension/kafkapartitionerextension -run TestHashPartitionerReachableOnlyRespected -count=1

Expected vs Actual

Expected: reachable_only: true is respected for hash partitioning regardless of whether hash field list is provided.

Actual: Test fails; RequiresConsistency remains true.

Actual output:

--- FAIL: TestHashPartitionerReachableOnlyRespected (0.00s)
    repro_reachable_only_test.go:21:
        Error Trace:    /home/runner/work/beats/beats/x-pack/otel/extension/kafkapartitionerextension/repro_reachable_only_test.go:21
        Error:          Should be false
        Test:           TestHashPartitionerReachableOnlyRespected
        Messages:       `reachable_only: true` should disable strict consistency requirement
FAIL
FAIL    github.com/elastic/beats/v7/x-pack/otel/extension/kafkapartitionerextension    0.007s
FAIL

Failing Test

package kafkapartitionerextension

import (
    "testing"

    "github.com/stretchr/testify/assert"
    "github.com/twmb/franz-go/pkg/kgo"
)

func TestHashPartitionerReachableOnlyRespected(t *testing.T) {
    _, tp := getPartitioner(t, map[string]any{
        "hash": map[string]any{
            "reachable_only": true,
        },
    })

    assert.False(
        t,
        tp.RequiresConsistency(&kgo.Record{}),
        "`reachable_only: true` should disable strict consistency requirement",
    )
}

Evidence

  • x-pack/otel/extension/kafkapartitionerextension/partitioner.go:52-57 parses reachable_only into reachable.Reachable.
  • x-pack/otel/extension/kafkapartitionerextension/partitioner.go:138-140 returns makeHashKgoPartitioner() when len(conf.Hash) == 0, bypassing reachable.
  • x-pack/otel/extension/kafkapartitionerextension/partitioner.go:142-144 applies reachable only when hash fields are configured.
  • x-pack/otel/extension/kafkapartitionerextension/partitioner.go:224 defines consistency semantics via RequiresConsistency(*kgo.Record) bool { return !b.requireConsistency }.

This makes reachable_only effective for one hash code path but ignored for the no-fields hash path.

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • 169.254.169.254

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Note

🔒 Integrity filter blocked 3 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #2626 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #50226 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #12867 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

What is this? | From workflow: Bug Hunter

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

  • expires on May 21, 2026, 11:49 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs_teamIndicates that the issue/PR needs a Team:* label

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions