public final class NewRelic
extends java.lang.Object
Constructor and Description |
---|
NewRelic() |
Modifier and Type | Method and Description |
---|---|
static void |
addCustomParameter(java.lang.String key,
java.lang.Number value)
Add a key/value pair to the current transaction.
|
static void |
addCustomParameter(java.lang.String key,
java.lang.String value)
Add a key/value pair to the current transaction.
|
static Agent |
getAgent()
Returns the primary New Relic java agent api.
|
static java.lang.String |
getBrowserTimingFooter()
Get the RUM JavaScript footer for the current web transaction.
|
static java.lang.String |
getBrowserTimingHeader()
Get the RUM JavaScript header for the current web transaction.
|
static void |
ignoreApdex()
Ignore the current transaction for calculating Apdex score.
|
static void |
ignoreTransaction()
Ignore the current transaction.
|
static void |
incrementCounter(java.lang.String name)
Increment the metric counter for the given name.
|
static void |
incrementCounter(java.lang.String name,
int count)
Increment the metric counter for the given name.
|
static void |
noticeError(java.lang.String message)
Notice an error and report it to New Relic.
|
static void |
noticeError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.String> params)
Notice an error and report it to New Relic.
|
static void |
noticeError(java.lang.Throwable throwable)
Report an exception to New Relic.
|
static void |
noticeError(java.lang.Throwable throwable,
java.util.Map<java.lang.String,java.lang.String> params)
Notice an exception and report it to New Relic.
|
static void |
recordMetric(java.lang.String name,
float value)
Record a metric value for the given name.
|
static void |
recordResponseTimeMetric(java.lang.String name,
long millis)
Record a response time in milliseconds for the given metric name.
|
static void |
setAccountName(java.lang.String name)
Set the account name to associate with the RUM JavaScript footer for the current web transaction.
|
static void |
setProductName(java.lang.String name)
Set the product name to associate with the RUM JavaScript footer for the current web transaction.
|
static void |
setRequestAndResponse(Request request,
Response response)
Sets the request and response instances for the current transaction.
|
static void |
setTransactionName(java.lang.String category,
java.lang.String name)
Set the name of the current transaction.
|
static void |
setUserName(java.lang.String name)
Set the user name to associate with the RUM JavaScript footer for the current web transaction.
|
public static Agent getAgent()
public static void recordMetric(java.lang.String name, float value)
name
- The name of the metric. The metric is not recorded if the name is null or the empty string.value
- The value of the metric.public static void recordResponseTimeMetric(java.lang.String name, long millis)
name
- The name of the metric. The response time is not recorded if the name is null or the empty string.millis
- The response time in milliseconds.public static void incrementCounter(java.lang.String name)
name
- The name of the metric to increment.public static void incrementCounter(java.lang.String name, int count)
name
- The name of the metric to increment.count
- The amount in which the metric should be incremented.public static void noticeError(java.lang.Throwable throwable, java.util.Map<java.lang.String,java.lang.String> params)
Note: The key and value pairs in custom parameters params
will be dropped or modified in the
traced error if the key or value, each, cannot be encoded in 255 bytes. If key or value is over this limit, the
behavior will be the same as defined in addCustomParameter
.
throwable
- The throwable to notice and report.params
- Custom parameters to include in the traced error. May be null.public static void noticeError(java.lang.Throwable throwable)
throwable
- The throwable to report.noticeError(Throwable, Map)
public static void noticeError(java.lang.String message, java.util.Map<java.lang.String,java.lang.String> params)
Note: The key and value pairs in custom parameters params
will be dropped or modified in the
traced error if the key or value, each, cannot be encoded in 255 bytes. If key or value is over this limit, the
behavior will be the same as defined in addCustomParameter
.
message
- The error message to be reported.params
- Custom parameters to include in the traced error. May be nullpublic static void noticeError(java.lang.String message)
message
- Message to report with a transaction when it finishes.public static void addCustomParameter(java.lang.String key, java.lang.Number value)
Note: The key and value pair will only be reported if the key argument can be encoded in 255 bytes, encoded with UTF-8 encoding.
key
- Custom parameter key.value
- Custom parameter value.public static void addCustomParameter(java.lang.String key, java.lang.String value)
Note: The key and value pair will only be reported if the key argument can be encoded in 255 bytes, encoded with UTF-8 encoding. The value argument will be truncated, by stripping characters, to fit in 255 bytes, encoded using UTF-8 encoding.
key
- Custom parameter key.value
- Custom parameter value.public static void setTransactionName(java.lang.String category, java.lang.String name)
category
- Metric category. If the input is null, then the default will be used.name
- The name of the transaction starting with a forward slash. example: /store/orderpublic static void ignoreTransaction()
public static void ignoreApdex()
public static void setRequestAndResponse(Request request, Response response)
request
- The current transaction's request.response
- The current transaction's response.public static java.lang.String getBrowserTimingHeader()
public static java.lang.String getBrowserTimingFooter()
public static void setUserName(java.lang.String name)
Note: The user name
argument has a limit of 255 bytes, encoded with UTF-8 encoding. A name
that requires more than 255 bytes will be truncated, by stripping characters, to fit in 255 bytes.
name
- User name to associate with the RUM JavaScript footer.public static void setAccountName(java.lang.String name)
Note: The account name
argument has a limit of 255 bytes, encoded with UTF-8 encoding. A
name
that requires more than 255 bytes will be truncated, by stripping characters, to fit in 255 bytes.
name
- Account name to associate with the RUM JavaScript footer.public static void setProductName(java.lang.String name)
Note: The product name
argument has a limit of 255 bytes, encoded with UTF-8 encoding. A
name
that requires more than 255 bytes will be truncated, by stripping characters, to fit in 255 bytes.
name
- Product name to associate with the RUM JavaScript footer.