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

msg is empty on logger.log( 'error' ) #106

Open
yamii opened this issue Dec 8, 2016 · 2 comments
Open

msg is empty on logger.log( 'error' ) #106

yamii opened this issue Dec 8, 2016 · 2 comments
Labels

Comments

@yamii
Copy link
Contributor

yamii commented Dec 8, 2016

Lapin will log

  • error - when error occurs
  • info - when success
  • warn - when fail

For the error, our logger is integrated to slack in which we can receive real time errors on #error-logs channel. We noticed that msg is empty when it should not be. msg by the way is the msg sent to a certain service for it to consume.

See here where we set msg: https://github.com/sinet/lapin/blob/master/lib/req-res/status.js#L59

And the reason we do deep clone before is that lapin will hang. My hypothesis is - it's because lapin and logger are both using the msg object. So that to disrupt lapin from using the msg object we just cloned the msg object for logger's usage. I think we'll just look into deep merge using Object.assign.

I also read something about deep clone

Warning for Deep Clone

For deep cloning, we need to use other alternatives. This is because Object.assign() copies the property reference when the property being assigned is an object.
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Merging_objects

Messages we sent to the consumers are not all objects.

sinet/logger BOT [1:52 PM]  
error
code
----------------
13-012

data
----------------
SequelizeUniqueConstraintError: Validation error
   at Query.formatError (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/query.js:316:16)
   at .<anonymous> (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/query.js:81:19)
   at emitOne (events.js:96:13)
   at emit (events.js:188:7)
   at Query.handleError (/usr/src/app/node_modules/pg/lib/query.js:125:8)
   at .<anonymous> (/usr/src/app/node_modules/pg/lib/client.js:172:26)
   at emitOne (events.js:96:13)
   at emit (events.js:188:7)
   at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:113:12)
   at emitOne (events.js:96:13)
   at Socket.emit (events.js:188:7)
   at readableAddChunk (_stream_readable.js:177:18)
   at Socket.Readable.push (_stream_readable.js:135:10)
   at TCP.onread (net.js:542:20)

messageType
----------------
req-res.v1.mc-bit.get-by-id

msg
----------------


errorMsg
----------------
Validation error

service
----------------
microcredential-service

hostname
----------------
stmiami202-microcredential-service0
@yamii
Copy link
Contributor Author

yamii commented Dec 8, 2016

@sinet/chaos-monkey what do you think about this?

@sydcanem
Copy link
Contributor

sydcanem commented Dec 8, 2016

I'm still not sure on the implementation. I'll take a look at it tomorrow. cc @sinet/chaos-monkey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants