-
Notifications
You must be signed in to change notification settings - Fork 317
Implement embedded git metadata extraction #4951
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
Merged
nikita-tkachenko-datadog
merged 3 commits into
master
from
nikita-tkachenko/source-code-integration-git-info
Apr 3, 2023
Merged
Implement embedded git metadata extraction #4951
nikita-tkachenko-datadog
merged 3 commits into
master
from
nikita-tkachenko/source-code-integration-git-info
Apr 3, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return GitInfo.NOOP; | ||
| } | ||
| return new LocalFSGitInfoExtractor() | ||
| .headCommit(Paths.get(repositoryPath, gitFolderName).toFile().getAbsolutePath()); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
[User-provided value](1) flows to here and is used in a path.
[User-provided value](2) flows to here and is used in a path.
[User-provided value](3) flows to here and is used in a path.
[User-provided value](4) flows to here and is used in a path.
[User-provided value](5) flows to here and is used in a path.
[User-provided value](6) flows to here and is used in a path.
[User-provided value](7) flows to here and is used in a path.
[User-provided value](8) flows to here and is used in a path.
| public class CIProviderGitInfoBuilder implements GitInfoBuilder { | ||
| @Override | ||
| public GitInfo build(@Nullable String repositoryPath) { | ||
| Path currentPath = repositoryPath != null ? Paths.get(repositoryPath) : null; |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
[User-provided value](1) flows to here and is used in a path.
[User-provided value](2) flows to here and is used in a path.
[User-provided value](3) flows to here and is used in a path.
[User-provided value](4) flows to here and is used in a path.
[User-provided value](5) flows to here and is used in a path.
[User-provided value](6) flows to here and is used in a path.
[User-provided value](7) flows to here and is used in a path.
[User-provided value](8) flows to here and is used in a path.
d75e63d to
2e8f19a
Compare
d935208 to
94d72ec
Compare
sashacmc
reviewed
Mar 29, 2023
sashacmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small notes, overall LGTM!
internal-api/src/main/java/datadog/trace/api/git/UserSuppliedGitInfoBuilder.java
Show resolved
Hide resolved
...i-visibility/src/test/groovy/datadog/trace/civisibility/git/CILocalGitInfoBuilderTest.groovy
Outdated
Show resolved
Hide resolved
internal-api/src/test/groovy/datadog/trace/api/git/EmbeddedGitInfoBuilderTest.groovy
Show resolved
Hide resolved
richardstartin
approved these changes
Mar 30, 2023
sashacmc
approved these changes
Apr 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Does This Do
Adds a new component that reads Git metadata from
git.propertiesfile available on the system classpath (clients can configure their Gradle/Maven build to use 3rd-party plugins that embed this file into their JARs).The obtained metadata is then used the following way:
Motivation
This is needed to simplify configuration for clients and to make using Source-Code Integration features easier.
More info can be found in the RFC and the Jira task.
Additional Notes
TraceInterceptormechanism. Using it previously was somewhat error-prone as each interceptor was required to have a unique integer "priority". Ensuring priority uniqueness was difficult as interceptors were scattered across different modules (moreover, clients were capable of injecting their own interceptors). A few minor improvements were done in this PR to alleviate this: priorities of "standard" interceptors were centralised in an enum, and an error log message was added to highlight attempts to register interceptors with the same priority.