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

x-pack/filebeat/input/cel: log transaction ID in CEL evaluations #37065

Merged
merged 2 commits into from
Nov 11, 2023

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Nov 8, 2023

Proposed commit message

Emit a previous transaction ID before starting CEL evaluation and the final ID after completing the work. Also write transaction IDs to CEL debug log call if available.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Run go test -v -run TestInput/tracer_filename_sanitization in the cel package to see transaction IDs in the log.

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added enhancement Filebeat Filebeat Team:Security-External Integrations backport-skip Skip notification from the automated backport with mergify 8.12-candidate labels Nov 8, 2023
@efd6 efd6 self-assigned this Nov 8, 2023
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 8, 2023
@efd6 efd6 force-pushed the cel_tracing_correlation branch from 1925fda to 6bd5182 Compare November 8, 2023 02:37
@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 8, 2023

💚 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

  • Duration: 136 min 17 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 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 the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

Emit a previous transaction ID before starting CEL evaluation and the final ID
after completing the work. Also write transaction IDs to CEL debug log call if
available.
@efd6 efd6 force-pushed the cel_tracing_correlation branch from 6bd5182 to c018dec Compare November 8, 2023 19:48
@efd6 efd6 marked this pull request as ready for review November 9, 2023 06:35
@efd6 efd6 requested a review from a team as a code owner November 9, 2023 06:35
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

Copy link
Contributor

@bhapas bhapas left a comment

Choose a reason for hiding this comment

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

Nits

@@ -167,6 +167,15 @@ func (rt *LoggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, err
return resp, err
}

// TxID returns the current transaction.id value. If rt is nil, the empty string is returned.
func (rt *LoggingRoundTripper) TxID() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to add test cases for this func?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What failure modes are you expecting that can't be proven safe by inspection?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not just about failure scenarios. There is a specific format that is being returned here, so just thought if it is covered in a test to guard against unsafe changes in future. But you can take a call here. This might not change often or at all.

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 think I'm OK with what we have; the two places that return a transaction ID are within 10 lines of each other and are very clearly related. I did think about making them tied, but didn't see a good way to do it. I have that now, so I'll make that change.

@efd6 efd6 merged commit 7ec5ac5 into elastic:main Nov 11, 2023
21 checks passed
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
…stic#37065)

Emit a previous transaction ID before starting CEL evaluation and the final ID
after completing the work. Also write transaction IDs to CEL debug log call if
available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.12-candidate backport-skip Skip notification from the automated backport with mergify enhancement Filebeat Filebeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] CEL - improving request tracing correlation
5 participants