Skip to content

Conversation

gregturn
Copy link
Contributor

CC @marcingrzejszczak

This one is MUCH easier to use. I also updated the documentation to illustrate its usage.

@gregturn gregturn added the type: enhancement A general enhancement label Oct 21, 2022
@gregturn gregturn requested a review from mp911de October 21, 2022 00:02
@gregturn gregturn self-assigned this Oct 21, 2022
Comment on lines 65 to 72
CommandLineRunner initData(EmployeeRepository repository, ObservationRegistry registry) { // <1>
Observation observation = Observation.start("init-database", registry); // <2>
try (Observation.Scope scope = observation.openScope()) { // <3>
return args -> {
repository.save(new Employee("1", "Frodo", "ring bearer"));
repository.save(new Employee("2", "Bilbo", "burglar"));
};
} catch (Exception e) {
observation.error(e); // <4>
throw e;
} finally {
observation.stop(); // <5>
}
}
Copy link

Choose a reason for hiding this comment

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

I think wrapping inside of the lambda is more appropriate to capture the observation for this operations.

CommandLineRunner initData(EmployeeRepository repository, ObservationRegistry registry) { // <1> return args -> { Observation observation = Observation.start("init-database", registry); // <2> try (Observation.Scope scope = observation.openScope()) { // <3> repository.save(new Employee("1", "Frodo", "ring bearer")); repository.save(new Employee("2", "Bilbo", "burglar")); } catch (Exception e) { observation.error(e); // <4> throw e; } finally { observation.stop(); // <5> } };
Copy link
Contributor

Choose a reason for hiding this comment

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

BTW why not just call Observation.createNotStarted("init-database"), registry).observe(() -> { repository.save(.....); } ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea.

@mp911de mp911de added this to the 4.0 RC2 (2022.0.0) milestone Oct 24, 2022
mp911de pushed a commit that referenced this pull request Oct 24, 2022
mp911de added a commit that referenced this pull request Oct 24, 2022
Add request tracker integration to capture completion/error responses. Add reactive integration. Properly observe prepare requests. Simplify documentation. See #1321 Original pull request: #1322
mp911de added a commit that referenced this pull request Oct 24, 2022
mp911de added a commit that referenced this pull request Oct 24, 2022
@mp911de
Copy link
Member

mp911de commented Oct 24, 2022

That's merged and polished now.

@mp911de mp911de closed this Oct 24, 2022
@mp911de mp911de deleted the issue/gh-1321 branch October 24, 2022 12:54
mp911de added a commit that referenced this pull request Oct 24, 2022
mp911de added a commit that referenced this pull request Oct 25, 2022
Introduce factory beans for easier wrapping of CqlSession. See #1321 Original pull request: #1322
mp911de added a commit that referenced this pull request Oct 25, 2022
Introduce factory beans for easier wrapping of CqlSession. See #1321 Original pull request: #1322
mp911de added a commit that referenced this pull request Oct 25, 2022
Introduce factory beans for easier wrapping of CqlSession. See #1321 Original pull request: #1322
mp911de added a commit that referenced this pull request Oct 25, 2022
Remove unused code. See #1321 Original pull request: #1322
gregturn added a commit that referenced this pull request Oct 25, 2022
Adjust visibility of CassandraObservationSupplier. See #1321 Original pull request: #1322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

4 participants