Migrate existing manual instrumentation 🔗
You can migrate manual instrumentation that you added for another vendor to send telemetry data to Splunk RUM. To migrate the instrumentation, you must edit the instrumentation code to use OpenTelemetry conventions.
The following examples shows how you can instrument different data sources for Splunk RUM:
Migrate actions or events instrumentation 🔗
You might have instrumentation that collects custom timestamps or time ranges for activity within your app. For example, you might have manually instrumented a CPU-intensive calculateEstateTax
function to know how its performance is affecting users.
When instrumenting the same function using OpenTelemetry, in addition to capturing start and end time in a span, you can include additional details using attributes:
import {trace} from '@opentelemetry/api'
function calculateEstateTax(estate) {
const span = trace.getTracer('estate').startSpan('calculateEstateTax');
span.setAttribute('estate.jurisdictionCount', estate.jurisdictions.length);
var taxOwed = 0;
// ...
span.setAttribute('isTaxOwed', taxOwed > 0);
span.end();
return taxOwed;
}
Migrate errors instrumentation 🔗
You might have manual instrumentation that reports errors that are collected or handled in your code. To collect and report errors to Splunk RUM, use the SplunkRum.error
function:
try {
doSomething();
} catch (e) {
SplunkRum.error(e);
}
The SplunkRum.error
function accepts strings and arrays of strings, as well as Error
and ErrorEvent
objects. See Errors collected by the Browser RUM agent for more information.