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

Alfredops 715 fix ass 2.0.0 #74

Merged
merged 7 commits into from
Mar 22, 2021
Merged

Conversation

anghelutar
Copy link
Contributor

Starting with ASS 2.0 some methods changed in SolrInformationServer, more specifically the FTS counts.
Use dynamic invocation to call the appopriate method, so that alfred-telemetry-solr6 can be packaged as a single jar.

Use the already imported file solrconfig_insights.xml to add the micrometer-related functionality.
Note: I tried to use config overlays (REST calls via the micrometer init script), but it breaks the alfresco-specific solr, although resources are correctly added.

…more specifically the FTS counts.

Use dynamic invocation to call the appopriate method.
…ometer-related functionality.

Note: I tried to use config overlays (REST calls via the micrometer init script), but it breaks the alfresco-specific solr (although resources are correctly added).
Alfresco-solr explicitelly dissalows this by setting -Ddisable.configEdit=true.

public class SolrMetrics implements MeterBinder {

AlfrescoCoreAdminHandler coreAdminHandler;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be private ?

Copy link
Contributor Author

@anghelutar anghelutar Mar 19, 2021

Choose a reason for hiding this comment

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

Why? It is used outside package.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any package-usages ? 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's used by eu.xenit.alfred.telemetry.solr.monitoring.handler.MicrometerHandler, outside the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will merge now and come back to this later if needed

Copy link
Contributor

Choose a reason for hiding this comment

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

If used elsewhere, please create and use an accessor.

https://stackoverflow.com/a/1568230

Copy link
Contributor

@tgeens tgeens left a comment

Choose a reason for hiding this comment

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

+205 -1995 lines - that's nice ;-)

@anghelutar
Copy link
Contributor Author

+205 -1995 lines - that's nice ;-)

No comment about high-jacking solr's insight.xml file?

@anghelutar anghelutar merged commit 414324b into master Mar 22, 2021
@anghelutar anghelutar deleted the ALFREDOPS-715-fix-ass-2.0.0 branch March 22, 2021 08:55
Copy link
Contributor

@kerkhofsd kerkhofsd left a comment

Choose a reason for hiding this comment

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

Cleanup necessary.

@@ -18,7 +18,7 @@
AlfrescoCoreAdminHandler coreAdminHandler;
MeterRegistry registry;

Logger logger = LoggerFactory.getLogger(SolrMetrics.class);
Logger logger = LoggerFactory.getLogger(SolrTrackerMetrics.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Logger should be at least private, preferably also static final

  • private - so that no other class can hijack your logger
  • static - so there is only one logger instance per class, also avoiding attempts to serialize loggers
  • final - no need to change the logger over the lifetime of the class

https://stackoverflow.com/a/6653577


public class SolrMetrics implements MeterBinder {

AlfrescoCoreAdminHandler coreAdminHandler;
Copy link
Contributor

Choose a reason for hiding this comment

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

If used elsewhere, please create and use an accessor.

https://stackoverflow.com/a/1568230


@Override
public void bindTo(MeterRegistry registry) {
if(Util.isEnabled("METRICS_SOLR_CORESTATS_ENABLED"))
Copy link
Contributor

@kerkhofsd kerkhofsd Mar 22, 2021

Choose a reason for hiding this comment

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

Thread.currentThread().sleep(10_000);
trackerRegistry = coreAdminHandler.getTrackerRegistry();
} catch (InterruptedException e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a logger to log catched exceptions.

@kerkhofsd
Copy link
Contributor

Oh, seems I was to late here 🙃 .

Can we please cleanup this code anyway? According to Xenit code style conventions and best practices...
Thanks.

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.

4 participants