[clangd] Record remote index usage
authorKadir Cetinkaya <kadircet@google.com>
Mon, 26 Jul 2021 15:08:03 +0000 (17:08 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Fri, 30 Jul 2021 13:24:22 +0000 (15:24 +0200)
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

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

index c40f98f..234fee0 100644 (file)
@@ -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);