Repository navigation
Provide missing user event metrics from aerogear/keycloak-metrics-spi with a key… - #33046
Conversation
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.webauthn.registration.passwordless.PwdLessResidentKeyRegTest#residentKeyNotRequiredPresentKeycloak CI - WebAuthn IT (chrome) |
7337ac8 to
1a74c94
Compare
|
TODOs: |
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.webauthn.registration.passwordless.PwdLessOtherSettingsTest#defaultValuesKeycloak CI - WebAuthn IT (chrome) org.keycloak.testsuite.webauthn.registration.passwordless.PwdLessPolicyJsInjectionTest#relyingPartyEntityNameKeycloak CI - WebAuthn IT (chrome) |
|
@bohmber - thank you for this PR. Please provide an example output of the metrics you created. For the prefix, I'd go with |
|
@bohmber - another note: We would need some docs for this similar to what the Aerogear extension provides. If you re-use documentation or code from that repo, you need to attribute the changes to the original authors. For now, use the co-author in the commits. I might need to figure out how to do this properly to comply with our DCO. |
|
@ahus1 documentation is a good topic. I need to figure out what makes sense. For the legal stuff I think I have to recreate the pr/commits with all co-authors |
238b3dd to
3a7c619
Compare
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.webauthn.registration.passwordless.PwdLessPolicyJsInjectionTest#relyingPartyEntityNameKeycloak CI - WebAuthn IT (chrome) org.keycloak.testsuite.webauthn.registration.passwordless.PwdLessResidentKeyRegTest#residentKeyNotRequiredPresentKeycloak CI - WebAuthn IT (chrome) |
|
@bohmber - I see you rebased or merged the main branch into the PR. Please avoid this unless you see conflicts or are being asked by a maintainer to do so as it avoid unnecessary rebuilds of the branch and notifications to the maintainers. Thanks! |
|
@ahus1 That is fine for me. I added some basic documentation and you can disable AdminEvents and Events and the metrics enabled will be checked by the factory |
|
Thank you @vmuzikar for the review. I contributed the CLI options so I will comment on that part next week. |
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.broker.KcOidcBrokerTest#testPostBrokerLoginFlowWithOTP_bruteForceEnabledKeycloak CI - Java Distribution IT (windows-latest - temurin - 17) |
|
@vmuzikar - tests are green, ready for another round of review when you have the time. Thanks! |
There was a problem hiding this comment.
We should disable the feature after the test to make sure the feature does not affect the tests running afterwards.
There was a problem hiding this comment.
OK, I've reworked the test and used the same logic as in HostnameV2Test.java. Please re-review.
| if (suiteContext.getAuthServerInfo().isQuarkus()) { | ||
| AbstractQuarkusDeployableContainer container = (AbstractQuarkusDeployableContainer) suiteContext.getAuthServerInfo().getArquillianContainer().getDeployableContainer(); | ||
| List<String> args = new ArrayList<>(); | ||
| args.add("--features=user-event-metrics"); |
There was a problem hiding this comment.
I just realized this won't work if an additional feature is enabled for the test using auth.server.feature. I think we should use the "official" way for enabling features. It means one more restart in the test, however, we will be sure the feature set after the test is the same as before.
Here is the commit: mhajas@1000c93 let me know if you agree with the change and I can push directly to this PR.
There was a problem hiding this comment.
Thank you for spotting this. I've added it to the PR, squashed it, and rebased it as it had some conflicts.
… to a keycloak micrometer event listener inspired by https://github.com/aerogear/keycloak-metrics-spi https://github.com/please-openit/keycloak-native-metrics Closes keycloak#33043 Signed-off-by: Bernd Bohmann <bommel@apache.org> Signed-off-by: Alexander Schwartz <aschwart@redhat.com> Signed-off-by: Michal Hajas <mhajas@redhat.com> Co-authored-by: Alexander Schwartz <aschwart@redhat.com> Co-authored-by: Michal Hajas <mhajas@redhat.com> Signed-off-by: Michal Hajas <mhajas@redhat.com>
There was a problem hiding this comment.
@ahus1 Sorry for the late reply and thank you for the updates! The latest changes look good.
However, I noticed one last config/UX issue. It's possible to specify global event listener as a realm listener. This should have no effect but still could be confusing to the user:
At least I'd say we should filter out the global listeners from the UI. But we could take it step further if we want: throw an exception if a global listener is added to a realm (to cover the REST API interface). And ideally as a follow-up maybe display the global listener as a permanent/static/grayed out one in the list of realm listeners in the UI.
| setConfigProperty("keycloak.metrics-enabled", "true"); | ||
| setConfigProperty("keycloak.event-metrics-user-enabled", "true"); |
There was a problem hiding this comment.
I believe this won't work without proper modifications of the Undertow config file.
Also it's missing the optional settings for tags and events.
The question is: do we care? Undertow is no longer used in any of ours CIs, AFAIK. It's used only for dev purposes. We could simply say "this test runs only on Quarkus".
The question is: do we care? Undertow is basically used as a dev tool, AFAIK it's not used in any CI any more. We could simply say that the test supports Quarkus only.
|
That said, we could IMHO resolve the UX as follow up not to hold this PR any longer. |
There was a problem hiding this comment.
In the light of my previous comment, approving as is. We can polish in follow-ups.
|
Created follow-up-issue #34602 |
|
@ahus1 Is it possible that this PR is causing errors in the "Store Model Tests" with jpa profile for some tests in |
|
@graziang - I see that the CI test suite skipped them as it didn't consider them related, so it could be. Do you have a pointer with a failed GHA? |
|
Issue created: #34611 |
…cloak mircometer event listener
inspired by
https://github.com/aerogear/keycloak-metrics-spi
https://github.com/please-openit/keycloak-native-metrics https://github.com/thomasdarimont/keycloak-project-example/tree/main/keycloak/extensions/src/main/java/com/github/thomasdarimont/keycloak/custom/metrics
Preview of the docs:
https://github.com/bohmber/keycloak/blob/issue-33043/docs/guides/server/event-metrics.adoc
fixes: #33043