55import org .datadog .jmxfetch .service .ConfigServiceNameProvider ;
66import org .datadog .jmxfetch .service .ServiceNameProvider ;
77import org .datadog .jmxfetch .util .InstanceTelemetry ;
8- import org .snakeyaml .engine .v2 .api .Load ;
9- import org .snakeyaml .engine .v2 .api .LoadSettings ;
8+ import org .yaml .snakeyaml .Yaml ;
9+
10+
1011
1112import java .io .File ;
1213import java .io .FileInputStream ;
@@ -42,12 +43,11 @@ public class Instance {
4243 public static final String JVM_DIRECT = "jvm_direct" ;
4344 public static final String ATTRIBUTE = "Attribute: " ;
4445
45- private static final ThreadLocal <Load > YAML =
46- new ThreadLocal <Load >() {
46+ private static final ThreadLocal <Yaml > YAML =
47+ new ThreadLocal <Yaml >() {
4748 @ Override
48- public Load initialValue () {
49- LoadSettings settings = LoadSettings .builder ().build ();
50- return new Load (settings );
49+ public Yaml initialValue () {
50+ return new Yaml ();
5151 }
5252 };
5353
@@ -295,9 +295,9 @@ public static boolean isDirectInstance(Map<String, Object> configInstance) {
295295 }
296296
297297 private void loadDefaultConfig (String configResourcePath ) {
298- InputStream is = this . getClass (). getResourceAsStream ( configResourcePath );
299- List < Map < String , Object >> defaultConf = (List <Map <String , Object >>)
300- YAML .get ().loadFromInputStream ( is );
298+ List < Map < String , Object >> defaultConf =
299+ (List <Map <String , Object >>)
300+ YAML .get ().load ( this . getClass (). getResourceAsStream ( configResourcePath ) );
301301 for (Map <String , Object > conf : defaultConf ) {
302302 configurationList .add (new Configuration (conf ));
303303 }
@@ -321,7 +321,7 @@ static void loadMetricConfigFiles(
321321 yamlInputStream = new FileInputStream (yamlPath );
322322 List <Map <String , Object >> confs =
323323 (List <Map <String , Object >>)
324- YAML .get ().loadFromInputStream (yamlInputStream );
324+ YAML .get ().load (yamlInputStream );
325325 for (Map <String , Object > conf : confs ) {
326326 configurationList .add (new Configuration (conf ));
327327 }
@@ -360,7 +360,7 @@ static void loadMetricConfigResources(
360360 try {
361361 Map <String , List <Map <String , Object >>> topYaml =
362362 (Map <String , List <Map <String , Object >>>)
363- YAML .get ().loadFromInputStream (inputStream );
363+ YAML .get ().load (inputStream );
364364 List <Map <String , Object >> jmxConf =
365365 topYaml .get ("jmx_metrics" );
366366 if (jmxConf != null ) {
0 commit comments