-
Notifications
You must be signed in to change notification settings - Fork 527
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
Service metrics txn events txn metrics #9819
Service metrics txn events txn metrics #9819
Conversation
This pull request is now in conflicts. Could you fix it @carsonip? 🙏
|
This pull request does not have a backport label. Could you fix it @carsonip? 🙏
NOTE: |
190900f
to
ceeca21
Compare
📚 Go benchmark reportDiff with the
report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat |
633ae5a
to
abfbdbd
Compare
Keeping this in draft during review since it will have to go with elastic/apm-data#2 |
28cef68
to
a0200d6
Compare
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 great! Just one minor comment.
apmpackage/apm/data_stream/traces/elasticsearch/ingest_pipeline/default.yml
Outdated
Show resolved
Hide resolved
This pull request is now in conflicts. Could you fix it @carsonip? 🙏
|
a0200d6
to
5a4373a
Compare
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.
Code mostly looks good, left a couple minor comments.
Please reflect that this PR depends on elastic/apm-data#2 in the description.
@@ -11,6 +11,7 @@ https://github.com/elastic/apm-server/compare/8.5\...main[View commits] | |||
- `observer.id` and `observer.ephemeral_id` are no longer added to APM documents {pull}9412[9412] | |||
- `timeseries.instance` has been removed from transaction metrics docs; it was never used {pull}9565[9565] | |||
- `transaction.failure_count` has been removed. `transaction.success_count` type has changed to `aggregated_metric_double` {pull}9791[9791] | |||
- `transaction.success_count` has been moved to `event.success_count` {pull}9819[9819] |
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.
The changelog is missing that event.success_count
has been introduced also for transaction events and transaction metrics. This changelog should contain all changes made to APM Server.
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.
Updated changelog, but split the part about transaction events and transaction metrics outside "breaking changes".
apmpackage/apm/data_stream/traces/elasticsearch/ingest_pipeline/default.yml
Show resolved
Hide resolved
This pull request is now in conflicts. Could you fix it @carsonip? 🙏
|
641e5db
to
47c03e4
Compare
@carsonip the PR looks pretty solid - are you planning on marking it ready for review soon? |
Was trying to squash locally before making it ready for review but got into some local permission errors which I thought we fixed yesterday. Anyway, can do a squash merge after approval. |
Co-authored-by: Marc Lopez Rubio <marc5.12@outlook.com>
Merged, to unblock @marclop who is working on a PR touching the same code base. |
Thanks @simitt |
Tested with
Code used for generating traces for testingpackage 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 < 100; 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()
}
}
tracer.Flush(nil)
} Check that event.success_count is correct for transaction event, transaction metrics and service metricsTransaction EventsAsserted that the metric is recorded as SuccessGET /traces-apm-default*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"event.outcome": "success"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-traces-apm-default-2023.03.06-000001",
"_id": "flwTtYYBNtUXE48ncG4T",
"_score": 4.617365,
"_source": {},
"fields": {
"event.success_count": [
1
]
}
}
]
}
} FailureGET /traces-apm-default*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"event.outcome": "failure"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-traces-apm-default-2023.03.06-000001",
"_id": "gFwTtYYBNtUXE48ncG4T",
"_score": 9.915409,
"_source": {},
"fields": {
"event.success_count": [
0
]
}
}
]
}
} Transaction MetricsAsserted that the metric is recorded as SuccessGET /metrics-apm.transaction*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"event.outcome": "success"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-metrics-apm.transaction.1m-default-2023.03.06-000001",
"_id": "aFwUtYYBNtUXE48nDm9C",
"_score": 0.69894236,
"_source": {},
"fields": {
"event.success_count": [
{
"sum": 2,
"value_count": 2
}
]
}
}
]
}
} FailureGET /metrics-apm.transaction*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"event.outcome": "failure"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-metrics-apm.transaction.1m-default-2023.03.06-000001",
"_id": "alwUtYYBNtUXE48nDm9C",
"_score": 0.7566507,
"_source": {},
"fields": {
"event.success_count": [
{
"sum": 0,
"value_count": 2
}
]
}
}
]
}
} Service Transaction MetricsAsserted that the metric is recorded as SuccessGET /metrics-apm.service_transaction*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"transaction.type": "type-2"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-metrics-apm.service_transaction.1m-default-2023.03.06-000001",
"_id": "olwUtYYBNtUXE48nDm9C",
"_score": 4.2731586,
"_source": {},
"fields": {
"event.success_count": [
{
"sum": 2,
"value_count": 2
}
]
}
}
]
}
} FailureGET /metrics-apm.service_transaction*/_search?filter_path=hits.hits
{
"size": 1,
"query": {
"bool": {
"must": [
{"match": {"transaction.type": "type-1"}},
{"match": {"service.name": "apm2"}}
]
}
},
"_source": [false],
"fields": [
"event.success_count"
]
} {
"hits": {
"hits": [
{
"_index": ".ds-metrics-apm.service_transaction.1m-default-2023.03.06-000001",
"_id": "l1wUtYYBNtUXE48nDm9C",
"_score": 4.2731586,
"_source": {},
"fields": {
"event.success_count": [
{
"sum": 0,
"value_count": 2
}
]
}
}
]
}
} Check that they work with avg aggregationTransaction EventsGET /traces-apm-default*/_search?filter_path=aggregations
{
"size": 1,
"aggs": {
"err_rate": {
"filter": {
"term": {
"service.name": "apm2"
}
},
"aggs": {
"err_rate": {"avg": { "field": "event.success_count" }}
}
}
}
} {
"aggregations": {
"err_rate": {
"doc_count": 200,
"err_rate": {
"value": 0.5
}
}
}
} Transaction MetricsGET /metrics-apm.transaction*/_search?filter_path=aggregations
{
"size": 1,
"aggs": {
"err_rate": {
"filter": {
"term": {
"service.name": "apm2"
}
},
"aggs": {
"err_rate": {"avg": { "field": "event.success_count" }}
}
}
}
} {
"aggregations": {
"err_rate": {
"doc_count": 200,
"err_rate": {
"value": 0.5
}
}
}
} Service Transaction MetricsGET /metrics-apm.service_transaction*/_search?filter_path=aggregations
{
"size": 1,
"aggs": {
"err_rate": {
"filter": {
"term": {
"service.name": "apm2"
}
},
"aggs": {
"err_rate": {"avg": { "field": "event.success_count" }}
}
}
}
} {
"aggregations": {
"err_rate": {
"doc_count": 200,
"err_rate": {
"value": 0.5
}
}
}
} Ensure event.success_count.sum is rounded under sampling setupAsserted via test case. |
Motivation/summary
Add
event.success_count
to transaction events, transaction metrics and service metrics. It was previously available for service metrics attransaction.success_count
by #9791Checklist
apmpackage
have been made)How to test these changes
event.success_count
is correct for transaction event, transaction metrics and service metricsRelated issues
Closes #5243