winterhazel commented on issue #10687: URL: https://github.com/apache/cloudstack/issues/10687#issuecomment-2806856650
Hey @DaanHoogland, thanks for bringing this up. We're dealing with two different issues that we need to address here. **The first issue** is addressing existing environments. These environments already have multiple CREATE events for the same network, and are seeing (or will see after the next Usage job if we do not address this) duplicated usage record generation. This behavior impacts the rating through Quota (because it uses the generated usage records) and through external tools based on the generated usage records. I don't usually see organizations performing resource rating by directly consuming the events from `usage_event`, only the two options I mentioned. That's why I was concerned in addressing this issue first (through #10712 and a normalization script). Though, now that you pointed it out, I do recognize that this is probably an existing scenario. Also, I think you may have misunderstood something in my solution by your description, so just making sure that we are aligned on this: my changes mark existing network usage helper entries for a network as removed whenever a CREATE event is processed, independently of there being a DESTROY or not, so that two consecutive CREATE events for the same network do not result in duplicated usage records being generated. **The second issue** is what you pointed out: network state changes are not tracked properly. We only have three usage events published for networks, and one of them is published for two different situations: - `NETWORK.CREATE`: when the network is created, or implemented. - `NETWORK.DELETE`: when the network is deleted. - `NETWORK.UPDATE`: when `updateNetwork` is called for the network. I agree with you that this should be improved. It would be good to have more event types so that we can properly identify when a network transitioned to `Implemented`, or from `Implemented` to `Allocated`. This would be useful for organizations that perform rating based on the usage events (and Quota as well). However, only improving this would not address existing environments. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org