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

A more configurable URLNotifier #726

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

A more configurable URLNotifier #726

wants to merge 3 commits into from

Conversation

itzloop
Copy link
Contributor

@itzloop itzloop commented May 29, 2024

Makes URLNotifier more configurable

  • Add a new constructor that accepts 'URLNotifierParams' directly
  • Add 'DropWhenFull' as parameter
  • Add 'DeqeuedAt' for better monitoring at hooked backends

Copy link

changeset-bot bot commented May 29, 2024

⚠️ No Changeset found

Latest commit: ed68808

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

})
n.urlNotifiers = append(n.urlNotifiers, u)
}
return n
}

func NewDefaultNotifierByParams(params []URLNotifierParams) QueuedNotifier {
Copy link
Member

Choose a reason for hiding this comment

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

what is the intent of creating different notifiers underneath?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For more control. With this we can have different configuration per webhook. But the real reason was to avoid long constructors. It was simpler just to pass in a list of URLNotifierParams.

@@ -49,7 +49,9 @@ message WebhookEvent {
// timestamp in seconds
int64 created_at = 7;

int64 dequeued_at = 12;
Copy link
Member

Choose a reason for hiding this comment

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

why is this field needed? what is it intended to communicate to to the end user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is useful for identifying issues in webhook logic. I have high latency spikes for webhook events, but I don't know how much it took Livekit from when the event was queued until it's been sent.

APISecret string
Logger logger.Logger
QueueSize int
DropWhenFull bool
Copy link
Member

Choose a reason for hiding this comment

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

should this be exposed at all? what is the behavior when it's set to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If set to false, events will drop only due to network failures, and not the queue being full. Assume we want to make events more reliabale, i think we should be able to configure this parameter.

@CLAassistant
Copy link

CLAassistant commented Jun 12, 2024

CLA assistant check
All committers have signed the CLA.

itzloop and others added 2 commits June 12, 2024 15:48
    * Add a new constructor that accepts 'URLNotifierParams' directly
    * Add 'DropWhenFull' as parameter
    * Add 'DeqeuedAt' for better monitoring at hooked backends
    * Fixes tag name being off by 1
    * Sets DequeuedAt
#3)

* feat: allow for custom URLNotifier and add batched events protobuf definition

* feat: Implement batch sender
* feat: Add include/exclude options

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants