Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Enable trace agent for windows #329

Merged
merged 7 commits into from
Oct 31, 2017
Merged

Enable trace agent for windows #329

merged 7 commits into from
Oct 31, 2017

Conversation

derekwbrown
Copy link

Implements trace agent as a windows service.

Graceful shutdown for Windows Service

* Forgot a parameter

* Fixes since it wasn't compiling for Windows
close(exit)
return
default:
elog.Error(1, fmt.Sprintf("unexpected control request #%d", c))
Copy link

Choose a reason for hiding this comment

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

As @LotharSee mentioned in #330. Should we log receiving unexpected control requests as errors since it's not causing any error in the agent? We don't want the user troubleshooting it if there is nothing wrong.

Choose a reason for hiding this comment

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

Yup if they are not actual errors, no reason to scare the user for that.
If we things these make sense to be in the logs for debug/support purpose, then we should make then info. Or warn if we though our switch was exhaustive.

Add compiled messages for event viewer
Put runAgent() on goroutine (instead of vice/versa)
@palazzem palazzem added this to the 5.18.2 milestone Oct 31, 2017
Copy link

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

A concern about the graceful shutdown, probably we have to revert some changes?


exit := make(chan struct{})

go runAgent(exit)

Choose a reason for hiding this comment

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

With the current implementation if the Agent runs in a goroutine it means that the control loop is the one that ends the process, "killing" all remaining go routines (so the agent). In our case, we start flushing Agent buffers when it receives the exit signal, but since the control loop is faster to return, it's not deterministic if buffers are flushed or not. This means that our shutdown may not be graceful.

Probably we should revert to the other way around? 0feeba7#diff-0c5f36551698accfa0720833c46f618fR64

time.Sleep(100 * time.Millisecond)
changes <- c.CurrentStatus
case svc.Stop, svc.Shutdown:
elog.Info(0x40000006, ServiceName)
Copy link

Choose a reason for hiding this comment

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

What is the meaning of these hex values used for logging ?

@palazzem palazzem merged commit 289a97c into master Oct 31, 2017
@palazzem palazzem deleted the db/windows_apm branch October 31, 2017 09:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants