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

Happy hello logging #69

Merged
merged 1 commit into from
Sep 17, 2015
Merged

Happy hello logging #69

merged 1 commit into from
Sep 17, 2015

Conversation

GalaxyGorilla
Copy link
Contributor

This commit aims to enhance the logging in hello regarding aspects:
- introduction to status codes and message ids
- human readable log messages
- log level is configured to info or debugfor every log
- documentation of log messages with status codes
- more logs in hello client
- introduction of several tracing possibilities
- more meta fields for journald
- no functional changes should be included

-define(LOG_WARNING_reason(CallbackModule, HandlerId, Msg, Args, Reason, LogId),
lager:info(?DEFAULT_META( [ {hello_handler_callback, CallbackModule}, {hello_error_reason, Reason},
{hello_service_id, HandlerId}],
LogId)), Msg, Args).
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems there is a problem with brackets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you find the reason for that compiler warning I'll spend you a beer when you come here ;P. Sasha and I couldn't find it, its probably related to parse_transform.

Copy link
Contributor

Choose a reason for hiding this comment

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

@GalaxyGorilla

-define(LOG_WARNING_reason(CallbackModule, HandlerId, Msg, Args, Reason, LogId),
    lager:info(?DEFAULT_META( [ {hello_handler_callback, CallbackModule}, 
                                {hello_error_reason, Reason},
                                {hello_service_id, HandlerId}], LogId), Msg, Args)).

look on last bracket

Copy link
Contributor

Choose a reason for hiding this comment

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

@GalaxyGorilla we have fixed it, there are no warnings;) and you have one bracket again)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uuups... So I guess pt prevented a compiler error?

@umatomba umatomba assigned surik and skattelmann and unassigned surik Sep 3, 2015
{noreply, Table};
handle_info({'DOWN', _MRef, process, Pid, Reason}, Table) ->
Objects = ets:match(Table, {'$1', Pid, '_', '_'}),
?LOG_WARNING("~p: down ~p with reason ~p", [Pid, Objects, Reason]),
?LOG_INFO("Hello registry received 'DOWN' signal from monitored process '~p' with reason '~p'.
Going to clean up associated processes '~p'.", [Pid, Reason, Objects],
Copy link
Contributor

Choose a reason for hiding this comment

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

whitespaces and new line. do you need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point, I'll work this over.

@surik
Copy link
Contributor

surik commented Sep 4, 2015

I wasn't a part of discussion about logging but on my first view there are so many ids: 6 digits status code, very long hex for message and .hrl file with conjunction of it. Do we really need to put all of it to small open source framework? May we generate some of it automatically or do something for improve understanding of these ids?

@@ -72,7 +72,8 @@ init(URL) ->
State = #state{socket = Socket, url = URL},
{ok, State};
{error, Error} ->
?LOG_ERROR("ezmq_bind_url error: ~p", [Error]),
?LOG_INFO("Hello ZeroMQ listener was unable to bind on '~p' because of reason '~p'.", [URL, Error],
[{hello_transport, zmtp}, {hello_transport_url, ex_uri:encode(URL)}], ?LOGID47),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we save encoded URL in State and use it when it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no problem with that, I'll include that in the following commit.

@sschindler89
Copy link
Contributor

@surik this is our internal logging standard, a short explanation what's what:

  • status ID: gives you with a short look an idea what's wrong (like html 404 or 200)
  • message id: comes from systemd, gives the ability to link to external documentation or explain in detail how to react to an error without putting this information into the log itself. It's an UUID because it should be universal unique

both of these are yielding binding elements which makes it easier for OPS to see what's going on in the application

    - introduction to status codes and message ids
    - human readable log messages
    - log level is configured to info or debugfor every log
    - documentation of log messages with status codes
    - more logs in hello client
    - introduction of several tracing possibilities
    - more meta fields for journald
    - no functional changes should be included
@GalaxyGorilla
Copy link
Contributor Author

Fixed code formatting, squashed commits.

surik added a commit that referenced this pull request Sep 17, 2015
@surik surik merged commit b4ab748 into travelping:master Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants