You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mod.rs
    path of file: ./repos/surrealdb/src/telemetry/metrics/ws
    
    the code of the file until where you have to start completion: use std::time::Instant;

use once_cell::sync::Lazy;
use opentelemetry::KeyValue;
use opentelemetry::{
	metrics::{Histogram, MetricsError, Unit, UpDownCounter},
	Context as TelemetryContext,
};

use super::{METER_DURATION, METER_SIZE};

pub static RPC_SERVER_DURATION: Lazy<Histogram<u64>> = Lazy::new(|| {
	METER_DURATION
		.u64_histogr
    
pub fn record_rpc(cx: &TelemetryContext, res_size: usize, is_error: bool) {
	let mut attrs = otel_common_attrs();
	let mut duration = 0;
	let mut req_size = 0;

	if let Some(cx) = cx.get::<RequestContext>() {
		attrs.extend_from_slice(&[
			KeyValue::new("rpc.method", cx.method.clone()),
			KeyValue::new("rpc.error", is_error),
		]);
		duration = cx.start.elapsed().as_millis() as u64;
		req_size = cx.size as u64;
	} else if let Some(cx) = cx.get::<NotificationContext>() {
		attrs.extend_from_slice(&[
			KeyValue::new("rpc.method", "notification"),
			KeyValue::new("rpc.error", is_error),
			KeyValue::new("rpc.live_id", cx.live_id.clone()),
		]);
	} else {
		// If a bug causes the RequestContent to be empty, we still want to record the metrics to avoid a silent failure.
		warn!("record_rpc: no request context found, resulting metrics will be invalid");
		attrs.extend_from_slice(&[
			KeyValue::new("rpc.method", "unknown"),
			KeyValue::new("rpc.error", is_error),
		]);
	};

	RPC_SERVER_DURATION.record(cx, duration, &attrs);
	RPC_SERVER_REQUEST_SIZE.record(cx, req_size, &attrs);
	RPC_SERVER_RESPONSE_SIZE.record(cx, res_size as u64, &attrs);
}