Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use metric instead of logs to reduce log volume #106

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Used metric instead of log to improve efficiency

## [3.0.2] - 2021-09-22

Expand Down
4 changes: 2 additions & 2 deletions dotnet/DataSources/ProductReviewRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task<IList<LegacyReview>> GetProductReviewsAsync(string productId)
//_context.Vtex.Logger.Info("GetProductReviewsAsync", null, $"[{response.StatusCode}] {responseContent}");
if (response.StatusCode == HttpStatusCode.NotFound)
{
_context.Vtex.Logger.Info("GetProductReviewsAsync", null, $"[{response.StatusCode}] {responseContent}");
_context.Vtex.Logger.Metric("GetProductReviewsAsyncNotFound", 1, new (string, string)[]{("ProductId", productId)});
return null;
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ public async Task<bool> ValidateKeyAndToken(string key, string token, string bas
}
else
{
_context.Vtex.Logger.Info("ValidateKeyAndToken", null, $"[{response.StatusCode}]");
_context.Vtex.Logger.Metric("ValidateKeyAndToken", 1, new []{("StatusCode", response.StatusCode.ToString())});
}
}
catch (Exception ex)
Expand Down