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

Update events logic to allow mapping specific events to specific tags #333

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

jsun-m
Copy link
Contributor

@jsun-m jsun-m commented Jun 27, 2024

HTTP Inputs in Fluent-bit dynamically set tags based off the URI of the request.
e.g. a request to fluentbit.monitoring:9880/tag_name results in fluent-bit automatically setting a tag of tag_name to the event

These tag names are then matched with an output in the example below

[OUTPUT]
          Name  http
          Match tag_name
          ....

By default, the events will map to the tag http.1 unless it's override in the input. However, I added a mapping that can be set in config.yaml to map events to specific tags by event name as such:

monitoring:
  fluentbit:
    events:
      mapping:
      - name: abstraction.trigger
         tag: internal_api


var EventAbstractionTriggerSchemaVersion = "1.0"

type EventAbstractionTriggeredSchema struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this have an event_type field or something? this feels ambiguous

Copy link
Contributor Author

@jsun-m jsun-m Jun 27, 2024

Choose a reason for hiding this comment

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

The stubtype includes the abstraction and trigger type

@@ -147,6 +147,7 @@ type EventRepository interface {
PushContainerStoppedEvent(containerID string, workerID string)
PushWorkerStartedEvent(workerID string)
PushWorkerStoppedEvent(workerID string)
PushAbstractionTriggeredEvent(workspaceId string, stub *types.Stub)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like this name, it feels confusing. I'd almost argue for more specific functions even at the risk of more code / being more verbose. I./e. PushDeployedStubEvent() PushServedStubEvent()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this better. I renamed the subject from abstraction -> stub

pkg/repository/events.go Show resolved Hide resolved
Copy link
Contributor

@luke-lombardi luke-lombardi left a comment

Choose a reason for hiding this comment

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

Looks good. I'm still a little iffy on the event tag mapping but let's try it out.

@jsun-m jsun-m merged commit 4684c76 into main Jun 28, 2024
3 checks passed
@jsun-m jsun-m deleted the john/be-1416-add-slack-notifications-for-beta9-usage branch June 28, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants