Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
feat: Use multiple explicit event subscriptions rather than wildcard (#…
Browse files Browse the repository at this point in the history
…828)

* feat: Use explicit event subscriptions

Signed-off-by: Arthur Pitman <[email protected]>

* Correct documentation

Signed-off-by: Arthur Pitman <[email protected]>
  • Loading branch information
arthurpitman authored Jun 15, 2022
1 parent 4a2c9b7 commit c940513
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
22 changes: 18 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,17 @@ func (d dynatraceService) RegistrationData() controlplane.RegistrationData {
DistributorVersion: "0.16.0",
},
Subscriptions: []models.EventSubscription{
{
Event: "sh.keptn.event.>",
Filter: models.EventSubscriptionFilter{},
},
createEventSubscription("sh.keptn.event.monitoring.configure"),
createEventSubscription("sh.keptn.events.problem"),
createEventSubscription("sh.keptn.event.action.triggered"),
createEventSubscription("sh.keptn.event.action.started"),
createEventSubscription("sh.keptn.event.action.finished"),
createEventSubscription("sh.keptn.event.get-sli.triggered"),
createEventSubscription("sh.keptn.event.deployment.finished"),
createEventSubscription("sh.keptn.event.test.triggered"),
createEventSubscription("sh.keptn.event.test.finished"),
createEventSubscription("sh.keptn.event.evaluation.finished"),
createEventSubscription("sh.keptn.event.release.triggered"),
},
}
}
Expand Down Expand Up @@ -193,3 +200,10 @@ func connectToControlPlane() (*controlplane.ControlPlane, error) {
eventsource.New(natsConnector),
logforwarder.New(apiSet.LogsV1())), nil
}

func createEventSubscription(event string) models.EventSubscription {
return models.EventSubscription{
Event: event,
Filter: models.EventSubscriptionFilter{},
}
}
1 change: 0 additions & 1 deletion documentation/feature-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ The dynatrace-service listens for the following events:
- `sh.keptn.event.test.finished`
- `sh.keptn.event.evaluation.finished`
- `sh.keptn.event.release.triggered`
- `sh.keptn.event.release.finished`
- `sh.keptn.events.problem`
- `sh.keptn.event.monitoring.configure`

3 changes: 0 additions & 3 deletions internal/event_handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func getEventAdapter(e cloudevents.Event) (adapter.EventContentAdapter, error) {
return action.NewEvaluationFinishedAdapterFromEvent(e)
case keptnv2.GetTriggeredEventType(keptnv2.ReleaseTaskName):
return action.NewReleaseTriggeredAdapterFromEvent(e)
case keptnv2.GetFinishedEventType(keptnv2.ReleaseTaskName):
//do nothing, ignore the type, don't even log
return nil, nil
default:
log.WithField("EventType", e.Type()).Debug("Ignoring event")
return nil, nil
Expand Down

0 comments on commit c940513

Please sign in to comment.