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

Add standardized property to distinguish a group of applications #39957

Closed
wants to merge 1 commit into from

Conversation

wanger26
Copy link
Contributor

Change Summary

  • Add a standardized property to provide some indicator that a set of applications are part of a larger "business application" so that they can be viewed in metrics, portals, traces and more

Issue

@wanger26 wanger26 marked this pull request as draft March 17, 2024 01:31
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 17, 2024
@wilkinsona wilkinsona changed the title FEAT - Add standardized property to distinguish a group of applications Add standardized property to distinguish a group of applications Mar 18, 2024
@wilkinsona
Copy link
Member

Thanks for the PR, @wanger26. You've marked it as a draft but it looks pretty complete to me. Did you have some other changes in mind that you wanted to make before it's ready for review?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Jun 4, 2024
@wanger26
Copy link
Contributor Author

wanger26 commented Jun 5, 2024

Sorry for the delay on this PR @wilkinsona, I have completed all the changes I was hoping to make but was holding off on publishing the PR until I got a green build. I was hoping to pick this up at some point this week and get the build green.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 5, 2024
@wanger26 wanger26 marked this pull request as ready for review June 8, 2024 17:49
- Add a standardized property to provide some indicator that a set of applications are part of a larger "business application" so that they can be viewed in metrics, portals, traces and more

spring-projects#39913

Signed-off-by: Jakob Wanger <jakobwanger@gmail.com>
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Jun 10, 2024
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided for: team-meeting An issue we'd like to discuss as a team to make progress labels Jun 19, 2024
@philwebb philwebb added this to the 3.4.x milestone Jun 19, 2024
/**
* Default value for application group if {@code spring.application.group} is not set.
*/
private static final String DEFAULT_APPLICATION_GROUP = "unknown_group";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think default is better than unknown here.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree. unknown_group aligns with the existing unknown_service that's used when there's no application name.

Copy link
Contributor

Choose a reason for hiding this comment

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

unknown_group aligns with the existing unknown_service that's used when there's no application name.

It should defaults to a more meaningful name, for example the default namespace in kubernetes is default not unknown.
Most of applications will specify their own spring.application.name but leave spring.application.group absent, they are not equal in nature, I don't think it make sense to align them.

Copy link
Member

Choose a reason for hiding this comment

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

I'm afraid I still disagree. This feature isn't specific to Kubernetes so aligning with its default namespace does not make sense. Furthermore, it isn't a default group but an indication that we do not know the application's group. As such, I think unknown_group is more meaningful as it accurately reflects the situation that we're in.

Choose a reason for hiding this comment

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

The service name is supposed to be unique per application. It not being specified means that it is indeed unknown, as there cannot be any sensible default value that actually makes sense. The groups are shared, so it not being specified is a pretty good indicator that it belongs to the (shared) default group, not the shared unknown group. unknown_group makes it seem like there is something wrong with the application configuration, whereas you have just opted to not specify an actual group.

Copy link
Member

Choose a reason for hiding this comment

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

It not being specified means that it is indeed unknown, as there cannot be any sensible default value that actually makes sense.

That is the case here.

The groups are shared, so it not being specified is a pretty good indicator that it belongs to the (shared) default group

There's no "the groups" here. As described in #39913, a group can be a company, org, or team, or pretty much whatever else makes sense for grouping a set of applications. There's no concept of a default group as we don't know that such a thing makes sense in any given deployment environment.

unknown_group makes it seem like there is something wrong with the application configuration, whereas you have just opted to not specify an actual group.

"unknown" doesn't imply that something is wrong, all it means is that the group is unknown. I think that accurately reflects the situation as the group really is not known.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO Tag service.group shouldn't be added if it's unknown_group, It doesn't make sense from observation perspective but increase network packet size.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. We only set service.name to unknown_application because it's a required attribute in otel. This isn't the case for service.group, so we can just omit it, if it's not set.

----

NOTE: In the example above, configprop:logging.include-application-name[] is set to `false` to avoid the application name being duplicated in the log messages (configprop:logging.pattern.correlation[] already contains it).
NOTE: In the example above, configprop:logging.include-application-name[] and configprop:logging.include-application-group[] is set to `false` to avoid the application name being duplicated in the log messages (configprop:logging.pattern.correlation[] already contains it).
Copy link
Member

Choose a reason for hiding this comment

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

include-application-group does not need to be set to false here as the preceding example of a custom correlation pattern doesn't include spring.application.group. The example shouldn't be changed as it matches Spring Cloud Sleuth's behavior. I think the change on this line should be reverted instead.

@@ -6,15 +6,16 @@ Default logback configuration provided for import

<included>
<conversionRule conversionWord="applicationName" converterClass="org.springframework.boot.logging.logback.ApplicationNameConverter" />
<conversionRule conversionWord="applicationGroup" converterClass="org.springframework.boot.logging.logback.ApplicationGroupConverter" />
Copy link
Member

@wilkinsona wilkinsona Jun 24, 2024

Choose a reason for hiding this comment

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

Minor nit: these rules are ordered based on the conversion word so applicationGroup should go before applicationName.

@mhalbritter mhalbritter self-assigned this Jul 3, 2024
mhalbritter pushed a commit that referenced this pull request Jul 3, 2024
This adds a property to provide some indicator that a set of
applications are part of a larger "business application" so that they
can be viewed in metrics, portals, traces and more.

See gh-39957
@mhalbritter
Copy link
Contributor

Thanks! I've polished quite a bit in de001f5, e.g. removing the service.group from OTel if the group property isn't set, and I also removed the duplicate logging of thread name in both Logback and Log4j.

@mhalbritter mhalbritter modified the milestones: 3.4.x, 3.4.0-M1 Jul 3, 2024
snicoll pushed a commit that referenced this pull request Sep 19, 2024
snicoll added a commit that referenced this pull request Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants