Skip to content

Commit 3e19ebd

Browse files
committed
chore: Fix indexer warning logs
For logs like ``` [main] WARN datadog.trace.bootstrap.AgentJarIndex - Detected duplicate content 'datadog.trace.civisibility.writer.ddintake.*' under 'trace', already seen in <root>. Ensure your content is under a distinct directory. ```
1 parent 0aff7b0 commit 3e19ebd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static class IndexGenerator extends SimpleFileVisitor<Path> {
9797

9898
private Path prefixRoot;
9999
private int prefixId;
100-
101100
private Map<Integer, String> prefixMappings = new HashMap<>();
102101

103102
IndexGenerator(Path resourcesDir) {
@@ -142,14 +141,15 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
142141
String entryKey = computeEntryKey(prefixRoot.relativize(file));
143142
if (null != entryKey) {
144143
int existingPrefixId = prefixTrie.apply(entryKey);
145-
if (-1 != existingPrefixId && prefixId != existingPrefixId) {
144+
// warn if two subsections contain content under the same package prefix
145+
// because we're then unable to redirect requests to the right submodule
146+
// (ignore the two 'datadog.compiler' packages which allow duplication)
147+
if (existingPrefixId > 0 && prefixId != existingPrefixId) {
146148
log.warn(
147149
"Detected duplicate content '{}' under '{}', already seen in {}. Ensure your content is under a distinct directory.",
148150
entryKey,
149151
resourcesDir.relativize(file).getName(0), // prefix
150-
existingPrefixId == 0
151-
? "<root>"
152-
: prefixMappings.get(existingPrefixId) // previous prefix
152+
prefixMappings.get(existingPrefixId) // previous prefix
153153
);
154154
}
155155
prefixTrie.put(entryKey, prefixId);

0 commit comments

Comments
 (0)