Skip to content
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

Merged

Conversation

carsonip
Copy link
Member

@carsonip carsonip commented Dec 12, 2022

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

How to test these changes

  1. Ensure that service metrics transaction.success_count is populated correctly
  2. Try an avg aggregation on transaction.success_count

Related issues

Related to #5243

@mergify
Copy link
Contributor

mergify bot commented Dec 12, 2022

This pull request does not have a backport label. Could you fix it @carsonip? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.x is the label to automatically backport to the 7.x branch.
  • backport-7./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Dec 12, 2022
@apmmachine
Copy link
Contributor

apmmachine commented Dec 12, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-13T13:34:48.065+0000

  • Duration: 25 min 24 sec

Test stats 🧪

Test Results
Failed 0
Passed 153
Skipped 0
Total 153

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate and publish the docker images.

  • /test windows : Build & tests on Windows.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@carsonip carsonip force-pushed the service-metrics-transaction-success-count branch 4 times, most recently from 17a0479 to 9331523 Compare December 12, 2022 14:21
@@ -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 {
Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Member

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.

@carsonip carsonip force-pushed the service-metrics-transaction-success-count branch 4 times, most recently from 356ab25 to 96c6544 Compare December 12, 2022 14:46
@carsonip carsonip changed the title Add service metrics transaction.success_count Store aggregated outcome in servicemetrics transaction.success_count Dec 12, 2022
@apmmachine
Copy link
Contributor

apmmachine commented Dec 12, 2022

📚 Go benchmark report

Diff with the main branch

name                                                                                              old time/op     new time/op     delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
ContextReset/X-Forwarded-For_ipv4-12                                                                  618ns ±39%      842ns ±10%   +36.25%  (p=0.032 n=5+5)
pkg:github.com/elastic/apm-server/internal/processor/stream goos:linux goarch:amd64
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/errors_2.ndjson-12                       22.6µs ± 7%     30.5µs ±22%   +34.83%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/invalid-event.ndjson-12                  10.9µs ± 3%     11.4µs ± 5%    +5.36%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/invalid-metadata-2.ndjson-12             1.76µs ±15%     1.58µs ± 3%    -9.83%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metadata.ndjson-12                       4.37µs ± 2%     4.59µs ± 8%    +5.09%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/otel-bridge.ndjson-12                    3.93µs ± 1%     3.77µs ± 1%    -4.10%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/ratelimit.ndjson-12                      7.55µs ±11%     6.32µs ± 4%   -16.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/span-links.ndjson-12                     1.63µs ± 1%     1.56µs ± 1%    -3.96%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/spans.ndjson-12                          11.4µs ± 1%     10.7µs ± 1%    -6.30%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions.ndjson-12                   11.3µs ± 1%     11.0µs ± 2%    -2.76%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans.ndjson-12             11.2µs ± 1%     10.6µs ± 1%    -5.67%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans_rum.ndjson-12         2.08µs ± 1%     1.99µs ± 2%    -4.41%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans_rum_2.ndjson-12       2.01µs ± 2%     1.92µs ± 2%    -4.53%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12              7.47µs ± 2%     7.11µs ± 2%    -4.77%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors.ndjson-12                       7.65µs ± 5%     6.95µs ± 3%    -9.14%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_2.ndjson-12                     7.20µs ± 3%     6.72µs ± 5%    -6.63%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_rum.ndjson-12                   2.17µs ± 7%     1.96µs ± 1%    -9.83%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_transaction_id.ndjson-12        5.58µs ± 1%     5.34µs ± 1%    -4.30%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/events.ndjson-12                       14.0µs ± 6%     13.1µs ± 2%    -6.87%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/heavy.ndjson-12                         623µs ±20%      500µs ± 3%   -19.75%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-event-type.ndjson-12            839ns ± 3%      806ns ± 1%    -3.93%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-event.ndjson-12                3.45µs ± 2%     3.31µs ± 1%    -4.09%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-json-event.ndjson-12           1.12µs ± 2%     1.09µs ± 1%    -2.78%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-json-metadata.ndjson-12        1.93µs ± 0%     1.86µs ± 1%    -3.29%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-metadata.ndjson-12              489ns ± 1%      493ns ± 0%    +0.82%  (p=0.032 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/logs.ndjson-12                         5.73µs ± 2%     5.39µs ± 4%    -6.06%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/metadata.ndjson-12                     1.41µs ± 6%     1.25µs ± 1%   -11.56%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/metricsets.ndjson-12                   4.66µs ±12%     4.39µs ± 0%    -5.94%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/minimal-service.ndjson-12              1.10µs ±12%     0.97µs ± 1%   -11.93%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/minimal.ndjson-12                      2.15µs ±11%     1.98µs ± 2%    -7.69%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/otel-bridge.ndjson-12                  3.63µs ± 8%     3.19µs ± 0%   -12.12%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/ratelimit.ndjson-12                    5.89µs ± 4%     5.60µs ± 3%    -4.94%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/span-links.ndjson-12                   1.30µs ±10%     1.19µs ± 1%    -8.41%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/spans.ndjson-12                        11.5µs ± 9%      9.3µs ± 4%   -18.54%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions-huge_traces.ndjson-12     5.48µs ± 4%     4.61µs ± 2%   -15.86%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions.ndjson-12                 10.7µs ± 3%      9.4µs ± 4%   -12.11%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans.ndjson-12           11.2µs ± 3%      9.3µs ± 2%   -16.81%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum.ndjson-12       1.90µs ± 3%     1.59µs ± 1%   -16.47%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum_2.ndjson-12     1.82µs ± 5%     1.53µs ± 1%   -16.40%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/unknown-span-type.ndjson-12            6.81µs ± 7%     6.04µs ± 2%   -11.24%  (p=0.008 n=5+5)
ReadBatch/errors_2.ndjson-12                                                                         30.3µs ± 2%    103.0µs ±14%  +240.23%  (p=0.016 n=4+5)
ReadBatch/invalid-event.ndjson-12                                                                    17.2µs ± 6%     32.0µs ±25%   +86.18%  (p=0.008 n=5+5)
ReadBatch/invalid-json-event.ndjson-12                                                               4.92µs ±20%    12.46µs ±14%  +153.39%  (p=0.008 n=5+5)
ReadBatch/metricsets.ndjson-12                                                                       44.1µs ±29%     67.6µs ±23%   +53.19%  (p=0.032 n=5+5)
ReadBatch/minimal-service.ndjson-12                                                                  7.57µs ±48%    12.81µs ±23%   +69.18%  (p=0.016 n=5+5)
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
AggregateTransaction-12                                                                              84.8ns ± 1%     83.9ns ± 0%    -1.06%  (p=0.016 n=5+4)
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ShardedWriteTransactionContended-12                                                                  5.71µs ±17%     7.26µs ±21%   +27.22%  (p=0.032 n=5+5)
IsTraceSampled/unsampled-12                                                                          68.3ns ± 5%     71.3ns ± 5%    +4.47%  (p=0.016 n=5+5)

name                                                                                              old alloc/op    new alloc/op    delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/processor/stream goos:linux goarch:amd64
BackendProcessor/events.ndjson-12                                                                    40.6kB ± 1%     40.1kB ± 1%    -1.33%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/logs.ndjson-12                           20.9kB ± 1%     21.1kB ± 1%    +0.85%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/optional-timestamps.ndjson-12            5.27kB ± 1%     5.34kB ± 1%    +1.35%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/ratelimit.ndjson-12                      12.2kB ± 1%     12.4kB ± 2%    +1.71%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_rum.ndjson-12                   8.01kB ± 0%     8.39kB ± 1%    +4.73%  (p=0.016 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/metricsets.ndjson-12                   14.0kB ± 1%     13.9kB ± 0%    -0.70%  (p=0.032 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/otel-bridge.ndjson-12                  11.3kB ± 4%     11.7kB ± 0%    +2.79%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/spans.ndjson-12                        29.0kB ± 1%     29.9kB ± 2%    +3.13%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions-huge_traces.ndjson-12     14.9kB ± 1%     15.5kB ± 1%    +3.85%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions.ndjson-12                 26.4kB ± 1%     27.3kB ± 1%    +3.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans.ndjson-12           23.9kB ± 0%     25.0kB ± 1%    +4.32%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum.ndjson-12       5.87kB ± 2%     6.24kB ± 1%    +6.33%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum_2.ndjson-12     5.69kB ± 1%     6.13kB ± 1%    +7.75%  (p=0.008 n=5+5)
ReadBatch/invalid-json-event.ndjson-12                                                               3.23kB ± 0%     3.23kB ± 0%    -0.03%  (p=0.029 n=4+4)
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ReadEvents/json_codec_big_tx/399_events-12                                                           2.22MB ± 0%     2.22MB ± 0%    +0.15%  (p=0.008 n=5+5)

name                                                                                              old allocs/op   new allocs/op   delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/processor/stream goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64

name                                                                                              old speed       new speed       delta
pkg:github.com/elastic/apm-server/internal/processor/stream goos:linux goarch:amd64
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/errors_2.ndjson-12                      209MB/s ± 8%    158MB/s ±19%   -24.60%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/invalid-event.ndjson-12                70.6MB/s ± 3%   67.0MB/s ± 5%    -5.04%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/invalid-metadata-2.ndjson-12            250MB/s ±13%    276MB/s ± 3%   +10.34%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metadata.ndjson-12                      284MB/s ± 2%    271MB/s ± 7%    -4.71%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/otel-bridge.ndjson-12                   479MB/s ± 1%    500MB/s ± 1%    +4.27%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/ratelimit.ndjson-12                     560MB/s ±12%    667MB/s ± 4%   +19.09%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/span-links.ndjson-12                    419MB/s ± 1%    436MB/s ± 1%    +4.13%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/spans.ndjson-12                         706MB/s ± 1%    753MB/s ± 1%    +6.72%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions.ndjson-12                  499MB/s ± 1%    513MB/s ± 2%    +2.85%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans.ndjson-12            518MB/s ± 1%    549MB/s ± 1%    +6.01%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans_rum.ndjson-12        555MB/s ± 1%    580MB/s ± 2%    +4.63%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans_rum_2.ndjson-12      555MB/s ± 2%    582MB/s ± 2%    +4.76%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12             443MB/s ± 2%    465MB/s ± 2%    +5.01%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors.ndjson-12                      830MB/s ± 5%    913MB/s ± 3%   +10.01%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_2.ndjson-12                    655MB/s ± 3%    702MB/s ± 5%    +7.14%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_rum.ndjson-12                  874MB/s ± 7%    968MB/s ± 1%   +10.78%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/errors_transaction_id.ndjson-12       685MB/s ± 1%    716MB/s ± 1%    +4.50%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/events.ndjson-12                      530MB/s ± 5%    569MB/s ± 1%    +7.26%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/heavy.ndjson-12                       655MB/s ±19%    798MB/s ± 3%   +21.80%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-event-type.ndjson-12          466MB/s ± 3%    485MB/s ± 1%    +4.06%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-event.ndjson-12               222MB/s ± 2%    231MB/s ± 1%    +4.25%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-json-event.ndjson-12          522MB/s ± 2%    537MB/s ± 1%    +2.87%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-json-metadata.ndjson-12       232MB/s ± 0%    240MB/s ± 1%    +3.41%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/invalid-metadata.ndjson-12            912MB/s ± 1%    904MB/s ± 0%    -0.82%  (p=0.032 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/logs.ndjson-12                        612MB/s ± 2%    651MB/s ± 4%    +6.51%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/metadata.ndjson-12                    881MB/s ± 6%    994MB/s ± 1%   +12.86%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/metricsets.ndjson-12                  548MB/s ±11%    580MB/s ± 0%    +5.93%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/minimal-service.ndjson-12             389MB/s ±11%    438MB/s ± 1%   +12.66%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/minimal.ndjson-12                     482MB/s ±10%    521MB/s ± 2%    +8.03%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/otel-bridge.ndjson-12                 520MB/s ± 8%    590MB/s ± 0%   +13.41%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/ratelimit.ndjson-12                   715MB/s ± 4%    752MB/s ± 3%    +5.16%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/span-links.ndjson-12                  528MB/s ±10%    575MB/s ± 1%    +8.84%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/spans.ndjson-12                       705MB/s ± 8%    864MB/s ± 4%   +22.46%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions-huge_traces.ndjson-12    579MB/s ± 4%    687MB/s ± 2%   +18.76%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions.ndjson-12                529MB/s ± 3%    602MB/s ± 4%   +13.80%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans.ndjson-12          522MB/s ± 3%    627MB/s ± 2%   +20.19%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum.ndjson-12      608MB/s ± 3%    727MB/s ± 1%   +19.68%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/transactions_spans_rum_2.ndjson-12    612MB/s ± 5%    732MB/s ± 1%   +19.54%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel200/unknown-span-type.ndjson-12           487MB/s ± 7%    547MB/s ± 2%   +12.49%  (p=0.008 n=5+5)
ReadBatch/errors_2.ndjson-12                                                                        156MB/s ± 2%     46MB/s ±14%   -70.18%  (p=0.016 n=4+5)
ReadBatch/invalid-event.ndjson-12                                                                  44.6MB/s ± 6%   24.4MB/s ±21%   -45.39%  (p=0.008 n=5+5)
ReadBatch/invalid-json-event.ndjson-12                                                              120MB/s ±17%     48MB/s ±15%   -60.27%  (p=0.008 n=5+5)
ReadBatch/metricsets.ndjson-12                                                                     60.2MB/s ±26%   38.5MB/s ±26%   -35.97%  (p=0.032 n=5+5)
ReadBatch/minimal-service.ndjson-12                                                                68.6MB/s ±57%   33.9MB/s ±20%   -50.67%  (p=0.016 n=5+5)

report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat

@carsonip carsonip marked this pull request as ready for review December 12, 2022 15:26
@carsonip carsonip requested a review from axw December 12, 2022 15:26
@carsonip carsonip changed the title Store aggregated outcome in servicemetrics transaction.success_count Store aggregated outcome in servicemetrics transaction.success_count Dec 13, 2022
@carsonip carsonip changed the title Store aggregated outcome in servicemetrics transaction.success_count Store outcome values in servicemetrics transaction.success_count Dec 13, 2022
Copy link
Member

@axw axw left a 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?

@carsonip
Copy link
Member Author

carsonip commented Dec 13, 2022

Changed from "closes" to "related to". Rebasing.

@carsonip carsonip force-pushed the service-metrics-transaction-success-count branch from 38efcdf to aa4c5a0 Compare December 13, 2022 13:34
@carsonip carsonip merged commit 5518321 into elastic:main Dec 13, 2022
@marclop marclop self-assigned this Feb 20, 2023
@marclop
Copy link
Contributor

marclop commented Feb 20, 2023

Tested with 8.7.0 BC2 on ESS, ended up asserting that event.success_count is set, not transaction.success_count (to be tested in #9819).

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

GET /metrics-apm.transaction*/_search?filter_path=hits.hits
{
  "size": 1,
  "query": {"match": {
    "event.outcome": "success"
  }},
  "_source": [false],
  "fields": [
    "event.success_count"
  ]
}
{
  "hits": {
    "hits": [
      {
        "_index": ".ds-metrics-apm.transaction.1m-default-2023.02.20-000001",
        "_id": "ua1ybYYBZ-vqtropmhfS",
        "_score": 0.6926468,
        "_source": {},
        "fields": {
          "event.success_count": [
            {
              "sum": 2,
              "value_count": 2
            }
          ]
        }
      }
    ]
  }
}

failure

GET /metrics-apm.transaction*/_search?filter_path=hits.hits
{
  "size": 1,
  "query": {"match": {
    "event.outcome": "failure"
  }},
  "_source": [false],
  "fields": [
    "event.success_count"
  ]
}
{
  "hits": {
    "hits": [
      {
        "_index": ".ds-metrics-apm.transaction.1m-default-2023.02.20-000001",
        "_id": "tq1ybYYBZ-vqtropmhfS",
        "_score": 0.69364774,
        "_source": {},
        "fields": {
          "event.success_count": [
            {
              "sum": 0,
              "value_count": 2
            }
          ]
        }
      }
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify test-plan test-plan-ok v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants