I want to get the average number of request per second(or minute) for performance testing data, but the basic aggregation possibilities i've found so far doesn't cover this.
I could only do a count on a field, but that only gives me the total number of requests/documents. For my problem what required is putting document in bucket on time period base and the do an average on them. Probably nesting 2 aggregations, like this:
"aggs": {
"sample_rate_per_second": {
"date_histogram": {
"field": "date",
"fixed_interval": "1s"
}
}
}
and this
"aggs": {
"avg_sample_rate": { "avg": { "field": "fieldname" } }
}
Can you please help me out how to do it?
This is the query i've got so far:
GET jmeter-result/_search
{
"query": {
"bool": {
"filter": {
"term": { "test_run_id": "somerunid" }
},
"must": {
"query_string": {
"query": "somethreadname",
"default_field": "ThreadName"
}
}
}
},
"aggs": {
"percentiles": {
"percentiles": {
"field": "ResponseTime"
}
},
"total_requests": {
"value_count": {
"field" : "ResponseCode.keyword"
}
},
"allowed_requests": {
"filter": {
"term": {
"ResponseCode.keyword": "ALLOWED"
}
},"aggs": {
"count": {
"value_count": {
"field": "ResponseCode.keyword"
}
}
}
},
"denied_requests": {
"filter": {
"term": {
"ResponseCode.keyword": "DENIED"
}
},"aggs": {
"count": {
"value_count": {
"field": "ResponseCode.keyword"
}
}
}
},
"failed_requests": {
"filter": {
"term": {
"ResponseCode.keyword": "FAILURE"
}
},"aggs": {
"count": {
"value_count": {
"field": "ResponseCode.keyword"
}
}
}
}
}
}
And this is how a document looks like:
{
"_index": "jmeter-result",
"_type": "_doc",
"_id": "RhYwFYMBeBBV0OlLtsCK",
"_score": 1,
"_source": {
"test_run_id": "run112",
"ResponseCode": "ALLOWED",
"component.name": "componentname",
"IdleTime": 0,
"ErrorCount": 0,
"Timestamp": "2022-09-07T01:44:17.239+0200",
"Latency": 9,
"Bytes": 114,
"SentBytes": 0,
"job_name": "elasticfieldjobname",
"BodySize": 114,
"TestElement.name": "Thread-6",
"ThreadName": "jp@gc - Ultimate Thread Group - First 1-1",
"ResponseTime": 501,
"FailureMessage": "",
"test_plan_name": "testplanname",
"SampleLabel": "jp@gc - Dummy Sampler",
"test_case": "elasticfieldtestcase"
},
"fields": {
"test_case.keyword": [
"elasticfieldtestcase"
],
"ThreadName.keyword": [
"jp@gc - Ultimate Thread Group - First 1-1"
],
"IdleTime": [
0
],
"ErrorCount": [
0
],
"Timestamp": [
"2022-09-06T23:44:17.239Z"
],
"Bytes": [
114
],
"component.name.keyword": [
"raz"
],
"SentBytes": [
0
],
"TestElement.name": [
"Thread-6"
],
"FailureMessage.keyword": [
""
],
"ResponseTime": [
501
],
"FailureMessage": [
""
],
"test_plan_name": [
"testplanname"
],
"test_case": [
"elasticfieldtestcase"
],
"test_run_id": [
"run112"
],
"test_run_id.keyword": [
"run112"
],
"ResponseCode": [
"ALLOWED"
],
"component.name": [
"raz"
],
"TestElement.name.keyword": [
"Thread-6"
],
"ResponseCode.keyword": [
"ALLOWED"
],
"Latency": [
9
],
"job_name": [
"elasticfieldjobname"
],
"job_name.keyword": [
"elasticfieldjobname"
],
"BodySize": [
114
],
"ThreadName": [
"jp@gc - Ultimate Thread Group - First 1-1"
],
"SampleLabel.keyword": [
"jp@gc - Dummy Sampler"
],
"SampleLabel": [
"jp@gc - Dummy Sampler"
],
"test_plan_name.keyword": [
"testplanname"
]
}
}
Thank you!