public class Metrics
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLLECT_METRICS_ENV_VARIABLE
The name of the environment variable that sets whether to collect metrics or not
|
static java.lang.String |
METRICS_FILE_SUFFIX
The suffix to use while constructing the name of the metrics file
|
static int |
METRICS_SEND_TIMEOUT
The timeout in seconds for sending the metrics to the server
|
static java.lang.String |
METRICS_SERVER_DEFAULT_URL
The default URL for the metrics server to use
|
private LogManager |
mLogger
The logger object
|
private java.util.List<java.lang.String> |
mMetricsServers
The List of URLS for the metrics servers to report to.
|
private boolean |
mSendMetricsToServer
boolean indicating whether to log metrics or not
|
static java.lang.String |
PRIMARY_METRICS_SERVER_URL_ENV_VARIABLE
The name of the environment variable that overrides the default server url
|
static java.lang.String |
SECONDARY_METRICS_SERVER_URL_ENV_VARIABLE
The name of the environment variable that overrides the default server url
|
Constructor and Description |
---|
Metrics() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(PegasusBag bag)
Initializes the object
|
void |
logMetrics(PlannerMetrics metrics)
Logs the metrics to the metrics server and to the submit directory
|
private void |
sendMetricsAsynchronously(PlannerMetrics metrics,
java.lang.String url)
Sends the planner metrics to the metrics server asynchrnously with a
timeout of 5 seconds
|
private void |
sendMetricsSynchronously(PlannerMetrics metrics,
java.lang.String url)
Sends the planner metrics to the metrics server
|
private java.io.File |
writeOutMetricsFile(PlannerMetrics metrics)
Writes out the workflow metrics file in the submit directory
|
public static final java.lang.String METRICS_FILE_SUFFIX
public static final java.lang.String METRICS_SERVER_DEFAULT_URL
public static final java.lang.String COLLECT_METRICS_ENV_VARIABLE
public static final java.lang.String PRIMARY_METRICS_SERVER_URL_ENV_VARIABLE
public static final java.lang.String SECONDARY_METRICS_SERVER_URL_ENV_VARIABLE
public static final int METRICS_SEND_TIMEOUT
private boolean mSendMetricsToServer
private java.util.List<java.lang.String> mMetricsServers
private LogManager mLogger
public void initialize(PegasusBag bag)
bag
- bag of pegasus objectspublic void logMetrics(PlannerMetrics metrics) throws java.io.IOException
metrics
- java.io.IOException
private java.io.File writeOutMetricsFile(PlannerMetrics metrics) throws java.io.IOException
metrics
- the metrics to be written out.java.io.IOException
- in case of error while writing out file.private void sendMetricsSynchronously(PlannerMetrics metrics, java.lang.String url) throws java.io.IOException
metrics
- the metrics to logurl
- the url to send the metrics tojava.io.IOException
private void sendMetricsAsynchronously(PlannerMetrics metrics, java.lang.String url)
metrics
- the metrics to logurl
- the url to send the metrics to