Skip to content

Commit 99139bb

Browse files
sarahchen6mcculls
andauthored
Add log warning in AgentJarIndex if an entryKey has multiple prefixIds. (#8434)
* Add log warning if entryKey has multiple prefixIds. * Only warn if prefixId changes. * Improve log warning to describe the situation instead of the state. * Update log warning message. Co-authored-by: Stuart McCulloch <[email protected]> --------- Co-authored-by: Stuart McCulloch <[email protected]>
1 parent 5b04538 commit 99139bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/AgentJarIndex.java

+6
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
142142
if (null != prefixRoot) {
143143
String entryKey = computeEntryKey(prefixRoot.relativize(file));
144144
if (null != entryKey) {
145+
int existingPrefixId = prefixTrie.apply(entryKey);
146+
if (-1 != existingPrefixId && prefixId != existingPrefixId) {
147+
log.warn(
148+
"Detected duplicate content under '{}'. Ensure your content is under a distinct directory.",
149+
entryKey);
150+
}
145151
prefixTrie.put(entryKey, prefixId);
146152
if (entryKey.endsWith("*")) {
147153
// optimization: wildcard will match everything under here so can skip

0 commit comments

Comments
 (0)