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

fix: fixed and improved webhooks #283

Merged
merged 1 commit into from
Nov 22, 2024
Merged

fix: fixed and improved webhooks #283

merged 1 commit into from
Nov 22, 2024

Conversation

mahatoankitkumar
Copy link
Collaborator

Problem

Improvement in webhook event.

Solution

Added tenant_id, config_version in the webhook response.
And added custom_headers in webhook object too.

@mahatoankitkumar mahatoankitkumar requested a review from a team as a code owner November 14, 2024 10:39
@@ -43,9 +50,17 @@ pub enum WebhookEvent {
ExperimentConcluded,
}

#[derive(Serialize, Deserialize)]
pub struct EventInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pub struct EventInfo {
pub struct WebhookEventInfo {

We may have other system events in the future, so wanted to namespace this now

#[derive(Serialize, Deserialize)]
pub struct EventInfo {
pub webhook_event: WebhookEvent,
pub time: NaiveDateTime,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not string, then you don't need to import chrono

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why string?
importing chrono will cause any issue?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah superposition_types is used in all other places, so it increases the size, compile time, etc. If we can avoid it, since it's used only to store the timestamp which is a string at the end - then fine

@@ -23,6 +21,6 @@ tenant = { schema = { "type" = "string", "enum" = ["test", "dev"] } }

[context."$tenant == 'dev'"]
mandatory_dimensions = []
experiments_webhook_config = { "enabled" = false, "configuration" = { "url" = "http://localhost:8080/config/test", "method" = "Get", "headers" = [
"ConfigVersion",
experiments_webhook_config = { "enabled" = false, "configuration" = { "url" = "http://localhost:8080/config/test", "method" = "Get", "service_headers" = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you define custom_headers here or in default_config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah i'll define it
But i have kept it not required, so would be fine to leave it also

@mahatoankitkumar mahatoankitkumar merged commit 4864849 into main Nov 22, 2024
4 checks passed
@mahatoankitkumar mahatoankitkumar deleted the fix/webhook branch November 22, 2024 06:58
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.

3 participants