NewRelic recordMetricWithName:(NSString *)name category:(NSString *)category value:(NSNumber *)value]; NewRelic.recordMetricWithName(name: String!, category: String!, value: NSNumber!)
Compatible with all agent versions.
With this method, you can record arbitrary custom metrics to give more detail about app activity that is not tracked by New Relic automatically. The call accepts several sets of parameters for optional levels of detail.
This method will record a metric of the form
Custom/[Category]/[Name], with a count of 1 and a total value equal to the value passed in. Multiple calls will aggregate the count and value according to standard metric aggregation rules for New Relic Mobile.
To get the most out of your metrics, follow these guidelines to create clear, concise metric names:
- Use case and whitespace characters appropriate for display in the user interface. Metric names are rendered as-is.
- Capitalize the metric name.
- Avoid using the characters
/ ] [ | *when naming metrics.
- Avoid multi-byte characters.
category is also required; it is displayed in the UI and is useful for organizing custom metrics if you have many of them. It can be a custom category or it can be a predefined category using the
To view your custom metrics, use Insights Metric Explorer to search metrics, create customizable charts, and add those charts to Insights dashboards.
For variations that accept additional arguments and give you more control over the metrics you record, see NewRelic.h. For more information about using this API, see the iOS SDK API usage guide.
|Required. The name for the custom metric.|
|Required. The metric category name, either custom or using a predefined metric category.|
|Required. The value of the metric.|
[NewRelic recordMetricWithName:(NSString *)name category:(NSString *)category value:(NSNumber *)value];
[NewRelic recordMetricWithName:(NSString *)@"My Important Metric (in milliseconds)" category:(NSString *)@"Important Metrics" value:(NSNumber *)145.67];
NewRelic.recordMetricWithName(name: String!, category: String!, value: NSNumber!)
NewRelic.recordMetricName(name: "My Important Metric (in milliseconds)", category: "Important Metrics", value: 145.67)