summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Branca <chewbranca@apache.org>2020-03-18 13:02:50 -0700
committerRussell Branca <chewbranca@apache.org>2020-03-18 13:02:50 -0700
commit41be92bb94bc2b5bdc4070d3f48a6e27179ca154 (patch)
tree3851e1b7aaf159346947e036f5494da2dfacfac0
parent301db96fd7a9ab12f0fd787ee6cfeadf6c212c50 (diff)
downloadcouchdb-41be92bb94bc2b5bdc4070d3f48a6e27179ca154.tar.gz
-rw-r--r--src/fabric/src/fabric2_fdb.erl43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 403b5bb53..6f9373936 100644
--- a/src/fabric/src/fabric2_fdb.erl
+++ b/src/fabric/src/fabric2_fdb.erl
@@ -503,24 +503,30 @@ incr_stat(#{} = Db, Section, Key, Increment) when is_integer(Increment) ->
get_all_revs(#{} = Db, DocId) ->
- #{
- tx := Tx,
- db_prefix := DbPrefix
- } = ensure_current(Db),
-
- Prefix = erlfdb_tuple:pack({?DB_REVS, DocId}, DbPrefix),
- Options = [{streaming_mode, want_all}],
- Future = erlfdb:get_range_startswith(Tx, Prefix, Options),
- lists:map(fun({K, V}) ->
- Key = erlfdb_tuple:unpack(K, DbPrefix),
- Val = erlfdb_tuple:unpack(V),
- fdb_to_revinfo(Key, Val)
- end, erlfdb:wait(Future)).
+ DbName = maps:get(name, Db, undefined),
+ with_span('db.get_all_revs', #{'db.name' => DbName, 'doc.id' => DocId}, fun() ->
+ #{
+ tx := Tx,
+ db_prefix := DbPrefix
+ } = ensure_current(Db),
+
+ Prefix = erlfdb_tuple:pack({?DB_REVS, DocId}, DbPrefix),
+ Options = [{streaming_mode, want_all}],
+ Future = erlfdb:get_range_startswith(Tx, Prefix, Options),
+ lists:map(fun({K, V}) ->
+ Key = erlfdb_tuple:unpack(K, DbPrefix),
+ Val = erlfdb_tuple:unpack(V),
+ fdb_to_revinfo(Key, Val)
+ end, erlfdb:wait(Future))
+ end).
get_winning_revs(Db, DocId, NumRevs) ->
- Future = get_winning_revs_future(Db, DocId, NumRevs),
- get_winning_revs_wait(Db, Future).
+ DbName = maps:get(name, Db, undefined),
+ with_span('db.get_winning_revs', #{'db.name' => DbName, 'doc.id' => DocId}, fun() ->
+ Future = get_winning_revs_future(Db, DocId, NumRevs),
+ get_winning_revs_wait(Db, Future)
+ end).
get_winning_revs_future(#{} = Db, DocId, NumRevs) ->
@@ -566,8 +572,11 @@ get_non_deleted_rev(#{} = Db, DocId, RevId) ->
get_doc_body(Db, DocId, RevInfo) ->
- Future = get_doc_body_future(Db, DocId, RevInfo),
- get_doc_body_wait(Db, DocId, RevInfo, Future).
+ DbName = maps:get(name, Db, undefined),
+ with_span('db.get_doc_body', #{'db.name' => DbName, 'doc.id' => DocId}, fun() ->
+ Future = get_doc_body_future(Db, DocId, RevInfo),
+ get_doc_body_wait(Db, DocId, RevInfo, Future)
+ end).
get_doc_body_future(#{} = Db, DocId, RevInfo) ->