Skip to content

[Feature] Add sampleType to SampleResult #6762

Description

@i-nahornyi

Use case

There is currently no explicit/documented field in SampleResult that identifies the type of result, such as SAMPLE or TRANSACTION.

The current workaround is to use:

TransactionController.isFromTransactionController(sampleResult)

However, this approach is fragile because transaction detection depends on other SampleResult fields. In particular, it can break when a user redefines the responseMessage of the Transaction Controller with a custom value.

This behavior is also not documented, so users have no way to know that redefining the Transaction Controller's responseMessage can silently break transaction detection.

Possible solution

Add an explicit sampleType field to SampleResult, for example:

public enum SampleType {
    SAMPLE,
    TRANSACTION
}

Then consumers could use:

sampleResult.getSampleType() == SampleType.TRANSACTION

This would provide a reliable way for listeners, backend listeners, plugins, and other consumers to identify the type of a SampleResult.

Possible workarounds

No response

JMeter Version

5.6.3

Java Version

java 17.0.7

OS Version

No response

Activity

  1. i-nahornyi commented on Sep 24, 2026

    @i-nahornyi
    Author

    Hi @cadenwong552,
    I think the simplest approach is to keep the current message check as a fallback.

    If sampleType is present, we use it.
    If it's missing (i.e. null, for example in results from older versions), we fall back to checking the response message, as we do today.

    However, as it touches SampleResult, 6.x.x might be a good place to introduce it: the new field becomes the recommended way to check the type, and the existing logic remains as a fallback for results produced before 6.x.x

    Am I missing something?

  2. LIxyLGy75LhmG commented on Oct 1, 2026

    @LIxyLGy75LhmG

    If we go with the fallback approach, we should encapsulate that logic directly inside `SampleResult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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