You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2020/03/18 20:03:06 UTC

[couchdb] branch prototype/fdb-layer-get-doc-spans created (now 41be92b)

This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a change to branch prototype/fdb-layer-get-doc-spans
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 41be92b  Add additional get_doc spans

This branch includes the following new commits:

     new 41be92b  Add additional get_doc spans

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Add additional get_doc spans

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a commit to branch prototype/fdb-layer-get-doc-spans
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 41be92bb94bc2b5bdc4070d3f48a6e27179ca154
Author: Russell Branca <ch...@apache.org>
AuthorDate: Wed Mar 18 13:02:50 2020 -0700

    Add additional get_doc spans
---
 src/fabric/src/fabric2_fdb.erl | 43 +++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 403b5bb..6f93739 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) ->