diff --git a/src/Universalis.DbAccess/MarketBoard/ListingStore.cs b/src/Universalis.DbAccess/MarketBoard/ListingStore.cs index 00581068..86d563e5 100644 --- a/src/Universalis.DbAccess/MarketBoard/ListingStore.cs +++ b/src/Universalis.DbAccess/MarketBoard/ListingStore.cs @@ -229,7 +229,12 @@ ORDER BY unit_price // Cache the result temporarily await StoreListingsInCache(query.WorldId, query.ItemId, listings, cancellationToken); - RowsReadCount.Observe(listings.Count); + if (Random.Shared.NextDouble() < 0.2) + { + // Record metric 20% of the time because this is a hot path + RowsReadCount.Observe(listings.Count); + } + return listings; } catch (Exception e) @@ -347,7 +352,12 @@ FROM listing t kvp => kvp.Value); await StoreListingsInCacheMulti(toCache, cancellationToken); - RowsReadCount.Observe(result.Count - cacheValues.Count); + if (Random.Shared.NextDouble() < 0.2) + { + // Record metric 20% of the time because this is a hot path + RowsReadCount.Observe(result.Count - cacheValues.Count); + } + return result; } catch (Exception e)