/** * Wrapper method to create new TraceScope with the given description * @return TraceScope or null when not tracing */ public static TraceScope createTrace(String description) { return (tracer == null) ? null : tracer.newScope(description); }
private static void initWorkload(Properties props, Thread warningthread, Workload workload, Tracer tracer) { try { try (final TraceScope span = tracer.newScope(CLIENT_WORKLOAD_INIT_SPAN)) { workload.init(props); warningthread.interrupt(); } } catch (WorkloadException e) { e.printStackTrace(); e.printStackTrace(System.out); System.exit(0); } }
/** * Wrapper method to create new child TraceScope with the given description * and parent scope's spanId * @param span parent span * @return TraceScope or null when not tracing */ public static TraceScope createTrace(String description, Span span) { if(span == null) return createTrace(description); return (tracer == null) ? null : tracer.newScope(description, span.getSpanId()); }
/** * Initialize any state for this DB. * Called once per DB instance; there is one DB instance per client thread. */ public void init() throws DBException { try (final TraceScope span = tracer.newScope(scopeStringInit)) { db.init(); this.reportLatencyForEachError = Boolean.parseBoolean(getProperties(). getProperty(REPORT_LATENCY_FOR_EACH_ERROR_PROPERTY, REPORT_LATENCY_FOR_EACH_ERROR_PROPERTY_DEFAULT)); if (!reportLatencyForEachError) { String latencyTrackedErrorsProperty = getProperties().getProperty(LATENCY_TRACKED_ERRORS_PROPERTY, null); if (latencyTrackedErrorsProperty != null) { this.latencyTrackedErrors = new HashSet<String>(Arrays.asList( latencyTrackedErrorsProperty.split(","))); } } System.err.println("DBWrapper: report latency for each error is " + this.reportLatencyForEachError + " and specific error codes to track" + " for latency are: " + this.latencyTrackedErrors.toString()); } }
/** * Cleanup any state for this DB. * Called once per DB instance; there is one DB instance per client thread. */ public void cleanup() throws DBException { try (final TraceScope span = tracer.newScope(scopeStringCleanup)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); db.cleanup(); long en = System.nanoTime(); measure("CLEANUP", Status.OK, ist, st, en); } }
public FileStatus[] glob() throws IOException { TraceScope scope = tracer.newScope("Globber#glob"); scope.addKVAnnotation("pattern", pathPattern.toUri().getPath()); try { return doGlob(); } finally { scope.close(); } }
try (final TraceScope span = tracer.newScope(CLIENT_INIT_SPAN)) { int opcount; if (dotransactions) {
/** * Create and initialize a new instance of a FileSystem. * @param uri URI containing the FS schema and FS details * @param conf configuration to use to look for the FS instance declaration * and to pass to the {@link FileSystem#initialize(URI, Configuration)}. * @return the initialized filesystem. * @throws IOException problems loading or initializing the FileSystem */ private static FileSystem createFileSystem(URI uri, Configuration conf) throws IOException { Tracer tracer = FsTracer.get(conf); try(TraceScope scope = tracer.newScope("FileSystem#createFileSystem")) { scope.addKVAnnotation("scheme", uri.getScheme()); Class<?> clazz = getFileSystemClass(uri.getScheme(), conf); FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf); fs.initialize(uri, conf); return fs; } }
/** * Delete a record from the database. * * @param table The name of the table * @param key The record key of the record to delete. * @return The result of the operation. */ public Status delete(String table, String key) { try (final TraceScope span = tracer.newScope(scopeStringDelete)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); Status res = db.delete(table, key); long en = System.nanoTime(); measure("DELETE", res, ist, st, en); measurements.reportStatus("DELETE", res); return res; } } }
/** * Read a record from the database. Each field/value pair from the result * will be stored in a HashMap. * * @param table The name of the table * @param key The record key of the record to read. * @param fields The list of fields to read, or null for all of them * @param result A HashMap of field/value pairs for the result * @return The result of the operation. */ public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try (final TraceScope span = tracer.newScope(scopeStringRead)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); Status res = db.read(table, key, fields, result); long en = System.nanoTime(); measure("READ", res, ist, st, en); measurements.reportStatus("READ", res); return res; } }
/** * Insert a record in the database. Any field/value pairs in the specified * values HashMap will be written into the record with the specified * record key. * * @param table The name of the table * @param key The record key of the record to insert. * @param values A HashMap of field/value pairs to insert in the record * @return The result of the operation. */ public Status insert(String table, String key, Map<String, ByteIterator> values) { try (final TraceScope span = tracer.newScope(scopeStringInsert)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); Status res = db.insert(table, key, values); long en = System.nanoTime(); measure("INSERT", res, ist, st, en); measurements.reportStatus("INSERT", res); return res; } }
/** * Update a record in the database. Any field/value pairs in the specified values HashMap will be written into the * record with the specified record key, overwriting any existing values with the same field name. * * @param table The name of the table * @param key The record key of the record to write. * @param values A HashMap of field/value pairs to update in the record * @return The result of the operation. */ public Status update(String table, String key, Map<String, ByteIterator> values) { try (final TraceScope span = tracer.newScope(scopeStringUpdate)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); Status res = db.update(table, key, values); long en = System.nanoTime(); measure("UPDATE", res, ist, st, en); measurements.reportStatus("UPDATE", res); return res; } }
Tracer tracer = Tracer.curThreadTracer(); if (tracer != null) { scope = tracer.newScope("Groups#fetchGroupList"); scope.addKVAnnotation("user", user);
/** * Perform a range scan for a set of records in the database. * Each field/value pair from the result will be stored in a HashMap. * * @param table The name of the table * @param startkey The record key of the first record to read. * @param recordcount The number of records to read * @param fields The list of fields to read, or null for all of them * @param result A Vector of HashMaps, where each HashMap is a set field/value pairs for one record * @return The result of the operation. */ public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try (final TraceScope span = tracer.newScope(scopeStringScan)) { long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); Status res = db.scan(table, startkey, recordcount, fields, result); long en = System.nanoTime(); measure("SCAN", res, ist, st, en); measurements.reportStatus("SCAN", res); return res; } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { long startTime = 0; if (LOG.isDebugEnabled()) { startTime = Time.monotonicNow(); } // if Tracing is on then start a new span for this rpc. // guard it in the if statement to make sure there isn't // any extra string manipulation. Tracer tracer = Tracer.curThreadTracer(); TraceScope traceScope = null; if (tracer != null) { traceScope = tracer.newScope(RpcClientUtil.methodToTraceString(method)); } ObjectWritable value; try { value = (ObjectWritable) client.call(RPC.RpcKind.RPC_WRITABLE, new Invocation(method, args), remoteId, fallbackToSimpleAuth); } finally { if (traceScope != null) traceScope.close(); } if (LOG.isDebugEnabled()) { long callTime = Time.monotonicNow() - startTime; LOG.debug("Call: " + method.getName() + " " + callTime); } return value.get(); }
TraceScope traceScope = null; if (tracer != null) { traceScope = tracer.newScope(RpcClientUtil.methodToTraceString(method));
throw new UnknownCommandException(); TraceScope scope = tracer.newScope(instance.getCommandName()); if (scope.getSpan() != null) { String args = StringUtils.join(" ", argv);
header.getTraceInfo().getTraceId(), header.getTraceInfo().getParentId()); traceScope = tracer.newScope( RpcClientUtil.toTraceName(rpcRequest.toString()), parentSpanId);
private TraceScope continueTraceSpan(DataTransferTraceInfoProto proto, String description) { TraceScope scope = null; SpanId spanId = fromProto(proto); if (spanId != null) { scope = tracer.newScope(description, spanId); } return scope; }