[clang-tools-extra] 8070bf8 - [clangd] Record remote index usage

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 30 06:25:27 PDT 2021


Author: Kadir Cetinkaya
Date: 2021-07-30T15:24:22+02:00
New Revision: 8070bf8c6e6afbf0b8a20322d935cb530b4b796a

URL: https://github.com/llvm/llvm-project/commit/8070bf8c6e6afbf0b8a20322d935cb530b4b796a
DIFF: https://github.com/llvm/llvm-project/commit/8070bf8c6e6afbf0b8a20322d935cb530b4b796a.diff

LOG: [clangd] Record remote index usage

This is a gauage metric that sets particular remote-index instances as
used. It should enable accumulation of multiple streams to see number of clangd
processes making use of remote index, broken down by remote index address.

Differential Revision: https://reviews.llvm.org/D106796

Added: 
    

Modified: 
    clang-tools-extra/clangd/tool/ClangdMain.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index c40f98f5a4ee..234fee0c4447 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -561,10 +561,13 @@ const char TestScheme::TestDir[] = "/clangd-test";
 std::unique_ptr<SymbolIndex>
 loadExternalIndex(const Config::ExternalIndexSpec &External,
                   AsyncTaskRunner *Tasks) {
+  static const trace::Metric RemoteIndexUsed("used_remote_index",
+                                             trace::Metric::Value, "address");
   switch (External.Kind) {
   case Config::ExternalIndexSpec::None:
     break;
   case Config::ExternalIndexSpec::Server:
+    RemoteIndexUsed.record(1, External.Location);
     log("Associating {0} with remote index at {1}.", External.MountPoint,
         External.Location);
     return remote::getClient(External.Location, External.MountPoint);


        


More information about the cfe-commits mailing list