@@ -46,21 +46,13 @@ static OpenTelemetryConfigurationModel extractModel(ConfigurableEnvironment envi
46
46
private static OpenTelemetryConfigurationModel getModel (
47
47
ConfigurableEnvironment environment , OriginTrackedMapPropertySource source )
48
48
throws IOException {
49
- String name = source .getName ();
50
- System .out .println ("Property Source: " + name ); // todo remove
51
- Matcher matcher = PATTERN .matcher (name );
49
+ Matcher matcher = PATTERN .matcher (source .getName ());
52
50
if (matcher .matches ()) {
53
51
String file = matcher .group (1 );
54
- System .out .println ("Found application.yaml: " + file );
55
52
56
53
try (InputStream resourceAsStream =
57
54
environment .getClass ().getClassLoader ().getResourceAsStream (file )) {
58
- // Print the contents of the application.yaml file
59
55
if (resourceAsStream != null ) {
60
- // String content = new String(resourceAsStream.readAllBytes());
61
- // System.out.println("Contents of " + file + ":"); // todo remove
62
- // System.out.println(content); // todo remove
63
-
64
56
return extractOtelConfigFile (resourceAsStream );
65
57
} else {
66
58
throw new IllegalStateException ("Unable to load " + file + " in the classpath." );
@@ -88,21 +80,11 @@ private static String parseOtelNode(InputStream in) {
88
80
}
89
81
90
82
private static OpenTelemetryConfigurationModel extractOtelConfigFile (InputStream content ) {
91
- //
92
- // https://github.com/open-telemetry/opentelemetry-configuration/blob/c205770a956713e512eddb056570a99737e3383a/examples/kitchen-sink.yaml#L11
93
-
94
- // 1. read to yaml tree in jackson
95
- // ObjectMapper yamlMapper = new ObjectMapper(new YAMLFactory());
96
- // JsonNode rootNode = yamlMapper.readTree(content);
97
-
98
83
String node = parseOtelNode (content );
99
84
if (node == null || node .isEmpty ()) {
100
85
throw new IllegalStateException ("otel node is empty or null in the YAML file." );
101
86
}
102
87
103
- System .out .println ("OpenTelemetry configuration file content:" ); // todo remove
104
- System .out .println (node ); // todo remove
105
-
106
88
return DeclarativeConfiguration .parse (
107
89
new ByteArrayInputStream (node .getBytes (StandardCharsets .UTF_8 )));
108
90
}
0 commit comments