mlbiscoc commented on code in PR #3671:
URL: https://github.com/apache/solr/pull/3671#discussion_r2364339895
##########
solr/core/src/java/org/apache/solr/core/SolrCore.java:
##########
@@ -555,6 +557,25 @@ public void setName(String v) {
assert this.name != null;
assert coreDescriptor.getCloudDescriptor() == null : "Cores are not
renamed in SolrCloud";
this.name = Objects.requireNonNull(v);
+ initCoreAttributes();
+ }
+
+ public Attributes getCoreAttributes() {
+ return coreAttributes;
+ }
+
+ public void initCoreAttributes() {
+ this.coreAttributes =
+ (coreContainer.isZooKeeperAware())
+ ? Attributes.builder()
+ .put(COLLECTION_ATTR, coreDescriptor.getCollectionName())
+ .put(CORE_ATTR, getName())
+ .put(SHARD_ATTR,
coreDescriptor.getCloudDescriptor().getShardId())
+ .put(
+ REPLICA_ATTR,
+
Utils.parseMetricsReplicaName(coreDescriptor.getCollectionName(), getName()))
+ .build()
+ : Attributes.builder().put(CORE_ATTR, getName()).build();
Review Comment:
I noticed that I set core attributes quite a bit so I made I initialized it
as its own member and a getter method. Make it easier to add or remove core
attributes in the future as well.
--
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]