forked from criteo-forks/jmx_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support on jmx attributes of type java.util.Date (prometheus#449)
* added support on jmx attributes of type java.util.Date Signed-off-by: jacky <jacky.chen@nzqa.govt.nz> Signed-off-by: jacky <jac.chen@gmail.com>
- Loading branch information
1 parent
12b6a77
commit 189386b
Showing
3 changed files
with
48 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.prometheus.jmx; | ||
|
||
import javax.management.MBeanServer; | ||
import javax.management.ObjectName; | ||
import java.util.Date; | ||
|
||
public interface CamelMBean { | ||
double EXPECTED_SECONDS = 1.573285945111E9; | ||
|
||
Date getLastExchangeFailureTimestamp(); | ||
} | ||
|
||
class Camel implements CamelMBean { | ||
public static void registerBean(MBeanServer mbs) | ||
throws javax.management.JMException { | ||
ObjectName mbeanName = new ObjectName( | ||
"org.apache.camel:context=my-camel-context,type=routes,name=\"my-route-name\""); | ||
Camel mbean = new Camel(); | ||
mbs.registerMBean(mbean, mbeanName); | ||
} | ||
|
||
@Override | ||
public Date getLastExchangeFailureTimestamp() { | ||
return new Date((long)(EXPECTED_SECONDS * 1000)); | ||
} | ||
} |
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