File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed 
jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ /* 
2+  * Copyright The OpenTelemetry Authors 
3+  * SPDX-License-Identifier: Apache-2.0 
4+  */ 
5+ 
6+ package  io .opentelemetry .contrib .jmxscraper .target_systems ;
7+ 
8+ import  io .opentelemetry .contrib .jmxscraper .JmxScraperContainer ;
9+ import  io .opentelemetry .contrib .jmxscraper .TestAppContainer ;
10+ import  java .nio .file .Path ;
11+ import  org .testcontainers .containers .GenericContainer ;
12+ import  org .testcontainers .containers .wait .strategy .Wait ;
13+ 
14+ public  class  CustomIntegrationTest  extends  TargetSystemIntegrationTest  {
15+ 
16+   @ Override 
17+   protected  GenericContainer <?> createTargetContainer (int  jmxPort ) {
18+     // reusing test application for custom yaml 
19+     //noinspection resource 
20+     return  new  TestAppContainer ()
21+         .withJmxPort (jmxPort )
22+         .withExposedPorts (jmxPort )
23+         .waitingFor (Wait .forListeningPorts (jmxPort ));
24+   }
25+ 
26+   @ Override 
27+   protected  JmxScraperContainer  customizeScraperContainer (
28+       JmxScraperContainer  scraper , GenericContainer <?> target , Path  tempDir ) {
29+     // only testing custom yaml 
30+     return  scraper .withCustomYaml ("custom-metrics.yaml" );
31+   }
32+ 
33+   @ Override 
34+   protected  MetricsVerifier  createMetricsVerifier () {
35+     return  MetricsVerifier .create ()
36+         // custom metric in custom-metrics.yaml 
37+         .add (
38+             "custom.jvm.uptime" ,
39+             metric  ->
40+                 metric 
41+                     .hasDescription ("JVM uptime in milliseconds" )
42+                     .hasUnit ("ms" )
43+                     .isCounter ()
44+                     .hasDataPointsWithoutAttributes ());
45+   }
46+ }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments