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

Add a structured log field for just the normalized device-id. #391

Merged
merged 8 commits into from
Mar 14, 2023

Conversation

maurafortino
Copy link
Contributor

What's included: #373

  • Added helper function to extract device id from the path params
  • updated zap logger to include the device id in log statements

@maurafortino maurafortino self-assigned this Mar 3, 2023
@denopink denopink requested a review from renaz6 March 3, 2023 17:19
@maurafortino maurafortino marked this pull request as draft March 3, 2023 19:36
transaction/transactor.go Outdated Show resolved Hide resolved
id, ok := vars["deviceid"]
if !ok {
//TODO: edit log statement
fmt.Println("id is missing in parameters")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the id isn't present I think we should add a deviceid of mac:000000000000 which is both a valid address, but also a reserved value that should never be used. This will allow us to track this happened easier than nothing being present.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how difficult it would be to make this configurable (ideal).

@maurafortino maurafortino marked this pull request as ready for review March 8, 2023 14:53
@codecov
Copy link

codecov bot commented Mar 8, 2023

Codecov Report

Merging #391 (092d891) into main (2e5eacf) will increase coverage by 0.91%.
The diff coverage is 91.66%.

❗ Current head 092d891 differs from pull request most recent head ad1afce. Consider uploading reports for the commit ad1afce to get more accurate results

@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   44.22%   45.14%   +0.91%     
==========================================
  Files          15       15              
  Lines        1135     1154      +19     
==========================================
+ Hits          502      521      +19     
  Misses        621      621              
  Partials       12       12              
Flag Coverage Δ
unittests 45.14% <91.66%> (+0.91%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stat/transport.go 75.00% <0.00%> (ø)
translation/transport.go 83.12% <0.00%> (ø)
transaction/transactor.go 92.92% <100.00%> (+1.67%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@denopink denopink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a few minor things

transaction/transactor.go Outdated Show resolved Hide resolved
transaction/transactor.go Show resolved Hide resolved
Copy link
Member

@renaz6 renaz6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Approved with Owen's recommended changes

Copy link
Contributor

@denopink denopink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 🍻
Some some changes I suggested.

transaction/transactor.go Outdated Show resolved Hide resolved
transaction/transactor_test.go Outdated Show resolved Hide resolved
transaction/transactor_test.go Outdated Show resolved Hide resolved
transaction/transactor.go Outdated Show resolved Hide resolved
maurafortino and others added 4 commits March 14, 2023 10:21
Co-authored-by: Owen Cabalceta <denopink@gmail.com>
Co-authored-by: Owen Cabalceta <denopink@gmail.com>
Co-authored-by: Owen Cabalceta <denopink@gmail.com>
@sonarcloud
Copy link

sonarcloud bot commented Mar 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.9% 88.9% Coverage
0.0% 0.0% Duplication

@maurafortino maurafortino merged commit 149f3d5 into main Mar 14, 2023
@maurafortino maurafortino deleted the issue-373 branch March 14, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants