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

Design proposal for webhooks/notifications #3387

Closed
wants to merge 3 commits into from

Conversation

hpolloni
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #3387 (f064791) into main (3bfd0ba) will increase coverage by 0.60%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #3387      +/-   ##
============================================
+ Coverage     86.33%   86.93%   +0.60%     
- Complexity     2627     2661      +34     
============================================
  Files           337      341       +4     
  Lines         14799    15022     +223     
  Branches       1115     1108       -7     
============================================
+ Hits          12777    13060     +283     
+ Misses         1613     1569      -44     
+ Partials        409      393      -16     
Flag Coverage Δ
java 87.41% <ø> (+0.50%) ⬆️
javascript 82.55% <ø> (+6.92%) ⬆️
python 83.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...oned/persist/tests/SystemPropertiesConfigurer.java 57.14% <0.00%> (-10.72%) ⬇️
...sioned/persist/adapter/DatabaseAdapterFactory.java 72.00% <0.00%> (-9.82%) ⬇️
...sist/tests/extension/DatabaseAdapterExtension.java 64.94% <0.00%> (-0.79%) ⬇️
...persist/nontx/NonTransactionalDatabaseAdapter.java 86.82% <0.00%> (-0.48%) ⬇️
...a/org/projectnessie/deltalake/NessieLogStore.scala 74.79% <0.00%> (-0.41%) ⬇️
...src/main/java/org/projectnessie/model/Content.java 81.81% <0.00%> (ø)
...c/main/java/org/projectnessie/model/Reference.java 100.00% <0.00%> (ø)
.../main/java/org/projectnessie/model/ContentKey.java 93.54% <0.00%> (ø)
...n/java/org/projectnessie/services/authz/Check.java 100.00% <0.00%> (ø)
...jectnessie/deltalake/NessieLogFileMetaParser.scala 100.00% <0.00%> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bfd0ba...f064791. Read the comment docs.

design/notifications.md Outdated Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
}
```

Important note is that nessie doesn't make any efforts to de-duplicate the URL and if a particular URL is subscribed
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we de-dup? To me it sounds like we should try

Copy link
Member

Choose a reason for hiding this comment

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

De-dup is tricky thing to implement right. What we can do is to have a deterministic event ID based on the registered endpoint and a hash on the event payload. I think it's better to defer this it to when we know when and how we send out events, whether there's some messaging system in between, whether we synchronously call the event endpoint and the like.

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 didn't want to go through that rabbit hole. But the more I think about the more I like the idea of deduping both events and subscriptions. The problem is that we will need to document the dedup rules and I didn't want to get into doing that right now. A simple approach is to have deterministic IDs for subscriptions and/or notifications.

design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent
to the observer. This extension point allows extending to other types of notifications in the future.

### Notification persistence
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like this part of the proposal. For other extensiosn to the core we have chosen an SPI and a simple storage mechanism. For example authz has an SPI and the reference impl uses configs provided at runtime. Implementers can then plug in more sophisticated backends with the SPI. Rather than modifying our database adapter and forcing the same storage mechanism i think the SPI gives more flexibility.

Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed that having an SPI would be better and give us/others more flexibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. I will take a look


## Implementation details
### Observer extension point
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that the simplest approach is the same as the auth and tracing idioms: create a wrapper class. This avoids having to make significant changes to the kernel

Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed

Copy link
Collaborator

@nastra nastra left a comment

Choose a reason for hiding this comment

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

overall looks good, just a few comments

design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved
design/notifications.md Show resolved Hide resolved

## Implementation details
### Observer extension point
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current
Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed

TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent
to the observer. This extension point allows extending to other types of notifications in the future.

### Notification persistence
Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed that having an SPI would be better and give us/others more flexibility

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

The description of events LGTM - just a few comments about details.

But I'd prefer to move the management and especially the implementation details out of this document. Maybe we can start with a prototype that synchronously calls a statically configured endpoint. Maybe we tend to push events to a messaging system and have dedicated workers that are responsible for actually invoking the registered endpoint(s), deal with retries, error conditions, etc. And then think how we can actually implement a full-blown notification management system.

type: string
format: date
description: The time the event was fired in ISO date format.
fromRefName:
Copy link
Member

Choose a reason for hiding this comment

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

Can use fromRef here w/ type Reference here as well - just with a note that the hash field in there will always be
null.

design/notifications.md Show resolved Hide resolved
design/notifications.md Outdated Show resolved Hide resolved
1. Its content-type is `application/json`.
2. Its body contains the JSON payload of the event that happened. (See previous section for details on the expected schema).

### Creating a new notification/webhook
Copy link
Member

Choose a reason for hiding this comment

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

I think, event management and event description should be separate things. So one doc that describes the events (as above). Not sure whether we should have a full blown notification management system here. Maybe it's initially sufficient to have a notification endpoint configured via Quarkus.

}
```

Important note is that nessie doesn't make any efforts to de-duplicate the URL and if a particular URL is subscribed
Copy link
Member

Choose a reason for hiding this comment

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

De-dup is tricky thing to implement right. What we can do is to have a deterministic event ID based on the registered endpoint and a hash on the event payload. I think it's better to defer this it to when we know when and how we send out events, whether there's some messaging system in between, whether we synchronously call the event endpoint and the like.

## Implementation details
### Observer extension point
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current
TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent
Copy link
Member

Choose a reason for hiding this comment

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

Nit: let's leave out implementation classes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. Both Ryan and Eduard had concerns on this part of the proposal. Let's talk offline

design/notifications.md Show resolved Hide resolved
Herman Polloni and others added 2 commits February 22, 2022 08:49
Co-authored-by: Robert Stupp <snazy@snazy.de>
Co-authored-by: Ryan Murray <rymurr@gmail.com>
@dimas-b
Copy link
Member

dimas-b commented Feb 22, 2023

This PR has been dormant for about a year - closing. Expect another PR for notifications soon (with different design choices).

@dimas-b dimas-b closed this Feb 22, 2023
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

5 participants