-
Notifications
You must be signed in to change notification settings - Fork 332
Add Events for Policy Service APIs #2479
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
Merged
singhpk234
merged 4 commits into
apache:main
from
adnanhemani:ahemani/event_instrumentation_catalog_policy_service
Sep 5, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...e/service/src/main/java/org/apache/polaris/service/events/CatalogPolicyServiceEvents.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.polaris.service.events; | ||
|
|
||
| import org.apache.polaris.service.types.AttachPolicyRequest; | ||
| import org.apache.polaris.service.types.CreatePolicyRequest; | ||
| import org.apache.polaris.service.types.DetachPolicyRequest; | ||
| import org.apache.polaris.service.types.GetApplicablePoliciesResponse; | ||
| import org.apache.polaris.service.types.LoadPolicyResponse; | ||
| import org.apache.polaris.service.types.UpdatePolicyRequest; | ||
|
|
||
| /** | ||
| * Event records for Catalog Policy operations. Each operation has corresponding "Before" and | ||
| * "After" event records. | ||
| */ | ||
| public class CatalogPolicyServiceEvents { | ||
|
|
||
| // Policy CRUD Events | ||
| public record BeforeCreatePolicyEvent( | ||
| String catalogName, String namespace, CreatePolicyRequest createPolicyRequest) {} | ||
|
|
||
| public record AfterCreatePolicyEvent( | ||
| String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {} | ||
|
|
||
| public record BeforeListPoliciesEvent(String catalogName, String namespace, String policyType) {} | ||
|
|
||
| public record AfterListPoliciesEvent(String catalogName, String namespace, String policyType) {} | ||
|
|
||
| public record BeforeLoadPolicyEvent(String catalogName, String namespace, String policyName) {} | ||
|
|
||
| public record AfterLoadPolicyEvent( | ||
| String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {} | ||
|
|
||
| public record BeforeUpdatePolicyEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String policyName, | ||
| UpdatePolicyRequest updatePolicyRequest) {} | ||
|
|
||
| public record AfterUpdatePolicyEvent( | ||
| String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {} | ||
|
|
||
| public record BeforeDropPolicyEvent( | ||
| String catalogName, String namespace, String policyName, Boolean detachAll) {} | ||
|
|
||
| public record AfterDropPolicyEvent( | ||
| String catalogName, String namespace, String policyName, Boolean detachAll) {} | ||
|
|
||
| // Policy Attachment Events | ||
| public record BeforeAttachPolicyEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String policyName, | ||
| AttachPolicyRequest attachPolicyRequest) {} | ||
|
|
||
| public record AfterAttachPolicyEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String policyName, | ||
| AttachPolicyRequest attachPolicyRequest) {} | ||
|
|
||
| public record BeforeDetachPolicyEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String policyName, | ||
| DetachPolicyRequest detachPolicyRequest) {} | ||
|
|
||
| public record AfterDetachPolicyEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String policyName, | ||
| DetachPolicyRequest detachPolicyRequest) {} | ||
|
|
||
| // Policy Query Events | ||
| public record BeforeGetApplicablePoliciesEvent( | ||
| String catalogName, String namespace, String targetName, String policyType) {} | ||
|
|
||
| public record AfterGetApplicablePoliciesEvent( | ||
| String catalogName, | ||
| String namespace, | ||
| String targetName, | ||
| String policyType, | ||
| GetApplicablePoliciesResponse getApplicablePoliciesResponse) {} | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to insist on naming, but it's still inconsistent.
In #2482 we have
(Before|After)(Object)(Verb)Event. E.g.BeforeCatalogListEvent.Here we have
(Before|After)(Verb)(Object)Event. E.g.BeforeCreatePolicyEvent.(I find verb-object more natural than object-verb btw, but I'll defer the decision to native English speakers.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it again, I think verb-object is better too. Let me keep these events as-is in that case and change the rest of the PRs.