Hi Felix,
Thank you
The Apdex measurement is a request from our development team as it is what they were using before moving our APM from NewRelic to escloud.
To calculate the Apdex score we use the following formula:
SatisfiedCount + (ToleratingCount * 0.5) + (FrustratedCount * 0)
Apdex t = ----------------------------------------------------------------
TotalSamples
The idea is to count requests with satisfactory response time as 1, requests with tolerable response time as 0.5 and requests with response time greater than tolerable as 0 and finally calculate the average. The threshold of a request with the satisfactory time we call t and the tolerable value is defined by 4*t
To implement this formula in elastic, we added a script processor to traces-apm-8.1.2
pipeline that consists of creating a label called apdexscore
, containing the value 1, 0.5 or 0 according to the duration in microseconds of the transaction. We set the t-factor in the script to 800 milliseconds:
[
.
..
{
"script": {
"lang": "painless",
"source": "double apdex_t = 800.0 * 1000;\nif (ctx.labels==null) {\nctx.labels = [:];\n}\nif (ctx.transaction.duration.us <= apdex_t) {\nctx.labels.apdexscore=1.0;\n}\nelse if (ctx.transaction.duration.us <= (apdex_t * 4)) {\nctx.labels.apdexscore=0.5;\n}\nelse {\nctx.labels.apdexscore=0.0;\n}",
"ignore_failure": true
}
},
..
.
]
The formula worked and after creating traces-apm*
dataview, we saw that it gives us the apdex score in the new field labels.apdexscore
. We were even able to create a Dashboard so visualize the apdex score.
Our problem now resides in what pipelines we should implement this formula as there are different APM indexes that might be neccesary to implement and thern create a DataView to visualize all APM indexes. We thought in creating a new pipeline like the following:
PUT /_ingest/pipeline/apdex
{
"description": "ApDex",
"processors": [
{
"script": {
"lang": "painless",
"ignore_failure": true,
"source": """
double apdex_t = 800.0 * 1000;
if (ctx.labels==null) {
ctx.labels = [:];
}
if (ctx.transaction.duration.us <= apdex_t) {
ctx.labels.apdexscore=1.0;
}
else if (ctx.transaction.duration.us <= (apdex_t * 4)) {
ctx.labels.apdexscore=0.5;
}
else {
ctx.labels.apdexscore=0.0;
}
"""
}
}
]
}
and then add it to the apm
pipeline:
{
"pipeline": {
"name": "apdex"
}
}
but it didn't work as expected as apm pipeline doesn't cover all APM indexes.
Do you know how we could proceed on this? Is there a master pipeline that covers all indexes? Or should we add the formula to all APM pipelines?
I attach a list of APM indexes and Data Streams currently in use.
Indexes:
.ds-logs-apm.error-default
.ds-traces-apm.rum-default
.ds-traces-apm-default
.ds-metrics-apm.internal-default
.ds-logs-apm.error-default
Data Streams:
logs-apm.error-default
metrics-apm.internal-default
traces-apm-default
traces-apm.rum-default
Kind Regards