Use the <mark>
tag to highlight areas of a code block that are particularly important. Most commonly, <mark>
is used to highlight New Relic API methods in sample code that contains a lot of "other logic." When you use <mark>
, you should usually follow the code block with a list of bullets that explain what each API call is doing and link to method syntax. For more context on when to use <mark>
tags, see <mark> formatting guidelines.
Examples:
Example of using the <mark>
tag
private void storeItem(long id) {
Segment segment = NewRelic.getAgent().getTransaction().startSegment("storeItem");
segment.reportAsExternal(DatastoreParameters
.product("H2")
.collection(null)
.operation("insert")
.instance("localhost", 8080)
.databaseName("test")
.build());
// fire and forget
DB_POOL.submit(() -> {
segment.end();
insertData(id);
});
}
The agent API calls in this sample are:
startSegment(...)
: Begins the segment that will time the code. For method syntax, see the Javadoc.reportAsExternal(DatastoreParameters())
: Associates the time with a datastore external call This will show up in APM with datastore data. For more information, see reportAsExternal API. For method syntax, see the Javadoc.segment.end()
: Stops timing this segment. For method syntax, see the Javadoc.