Skip to content

Conversation

@quaff
Copy link
Contributor

@quaff quaff commented May 31, 2023

After this commit, LettuceObservationContext.setParentObservation() is called right after Context rather than Observation created, then Context.getParentObservation() could be used in ObservationPredicate to determine whether Observation should be created, for example, we can filter out parentless lettuce observations like this:

	@Bean
	ObservationPredicate noParentlessLettuceObservations() {
		return (name, context) -> {
			if (context instanceof LettuceObservationContext) {
				return context.getParentObservation() != null;
			}
			return true;
		};
	}

Fix GH-2591

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 31, 2023
After this commit, LettuceObservationContext.setParentObservation() is called right after Context rather than Observation created, then Context.getParentObservation() could be used in ObservationPredicate to determine whether Observation should be created.

Fix spring-projectsGH-2591
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 5, 2023
@mp911de mp911de changed the title Construct LettuceObservationContext with parent observation Construct LettuceObservationContext with parent observation Jun 5, 2023
@mp911de mp911de added this to the 3.1.1 (2023.0.1) milestone Jun 8, 2023
mp911de pushed a commit that referenced this pull request Jun 8, 2023
After this commit, LettuceObservationContext.setParentObservation() is called right after Context rather than Observation created, then Context.getParentObservation() could be used in ObservationPredicate to determine whether Observation should be created.

Fixes #2591
Original pull request: #2592
mp911de added a commit that referenced this pull request Jun 8, 2023
Reformat code. Fix typo.

See #2591
Original pull request: #2592
mp911de pushed a commit that referenced this pull request Jun 8, 2023
After this commit, LettuceObservationContext.setParentObservation() is called right after Context rather than Observation created, then Context.getParentObservation() could be used in ObservationPredicate to determine whether Observation should be created.

Fixes #2591
Original pull request: #2592
mp911de added a commit that referenced this pull request Jun 8, 2023
Reformat code. Fix typo.

See #2591
Original pull request: #2592
@mp911de
Copy link
Member

mp911de commented Jun 8, 2023

Thank you for your contribution. That's merged, polished, and backported now.

@mp911de mp911de closed this Jun 8, 2023
jxblum pushed a commit to jxblum/spring-data-redis that referenced this pull request Jun 8, 2023
After this commit, LettuceObservationContext.setParentObservation() is called right after Context rather than Observation created, then Context.getParentObservation() could be used in ObservationPredicate to determine whether Observation should be created.

Fixes spring-projects#2591
Original pull request: spring-projects#2592
jxblum pushed a commit to jxblum/spring-data-redis that referenced this pull request Jun 8, 2023
Reformat code. Fix typo.

See spring-projects#2591
Original pull request: spring-projects#2592
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.

LettuceObservationContext should be constructed with parent Observation if exists

3 participants