Skip to content

transaction: Stop recording breakdown metrics#1167

Merged
marclop merged 4 commits intoelastic:masterfrom
marclop:f/stop-recording-transaction-breakdown-metrics
Jan 4, 2022
Merged

transaction: Stop recording breakdown metrics#1167
marclop merged 4 commits intoelastic:masterfrom
marclop:f/stop-recording-transaction-breakdown-metrics

Conversation

@marclop
Copy link
Contributor

@marclop marclop commented Dec 8, 2021

Description

Stops recording the unused transaction breakdown metrics:

  • transaction.duration.{count,sum.us}
  • transaction.breakdown.count

Removes the 4 bytes of padding in breakdownTiming and changes the type
of spanTiming.count from uintptr to uint64, making 32 and 64 bit
architectures span counts equal in size, removing the need for padding.

Related issues

Closes #1139

Stops recording the unused transaction breakdown metrics:
* `transaction.duration.{count,sum.us}`
* `transaction.breakdown.count`

Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@marclop marclop added enhancement New feature or request v8.0.0 labels Dec 8, 2021
)
require.NotNil(t, breakdownTimingObj)
assert.Equal(t, []int{0}, breakdownTimingFieldIndex)
assert.Equal(t, []int{1}, breakdownTimingFieldIndex)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to change the index of the field for the test to pass since I've reordered them.

@ghost
Copy link

ghost commented Dec 8, 2021

💚 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-01-04T03:36:59.767+0000

  • Duration: 33 min 21 sec

  • Commit: 9ac231b

Test stats 🧪

Test Results
Failed 0
Passed 11977
Skipped 279
Total 12256

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

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

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.

LGTM!

breakdown.go Outdated
// have calculated breakdown metrics. If breakdown metrics are
// enabled, this will be equal transaction.count.
breakdownCount uintptr
// Padding to ensure the span field below is 64-bit aligned.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment needs updating. Do we still need the padding? IIRC we want the struct size to be a multiple of 8 bytes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried removing the padding, but on 32-bit architecture the uintptr is 4 bytes rather than 8 (64-bit), making the total struct size 12 bytes in 32-bit architectures instead of the 16 that we get by default on 32-bit architectures.

We could arguably change the implementation to always use an uint64, which gives us a maximum value of 18,446,744,073,709,551,615 which is quite large already, not sure what benefit uintptr would give us since we're not using it for pointer references anyway.

I think switching to uint64 makes sense since instead of allocating padding bytes in memory, we'd use them for the actual count rather than having padding on 32-bit architectures, I'll make the change, but re-request a review from you to make sure we're ok with uint64 vs uintptr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible, and simpler - thanks.

Removes the 4 bytes of padding in `breakdownTiming` and changes the type
of `spanTiming.count` from `uintptr` to `uint64`, making 32 and 64 bit
architectures span counts equal in size, removing the need for padding.

Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@marclop marclop requested a review from axw December 22, 2021 02:32
@marclop marclop marked this pull request as ready for review December 22, 2021 02:32
@marclop marclop enabled auto-merge (squash) January 4, 2022 03:37
@marclop marclop merged commit 7e472e4 into elastic:master Jan 4, 2022
@marclop marclop deleted the f/stop-recording-transaction-breakdown-metrics branch January 4, 2022 04:10
@simitt simitt added this to the 2.0 milestone Feb 9, 2022
@axw axw self-assigned this Feb 10, 2022
@axw
Copy link
Member

axw commented Feb 10, 2022

I don't think this can usefully be tested manually, but I'm open to ideas. The server doesn't record these metrics any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants