This repository has been archived by the owner on Mar 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
[Package Renames] Expose popularity transfers in search #774
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loic-sharma
force-pushed
the
loshar-xfer-search
branch
from
May 2, 2020 00:45
7d26b3f
to
5ad5843
Compare
loic-sharma
requested review from
joelverhagen,
agr,
cristinamanum,
dannyjdev,
dc7497-1576912,
lyndaidaii,
ryuyu,
shishirx34,
skofman1,
xavierdecoster and
zhhyu
May 2, 2020 02:09
loic-sharma
commented
May 2, 2020
{ | ||
_telemetryClient.TrackMetric( | ||
Prefix + "ReadLatestVerifiedPackagesSeconds", | ||
elapsed.TotalSeconds, | ||
new Dictionary<string, string> | ||
{ | ||
{ "PackageIdCount", packageIdCount?.ToString() }, | ||
{ "NotModified", notModified.ToString() }, | ||
{ "Modified", modified.ToString() }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property's name was incorrect. See:
NuGet.Services.Metadata/src/NuGet.Services.AzureSearch/AuxiliaryFiles/VerifiedPackagesDataClient.cs
Lines 55 to 80 in 64af0b5
bool modified; | |
var data = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | |
AuxiliaryFileMetadata metadata; | |
try | |
{ | |
using (var stream = await blobReference.OpenReadAsync(accessCondition)) | |
{ | |
ReadStream(stream, id => data.Add(stringCache.Dedupe(id))); | |
modified = true; | |
metadata = new AuxiliaryFileMetadata( | |
lastModified: new DateTimeOffset(blobReference.LastModifiedUtc, TimeSpan.Zero), | |
loadDuration: stopwatch.Elapsed, | |
fileSize: blobReference.Properties.Length, | |
etag: blobReference.ETag); | |
} | |
} | |
catch (StorageException ex) when (ex.RequestInformation.HttpStatusCode == (int)HttpStatusCode.NotModified) | |
{ | |
_logger.LogInformation("The blob {BlobName} has not changed.", blobName); | |
modified = false; | |
data = null; | |
metadata = null; | |
} | |
stopwatch.Stop(); | |
_telemetryService.TrackReadLatestVerifiedPackages(data?.Count, modified, stopwatch.Elapsed); |
joelverhagen
reviewed
May 4, 2020
using NuGet.Services.AzureSearch.AuxiliaryFiles; | ||
|
||
namespace NuGet.Services.AzureSearch.SearchService | ||
{ | ||
public class AuxiliaryData : IAuxiliaryData | ||
{ | ||
private static readonly string[] EmptyStringArray = new string[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I discovered Array.Empty<T>()
recently. Seems nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, I like removing boilerplate :D
joelverhagen
approved these changes
May 4, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This exposes the popularity transfer data on the
/search/query
endpoint. It also exposes the popularity transfer metadata on the/search/diag
endpoint. This will later be used to monitor popularity transfer's staleness.I also introduced a new type,
PopularityTransferData
to remove the usage ofSortedDictionary<string, SortedSet<string>>
and remove the need to check case insensitivity for popularity transfers.Addresses NuGet/NuGetGallery#7903