-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenTelemetry extension rewrite supporting Autoconfiguration
- Loading branch information
Showing
115 changed files
with
2,503 additions
and
669 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
45 changes: 45 additions & 0 deletions
45
...loyment/src/main/java/io/quarkus/opentelemetry/deployment/DefaultConfigExtractorUtil.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import io.quarkus.deployment.configuration.definition.ClassDefinition; | ||
import io.quarkus.deployment.configuration.definition.RootDefinition; | ||
|
||
public class DefaultConfigExtractorUtil { | ||
|
||
public static Map<String, String> extractDefaultKeyValues(final RootDefinition rootDefinition) { | ||
Map<String, String> pathsAndValues = new HashMap<>(); | ||
if (rootDefinition == null) { | ||
return pathsAndValues; | ||
} | ||
Iterable<ClassDefinition.ClassMember> members = rootDefinition.getMembers(); | ||
for (ClassDefinition.ClassMember member : members) { | ||
extractPaths("" + rootDefinition.getPrefix() + "." + rootDefinition.getRootName(), pathsAndValues, member); | ||
} | ||
return pathsAndValues; | ||
} | ||
|
||
private static void extractPaths(String path, Map<String, String> pathsAndValues, ClassDefinition.ClassMember member) { | ||
String propertyName = path + "." + member.getPropertyName(); | ||
|
||
if (member instanceof ClassDefinition.ItemMember) { | ||
// leaf | ||
String defaultValue = ((ClassDefinition.ItemMember) member).getDefaultValue(); | ||
if (defaultValue == null) { | ||
return; | ||
} | ||
pathsAndValues.put(propertyName, defaultValue); | ||
return; | ||
} else if (member instanceof ClassDefinition.GroupMember) { | ||
// continue to next nodes | ||
Iterable<ClassDefinition.ClassMember> members = ((ClassDefinition.GroupMember) member).getGroupDefinition() | ||
.getMembers(); | ||
for (ClassDefinition.ClassMember nextMember : members) { | ||
extractPaths(propertyName, pathsAndValues, nextMember); | ||
} | ||
} else { | ||
//Resource attributes | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../deployment/src/main/java/io/quarkus/opentelemetry/deployment/OpenTelemetryBuildItem.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.quarkus.builder.item.SimpleBuildItem; | ||
import io.quarkus.runtime.RuntimeValue; | ||
|
||
public final class OpenTelemetryBuildItem extends SimpleBuildItem { | ||
|
||
private final RuntimeValue<OpenTelemetry> value; | ||
|
||
public OpenTelemetryBuildItem(RuntimeValue<OpenTelemetry> value) { | ||
this.value = value; | ||
} | ||
|
||
public RuntimeValue<OpenTelemetry> getValue() { | ||
return value; | ||
} | ||
} |
This file contains 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
Oops, something went wrong.