Skip to content

Shorten internal component names for graph #3128

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
merged 2 commits into from
Dec 19, 2019

Conversation

artembilan
Copy link
Member

@artembilan artembilan commented Dec 18, 2019

The long IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME name
is used for errorChannel LoggingHandler's endpoint.
It is too long for endpoint node in the graph meanwhile the
errorChannel is good everywhere

  • Change an IntegrationGraphServer logic to shorten internal
    component names before drawing a graph
  • Introduce IntegrationUtils.obtainComponentName() for
    shortening an internal name if any
  • Use IntegrationConfigUtils.BASE_PACKAGE in the IntegrationMBeanExporter
    instead of its own static property
  • Remove IntegrationConfigUtils.FACTORY_BEAN_OBJECT_TYPE in favor
    of introduced in SF FactoryBean.OBJECT_TYPE_ATTRIBUTE
  • Rework affected test classes to JUnit 5
  • Remove usage of deprecated options in the @EnableIntegrationManagement
  • Document names shortening feature for graph

The current picture has a not good label:

image

@@ -233,7 +233,7 @@ private void registerErrorChannel() {

BeanComponentDefinition componentDefinition =
new BeanComponentDefinition(loggingEndpointBuilder.getBeanDefinition(),
IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME);
"errorLogger", new String[] { IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME });
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... maybe too generic a name - likely to collide with a user bean.

default_errorLogger
integration_errorLogger
si_errorLogger
_si_errorLogger
...

might be better choices.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, my point is to align with the errorChannel indicating that this default logger is definitely tied with that global default channel.
Yes, it could collide with something in the target application, that why I'm targeting this for 5.3, so, we have a room for some breaking changes with an appropriate Migration Guide.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand your goal; but my point is that people will definitely use errorChannel in their configuration - particularly on gateways where they just want the error logged.

However, I doubt that anyone will explicitly reference the default error logger - hence its obscure name.

I just think it might be an unnecessary burden to break an app that already has a bean errorLogger that might not even be related to the Spring Integratin part of the application, especially when this change is really just to have a shorter name in the graph.

@artembilan
Copy link
Member Author

especially when this change is really just to have a shorter name in the graph.

Yes, you asked me to provide short names for those endpoints and that is where I was stuck 😄

And yeah, I did look at this like something what is not really a bean for end-user.
So, yeah. the name like default_integration_errorLogger should be good.

@kdvolder , tell us, please, how long the node name can be?

Thanks

@artembilan
Copy link
Member Author

@garyrussell ,

What if we do something similar for graph like we have in JMX:

private String getInternalComponentName(String name) {
	return name.substring(('_' + SI_PACKAGE).length() + 1);
}

This way we don't need to change a bean name for logger, but we will shorten it for UI like we do for JMX.

@garyrussell
Copy link
Contributor

Yes, that would work for me, but that code should be improved to check name.charAt(0) == '_' before substringing.

@artembilan
Copy link
Member Author

Yes, of course, this one is covered in JMX like this:

if (managedName != null && managedName.startsWith('_' + SI_PACKAGE)) {
	managedName = getInternalComponentName(managedName);
	managedType = "internal";
}

@artembilan artembilan changed the title Use errorLogger name for error logger endpoint Shorten internal component names for graph Dec 19, 2019
The long `IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME` name
is used for `errorChannel` `LoggingHandler`'s endpoint.
It is too long for endpoint node in the graph meanwhile the
`errorChannel` is good everywhere

* Change an `IntegrationGraphServer` logic to shorten internal
component names before drawing a graph
* Introduce `IntegrationUtils.obtainComponentName()` for
shortening an internal name if any
* Use `IntegrationConfigUtils.BASE_PACKAGE` in the `IntegrationMBeanExporter`
instead of its own static property
* Remove `IntegrationConfigUtils.FACTORY_BEAN_OBJECT_TYPE` in favor
of introduced in SF `FactoryBean.OBJECT_TYPE_ATTRIBUTE`
* Rework affected test classes to JUnit 5
* Remove usage of deprecated options in the `@EnableIntegrationManagement`
* Document names shortening feature for graph
Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

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

Just one

@garyrussell garyrussell merged commit 506aabb into spring-projects:5.3-WIP Dec 19, 2019
artembilan added a commit that referenced this pull request Dec 26, 2019
* Shorten internal component names for graph

The long `IntegrationContextUtils.ERROR_LOGGER_BEAN_NAME` name
is used for `errorChannel` `LoggingHandler`'s endpoint.
It is too long for endpoint node in the graph meanwhile the
`errorChannel` is good everywhere

* Change an `IntegrationGraphServer` logic to shorten internal
component names before drawing a graph
* Introduce `IntegrationUtils.obtainComponentName()` for
shortening an internal name if any
* Use `IntegrationConfigUtils.BASE_PACKAGE` in the `IntegrationMBeanExporter`
instead of its own static property
* Remove `IntegrationConfigUtils.FACTORY_BEAN_OBJECT_TYPE` in favor
of introduced in SF `FactoryBean.OBJECT_TYPE_ATTRIBUTE`
* Rework affected test classes to JUnit 5
* Remove usage of deprecated options in the `@EnableIntegrationManagement`
* Document names shortening feature for graph

* * Improve `obtainComponentName()` function
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.

2 participants