-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store outcome values in servicemetrics transaction.success_count
#9791
Store outcome values in servicemetrics transaction.success_count
#9791
Conversation
This pull request does not have a backport label. Could you fix it @carsonip? 🙏
NOTE: |
17a0479
to
9331523
Compare
@@ -115,8 +112,8 @@ func (e *Transaction) fields() mapstr.M { | |||
if e.FailureCount != 0 { | |||
transaction.set("failure_count", e.FailureCount) | |||
} | |||
if e.SuccessCount != 0 { | |||
transaction.set("success_count", e.SuccessCount) | |||
if e.SuccessCount.Count != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should success_count be omitted from output if Count is zero? e.g. when it only contains unknown outcome transactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is not omitted on count=0, transaction.success_count
will have to be a pointer to SummaryMetric, otherwise any event that contains the transaction field will have transaction.success_count.sum: 0
and transaction.success_count.count: 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think omitting when count is zero is the way to go.
356ab25
to
96c6544
Compare
📚 Go benchmark reportDiff with the
report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat |
transaction.success_count
transaction.success_count
transaction.success_count
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We might need to do it for transaction metrics & events too, based on #5243 (comment). That can be another PR (or two), so maybe just remove the "Closes" from the description and follow up?
Changed from "closes" to "related to". Rebasing. |
38efcdf
to
aa4c5a0
Compare
Tested with 8.7.0 BC2 on ESS, ended up asserting that package main
import (
"fmt"
"time"
"go.elastic.co/apm/v2"
)
func main() {
tracer := apm.DefaultTracer()
tracer.SetSpanCompressionEnabled(false) // Disable compression.
tracer.SetExitSpanMinDuration(2 * time.Millisecond) // set duration to 2ms.
for i := 0; i < 10_000; i++ {
for _, duration := range []time.Duration{100, 1000} {
tx := tracer.StartTransaction(fmt.Sprintf("tx-%d", i), fmt.Sprintf("type-%d", i))
tx.Duration = time.Duration(duration) * time.Millisecond
if i%2 == 0 {
tx.Outcome = "success"
} else {
tx.Outcome = "failure"
}
tx.End()
if i%800 == 0 {
tracer.Flush(nil)
}
}
}
tracer.Flush(nil)
fmt.Printf("%+v\n", tracer.Stats())
} #!/bin/bash
export ELASTIC_APM_SERVER_URL=${1:-"http://localhost:8200"}
export ELASTIC_APM_GLOBAL_LABELS=department_name=apm,organization=observability,company=elastic
export ELASTIC_APM_SERVICE_NAME=apm
go run main.go
export ELASTIC_APM_GLOBAL_LABELS=department_name=fleet-server,organization=observability,company=elastic
export ELASTIC_APM_SERVICE_NAME=fleet-server
go run main.go
export ELASTIC_APM_GLOBAL_LABELS=department_name=kibana,organization=platform,company=elastic
export ELASTIC_APM_SERVICE_NAME=kibana
go run main.go success
failure
|
Motivation/summary
For service metrics, use field
transaction.success_count
to store the transaction success and failure counts for easier avg aggregation on the field.Checklist
apmpackage
have been made)How to test these changes
transaction.success_count
is populated correctlytransaction.success_count
Related issues
Related to #5243