use of com.couchbase.client.core.msg.kv.SyncDurabilityRequest in project couchbase-jvm-clients by couchbase.
the class TracingUtils method setCommonKVSpanAttributes.
/**
* Sets attributes that are usefully duplicated across multiple spans.
*/
public static void setCommonKVSpanAttributes(final RequestSpan span, final KeyValueRequest<Response> request) {
CollectionIdentifier collectionIdentifier = request.collectionIdentifier();
if (collectionIdentifier != null) {
span.attribute(TracingIdentifiers.ATTR_NAME, collectionIdentifier.bucket());
span.attribute(TracingIdentifiers.ATTR_SCOPE, collectionIdentifier.scope().orElse(CollectionIdentifier.DEFAULT_SCOPE));
span.attribute(TracingIdentifiers.ATTR_COLLECTION, collectionIdentifier.collection().orElse(CollectionIdentifier.DEFAULT_COLLECTION));
}
span.attribute(TracingIdentifiers.ATTR_DOCUMENT_ID, new String(request.key()));
if (request instanceof SyncDurabilityRequest) {
SyncDurabilityRequest syncDurabilityRequest = (SyncDurabilityRequest) request;
if (syncDurabilityRequest.durabilityLevel() != null) {
span.attribute(TracingIdentifiers.ATTR_DURABILITY, syncDurabilityRequest.durabilityLevel().map(Enum::name).orElse(DurabilityLevel.NONE.name()));
}
}
}
Aggregations