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

Azure: Event support #7439

Merged
merged 2 commits into from
Apr 12, 2016
Merged

Azure: Event support #7439

merged 2 commits into from
Apr 12, 2016

Conversation

bronaghs
Copy link

Event support for Azure.

A couple of points to note:

  • There is no payload included in the Azure event making it difficult to gather details.
  • The Azure "write" event is fired after any configuration change has been made to a VM e.g. a change of flavor assignment, the addition of a new data disk etc, but it also is fired upon the creation of a new VM. Given the lack of payload and absence of any description, it is impossible to determine which scenario triggered the event.

Corresponding Trello card:
https://trello.com/c/QnXCQPZj/50-3-azure-events-event-mappings

Azure::Armrest::Insights::EventService.new(conf)
end

def each
Copy link
Member

Choose a reason for hiding this comment

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

I think each is not used anywhere. I removed it from the aws eventstream :)

@chessbyte
Copy link
Member

@blomquisg @Fryguy please review

@bronaghs bronaghs changed the title Azure: Event catcher support Azure: Event support Mar 22, 2016
@bronaghs
Copy link
Author

@blomquisg @Fryguy - ready for review

@chessbyte chessbyte closed this Mar 30, 2016
@chessbyte chessbyte reopened this Mar 30, 2016
while @collecting_events

# Grab only events for the last minute if this is the first poll
startup_interval = (Time.current - 1.minute).httpdate
Copy link
Member

Choose a reason for hiding this comment

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

this is only used for the first iteration of the loop.
how about inlining it or extracting a method?

you might even consider extracting the whole filter logic into their own methods and leave each_batch only concerned with yielding events

Copy link
Author

Choose a reason for hiding this comment

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

@durandom - Yea, doing this made the code that bit more readable I think.

Time.zone.parse(events.last.event_timestamp).to_f + 0.001
end

def print_timestamp(time)
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: can you rename this method to format_timestamp? When I read it, I thought it was going to output the timestamp somewhere. :)

@blomquisg
Copy link
Member

A couple nitpicks. Otherwise, LGTM

@Fryguy can you look at the config updates?

@gmcculloug can you look at the event handling updates?

@gmcculloug
Copy link
Member

@lfu Please review the event handling and suggest policy event actions where needed.

# We do not care for 'Begin' events, only the 'End' events which indicate
# the action the event relates to was completed successfully.
event_type = parse_event_type(event)
filtered_events.include?(event_type) || event_type.end_with?("BeginRequest")
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why we wouldn't collect Begin events...in other providers we try to collect everything.

@@ -130,6 +130,7 @@ event_groups:
- orchestration.autoscaling.error
- servergroup.update
- servergroup.addmemeber
- virtualMachines_write_EndRequest
Copy link
Member

Choose a reason for hiding this comment

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

These changes should not be in this file...they should be in settings.yml

@Fryguy
Copy link
Member

Fryguy commented Apr 6, 2016

@bronaghs Looks really good! Most of my comments were style and structure, so relatively minor.

@bronaghs
Copy link
Author

bronaghs commented Apr 6, 2016

thanks @Fryguy !

@miq-bot
Copy link
Member

miq-bot commented Apr 11, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@bronaghs
Copy link
Author

@blomquisg @Fryguy @durandom @chessbyte
I addressed your feedback and kept the changes in a separate commit to make it easy to identify. I don't think i rejected any of your feedback, it was all helpful. Thanks for taking the time to review it.

@lfu
Copy link
Member

lfu commented Apr 11, 2016

The event switchboard modeling looks good.

@miq-bot
Copy link
Member

miq-bot commented Apr 11, 2016

Checked commits bronaghs/manageiq@5f81bc2~...bdfff05 with ruby 2.2.3, rubocop 0.37.2, and haml-lint 0.16.1
8 files checked, 2 offenses detected

app/models/manageiq/providers/azure/cloud_manager/event_catcher/stream.rb

spec/models/manageiq/providers/azure/cloud_manager/event_catcher/runner_spec.rb

@durandom
Copy link
Member

looks good to me, nice job @bronaghs 👍

only as a side note for future specs, if you run this...

❯ be rspec --format documentation spec/models/manageiq/providers/azure/cloud_manager/event_catcher/runner_spec.rb

ManageIQ::Providers::Azure::CloudManager::EventCatcher::Runner
  parsing properties
    parse properties
      event type
      vm ref

...it should read like documentation. That also helps reading the specs in order to get a clue on how the code is supposed to work and to fix broken specs. It also helps structuring the specs in a nice clean way.

@blomquisg
Copy link
Member

What the heck @durandom?! Holding out on the cool tricks! :)

@blomquisg blomquisg merged commit 1b97821 into ManageIQ:master Apr 12, 2016
@blomquisg blomquisg added this to the Sprint 39 Ending Apr 18, 2016 milestone Apr 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants