-
Notifications
You must be signed in to change notification settings - Fork 158
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
Event stream #698
Conversation
) | ||
|
||
// WithUser adds a user to the context.Context. | ||
func WithUser(ctx context.Context, u *empire.User) context.Context { |
There was a problem hiding this comment.
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.
07d01bc
to
3cf50fe
Compare
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
👍 |
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
Events
implementation that writes into the apps log stream Inject admin events into logstream #658