Dynatrace / dynatrace-configuration-as-code

This tool automates deployment of Dynatrace Configuration to one or multiple Dynatrace environments.
https://docs.dynatrace.com/docs/manage/configuration-as-code/monaco
Apache License 2.0
164 stars 94 forks source link

feat: experimental event system support (POC) #1493

Closed warber closed 4 months ago

warber commented 5 months ago

This PR contains a POC that introduces a way handling application local events. I've created a new package events that contains a very basic publish-subscribe like event system component that can be carried along with a go context and used wherever there is the need to emit an event.

On the other end it is possible to register subscribers for different types of events that are notified whenever a new event was sent. Note hat it is possible to aggregate events using a "correlation id". This is necessary because we need to be able to aggregate events that relate to each other. Subscribers shall receive only "internal" events and translate them to whatever they want to do with these events. In this PR there are two subscribers one for creating a "report" of deployed configs and one for creating an overall summary.

The feature can be tried out by enabling the feature flag MONACO_FEAT_EVENTQUEUE and performing a deployment. As a result you should see two crated files one called events_<timestamp>.jsonl containing a line for each config Monaco processed during deployment. and another file called summyry_<timestamp>.jsonl containing a brief summary of the deployment containing information like the number of deployed configs, number of skipped configs, duration of exectution etc....

github-actions[bot] commented 5 months ago

Unit Test Results

1 887 tests  +2   1 887 :white_check_mark: +2   27s :stopwatch: -1s   135 suites +2       0 :zzz: ±0      1 files   ±0       0 :x: ±0 

Results for commit d32fd8d9. ± Comparison against base commit f09ea994.

:recycle: This comment has been updated with latest results.

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

warber commented 4 months ago

Will be done in a new PR