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

[APPSEC-8957] Populate remote client cached_target_files payload field #2771

Merged
merged 5 commits into from
Apr 13, 2023

Conversation

GustavoCaso
Copy link
Member

@GustavoCaso GustavoCaso commented Apr 11, 2023

The cached_target_files field intends to signal to the agent what files the tracer has seen and subsequent requests. We do not have to pull that information from the agent.

We can retrieve that information from the repository.contents

To do that, we have to tweak a little the different remote configuration components. The Digest and DigestList are no longer private classes under Target.
We will use the Digest class to compute the hash value of the content on demand and store that information on the Content instances. That way, we do not have to calculate the hash of the content over an over.

Another quick addition is adding support for :sha512. The remote configuration backend supports hashing the content using that algorithm.

@GustavoCaso GustavoCaso requested a review from a team April 11, 2023 14:19
@github-actions github-actions bot added the core Involves Datadog core libraries label Apr 11, 2023
@GustavoCaso GustavoCaso requested a review from lloeki April 11, 2023 14:19
@GustavoCaso GustavoCaso force-pushed the remote-populate-config-states branch from 84d7359 to b2b6f18 Compare April 12, 2023 16:34
@GustavoCaso GustavoCaso force-pushed the remote-populate-config-states branch from b2b6f18 to 0d50196 Compare April 12, 2023 21:02
Copy link
Contributor

@lloeki lloeki left a comment

Choose a reason for hiding this comment

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

Barring from the #hash conflict issue this looks OK.

lib/datadog/core/remote/configuration/content.rb Outdated Show resolved Hide resolved
lib/datadog/core/remote/configuration/content.rb Outdated Show resolved Hide resolved
lib/datadog/core/remote/configuration/content.rb Outdated Show resolved Hide resolved
lib/datadog/core/remote/configuration/repository.rb Outdated Show resolved Hide resolved
lib/datadog/core/remote/configuration/repository.rb Outdated Show resolved Hide resolved
lib/datadog/core/remote/configuration/repository.rb Outdated Show resolved Hide resolved
- Make sure Digest.hexdigest rewinds data
- Calculate repository state at initialize
- Improve config_states generation
- Rename Content#hash to Content#hexdigest
@GustavoCaso GustavoCaso merged commit f523ddd into master Apr 13, 2023
151 checks passed
@GustavoCaso GustavoCaso deleted the remote-populate-config-states branch April 13, 2023 10:59
@github-actions github-actions bot added this to the 1.11.0 milestone Apr 13, 2023
GustavoCaso added a commit that referenced this pull request Apr 14, 2023
On the previous PR #2771
we populate `config_states` but we wanted to populate `cached_target_files`.

I validated this changes works against our system-tests
@lloeki lloeki modified the milestones: 1.11.0, 1.11.0.beta1 Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants