devmadhuu commented on code in PR #4540:
URL: https://github.com/apache/ozone/pull/4540#discussion_r1186249915
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconRestServletModule.java:
##########
@@ -109,6 +113,45 @@ private void configureApi(String baseApiPath, String...
packages) {
UriBuilder.fromPath(baseApiPath).path("*").build().toString();
serve(allApiPath).with(ServletContainer.class, params);
addFilters(baseApiPath, adminEndpoints);
+ // This is part of framework now for all internal endpoints.
+ addFiltersForInternalOnlyEndPoints(baseApiPath, internalOnlyEndpoints);
+ }
+
+ private void addFiltersForInternalOnlyEndPoints(
+ String basePath,
+ Set<String> internalOnlyEndpoints) {
+ for (String path: internalOnlyEndpoints) {
+ String internalOnlyPath =
+ UriBuilder.fromPath(basePath).path(path + "*").build().toString();
+ filter(internalOnlyPath).through(ReconInternalComponentFilter.class);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Added recon internal filter to path {}", internalOnlyPath);
+ }
+ }
+ }
+
+ private void getInternalOnlyEndPoints(Set<String> internalOnlyEndpoints,
+ Reflections reflections) {
+ Set<Class<?>> internalOnlyEndpointClasses =
+ reflections.getTypesAnnotatedWith(InternalOnly.class);
+ internalOnlyEndpointClasses.stream()
+ .map(clss -> UriBuilder.fromResource(clss).build().toString())
+ .forEachOrdered(internalOnlyEndpoints::add);
+
+ Map<String, Map<String, String>> internalEndpointMap = new HashMap<>();
+ internalOnlyEndpointClasses.forEach(cl -> {
+ String endPointURL = UriBuilder.fromResource(cl).build().toString();
+ InternalOnly internalOnly = cl.getAnnotation(InternalOnly.class);
+ Map<String, String> featureDescMap = new HashMap<>();
+ featureDescMap.put("feature", internalOnly.feature());
+ featureDescMap.put("description", internalOnly.description());
+ internalEndpointMap.put(endPointURL, featureDescMap);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(
+ "Registered the following endpoint classes as internal only: {}",
+ internalEndpointMap);
Review Comment:
> This internalEndpointMap is only used in the debug logging?
InternalEndPoints passes through
`org.apache.hadoop.ozone.recon.api.filters.ReconInternalComponentFilter` which
has "`HeatMapFilter`" as of now, later more filters can be added. This
`HeatMapFilter` `doFilter` check if "`solr.address`" is empty. If it is empty,
then httpResponse is set as Failed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]