mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 13:57:13 +03:00
Add new counters for success/failure fetch tree and blob
Summary: This diff adds six new counters to count the number of fetch Tree/Blob/BlobMetadata which are successful or failed in the first try. We already have counters for the success/failure of retry. ## Note This doc explains all the SaplingBackingStore ODS counters/duration after this stack changes: https://docs.google.com/document/d/1o355e8JGvq3fBYFD738Jkx9tPSWzH4bmxcM8YRKMziU/edit?usp=sharing Reviewed By: jdelliot, kmancini Differential Revision: D56554534 fbshipit-source-id: 8082a5227b44ea3fc78c8f98bd6701fd94f0dbf4
This commit is contained in:
parent
13d7968238
commit
75e7e9e9b3
@ -397,6 +397,7 @@ void SaplingBackingStore::processBlobImportRequests(
|
||||
ObjectFetchContext::FetchedSource::Local);
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchBlob, watch.elapsed());
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobSuccess);
|
||||
} else {
|
||||
retryRequest.emplace_back(std::move(request));
|
||||
}
|
||||
@ -421,12 +422,13 @@ void SaplingBackingStore::processBlobImportRequests(
|
||||
}
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchBlob, watch.elapsed());
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobSuccess);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The blobs were either not found locally, or, when EdenAPI is enabled,
|
||||
// not found on the server. Let's import the blob through the sapling
|
||||
// importer.
|
||||
// not found on the server. Let's retry to import the blob
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobFailure);
|
||||
auto fetchSemiFuture = retryGetBlob(
|
||||
request->getRequest<SaplingImportRequest::BlobImport>()->proxyHash,
|
||||
request->getContext().copy());
|
||||
@ -635,6 +637,7 @@ void SaplingBackingStore::processTreeImportRequests(
|
||||
ObjectFetchContext::FetchedSource::Local);
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchTree, watch.elapsed());
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchTreeSuccess);
|
||||
} else {
|
||||
retryRequest.emplace_back(std::move(request));
|
||||
}
|
||||
@ -658,11 +661,13 @@ void SaplingBackingStore::processTreeImportRequests(
|
||||
}
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchTree, watch.elapsed());
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchTreeSuccess);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The trees were either not found locally, or, when EdenAPI is enabled,
|
||||
// not found on the server. Let's retry to import the trees
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchTreeFailure);
|
||||
auto* treeImport =
|
||||
request->getRequest<SaplingImportRequest::TreeImport>();
|
||||
auto treeSemiFuture =
|
||||
@ -897,7 +902,7 @@ void SaplingBackingStore::processBlobMetaImportRequests(
|
||||
ObjectFetchContext::FetchedSource::Local);
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchBlobMetadata, watch.elapsed());
|
||||
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobMetadataSuccess);
|
||||
} else {
|
||||
retryRequest.emplace_back(std::move(request));
|
||||
}
|
||||
@ -919,6 +924,7 @@ void SaplingBackingStore::processBlobMetaImportRequests(
|
||||
}
|
||||
stats_->addDuration(
|
||||
&SaplingBackingStoreStats::fetchBlobMetadata, watch.elapsed());
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobMetadataSuccess);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -926,6 +932,7 @@ void SaplingBackingStore::processBlobMetaImportRequests(
|
||||
// compute the blob metadata. We can't trigger a blob fetch here without
|
||||
// the risk of running into a deadlock: if all import thread are in this
|
||||
// code path, there are no free importer to fetch blobs.
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobMetadataFailure);
|
||||
promise->setValue(nullptr);
|
||||
}
|
||||
}
|
||||
@ -1132,6 +1139,7 @@ folly::SemiFuture<BackingStore::GetTreeResult> SaplingBackingStore::getTree(
|
||||
if (auto tree = getTreeLocal(id, proxyHash)) {
|
||||
XLOG(DBG5) << "imported tree of '" << proxyHash.path() << "', "
|
||||
<< proxyHash.revHash().toString() << " from hgcache";
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchTreeSuccess);
|
||||
return folly::makeSemiFuture(GetTreeResult{
|
||||
std::move(tree), ObjectFetchContext::Origin::FromDiskCache});
|
||||
}
|
||||
@ -1259,6 +1267,7 @@ folly::SemiFuture<BackingStore::GetBlobResult> SaplingBackingStore::getBlob(
|
||||
|
||||
auto blob = getBlobLocal(proxyHash);
|
||||
if (blob.hasValue()) {
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobSuccess);
|
||||
return folly::makeSemiFuture(GetBlobResult{
|
||||
std::move(blob.value()), ObjectFetchContext::Origin::FromDiskCache});
|
||||
}
|
||||
@ -1340,6 +1349,7 @@ SaplingBackingStore::getBlobMetadata(
|
||||
|
||||
auto metadata = getLocalBlobMetadata(proxyHash);
|
||||
if (metadata.hasValue()) {
|
||||
stats_->increment(&SaplingBackingStoreStats::fetchBlobMetadataSuccess);
|
||||
return folly::makeSemiFuture(GetBlobMetaResult{
|
||||
std::move(metadata.value()),
|
||||
ObjectFetchContext::Origin::FromDiskCache});
|
||||
|
@ -314,14 +314,20 @@ struct SaplingBackingStoreStats : StatsGroup<SaplingBackingStoreStats> {
|
||||
Duration fetchTree{"store.sapling.fetch_tree_us"};
|
||||
Duration getRootTree{"store.sapling.get_root_tree_us"};
|
||||
Duration importManifestForRoot{"store.sapling.import_manifest_for_root_us"};
|
||||
Counter fetchTreeSuccess{"store.sapling.fetch_tree_success"};
|
||||
Counter fetchTreeFailure{"store.sapling.fetch_tree_failure"};
|
||||
Counter fetchTreeRetrySuccess{"store.sapling.fetch_tree_retry_success"};
|
||||
Counter fetchTreeRetryFailure{"store.sapling.fetch_tree_retry_failure"};
|
||||
Duration getBlob{"store.sapling.get_blob_us"};
|
||||
Duration fetchBlob{"store.sapling.fetch_blob_us"};
|
||||
Counter fetchBlobSuccess{"store.sapling.fetch_blob_success"};
|
||||
Counter fetchBlobFailure{"store.sapling.fetch_blob_failure"};
|
||||
Counter fetchBlobRetrySuccess{"store.sapling.fetch_blob_retry_success"};
|
||||
Counter fetchBlobRetryFailure{"store.sapling.fetch_blob_retry_failure"};
|
||||
Duration getBlobMetadata{"store.sapling.get_blob_metadata_us"};
|
||||
Duration fetchBlobMetadata{"store.sapling.fetch_blob_metadata_us"};
|
||||
Counter fetchBlobMetadataSuccess{"store.sapling.fetch_blob_metadata_success"};
|
||||
Counter fetchBlobMetadataFailure{"store.sapling.fetch_blob_metadata_failure"};
|
||||
Counter loadProxyHash{"store.sapling.load_proxy_hash"};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user