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

Event stream #698

Merged
merged 1 commit into from
Dec 22, 2015
Merged

Event stream #698

merged 1 commit into from
Dec 22, 2015

Conversation

ejholmes
Copy link
Contributor

Related #658
Closes #458

This is a little spike into an events system, starting with run, scale, deploy, restart and rollback events. Note that this doesn't attempt to give you any visibility into ECS events, just Empire triggered events for auditing.

I'm starting with an SNS implementation of the Events interface, which would allow you to write SQS consumers (or just lambda functions) that processes the events in whatever way you want (maybe post to a slack channel, or post to a datadog event stream). Eventually, we may provide other implementations, like webhooks (but that can be done with SNS easily by creating an http subscription).

TODO

  • Add an Events implementation that writes into the apps log stream Inject admin events into logstream #658
  • Make publishing events happen in a goroutine.
  • Update demo CloudFormation to use SNS events backend.
  • Docs on configuring SNS event stream

)

// WithUser adds a user to the context.Context.
func WithUser(ctx context.Context, u *empire.User) context.Context {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving these functions from empire core to here so that they can't be used within empire core. Providing the user that's performing an action should happen in the options struct provided.

@ejholmes ejholmes force-pushed the events branch 2 times, most recently from 07d01bc to 3cf50fe Compare December 15, 2015 03:43
@ejholmes ejholmes changed the title Events Event stream Dec 15, 2015
@@ -177,6 +184,27 @@ func newKinesisLogsStreamer(c *cli.Context) (empire.LogsStreamer, error) {
return empire.NewKinesisLogsStreamer(), nil
}

// Events ==============================

func newEventStream(c *cli.Context) (empire.EventStream, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would things like this be easier to test, etc, if the functions took the arguments they actually used? Like in this case it seems kind of wasteful to pass the entire cli.Context in, when all we really care about is a single variable - it also makes it harder to read, since I'm not actually sure, looking at this, what it needs as it hands the cli context further down the stack.

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 think that would be worth it if we pull the factories out into a separate package, but that gets cumbersome because we have to define Config structs for everything. Some factories require more than 1 config value, so this keeps things easy to change without needing to updating config structs/method definitions.

@ejholmes
Copy link
Contributor Author

Ok. I think this is good to go. I also added an example Lambda function in the docs that can be used to publish Empire events to a slack channel.

@phobologic
Copy link
Contributor

👍

ejholmes added a commit that referenced this pull request Dec 22, 2015
@ejholmes ejholmes merged commit 31d3847 into master Dec 22, 2015
@ejholmes ejholmes deleted the events branch December 22, 2015 22:50
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.

2 participants