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

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