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

Refactor trace exporter to utilize enrollment details from knapsack #2122

Merged
merged 3 commits into from
Feb 26, 2025

Conversation

cesarfda
Copy link
Contributor

This pull request includes significant changes to the TraceExporter class and related tests, focusing on removing the dependency on the osqueryClient and refactoring the way attributes are added from enrollment details.

Resolves #2076

Refactoring TraceExporter:

  • Removed the osqueryClient dependency from TraceExporter and related methods. (pkg/traces/exporter/exporter.go) [1] [2]
  • Changed the method addAttributesFromOsquery to use enrollment details instead of querying osquery. (pkg/traces/exporter/exporter.go)
  • Updated the initialization of TraceExporter to call addAttributesFromOsquery directly. (pkg/traces/exporter/exporter.go)

Test Updates:

  • Removed mocks and expectations related to osqueryClient from tests. (pkg/traces/exporter/exporter_test.go) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Updated test cases to use GetEnrollmentDetails for providing necessary attributes. (pkg/traces/exporter/exporter_test.go) [1] [2] [3]

Minor Cleanup:

  • Removed unused imports and variables. (pkg/traces/exporter/exporter.go) [1] [2] [3]
  • Removed the SetOsqueryClient method and related calls. (pkg/traces/exporter/exporter.go)

These changes streamline the TraceExporter class by eliminating the need for an osqueryClient and leveraging enrollment details directly, simplifying the code and improving maintainability.

Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

Nice! Looks much simpler

Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

LGTM!

@cesarfda cesarfda added this pull request to the merge queue Feb 26, 2025
Merged via the queue into main with commit fc90f93 Feb 26, 2025
32 checks passed
@cesarfda cesarfda deleted the enrollment-details-trace branch February 26, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trace exporter should pull osquery details from cached enrollment details instead of querying
2 participants