-
Notifications
You must be signed in to change notification settings - Fork 636
GH-1444: Listener Observability Initial Commit #1500
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
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
6f35711
GH-1444: Listener Observability Initial Commit
garyrussell 3c767f1
Rename Sender/Receiver contexts and other PR review comments.
garyrussell 0886783
Rename contexts to Rabbit...; supply default KeyValues via the conven…
garyrussell 355f5db
Javadoc polishing.
garyrussell b39a5f9
Don't add default KV to high-card KVs.
garyrussell 393ed51
Fix previous commit.
garyrussell c282d46
Fix contextual name (receiver side).
garyrussell c5b2975
Fix checkstyle.
garyrussell 9de2da2
Polish previous commit.
garyrussell 55f0437
Fix contextual name (sender side)
garyrussell 3079268
Remove contextual names from observations.
garyrussell 0cf3e55
Fix checkstyle.
garyrussell d929b0f
Remove customization of KeyValues from conventions.
garyrussell b1bd023
Add `getDefaultConvention()` to observations.
garyrussell be4be28
Fix since 3.0.
garyrussell d422412
Support wider convention customization.
garyrussell d762752
Convention type safety.
garyrussell f1ac117
Fix Test - not sure why PR build succeeded.
garyrussell 03ccb33
Add Meters to ObservationTests.
garyrussell 2557794
Fix checkstyle.
garyrussell 970ba6c
Make INSTANCE final.
garyrussell a528d09
Add integration test.
garyrussell 1927f3b
Test all available integrations.
garyrussell cb6ba4c
Remove redundant test code.
garyrussell d0b758e
Move getContextualName to conventions.
garyrussell 0043280
Add docs.
garyrussell 599d5b7
Fix doc link.
garyrussell 38589a0
Remove unnecessary method overrides; make tag names more meaningful.
garyrussell d5464ab
Move getName() from contexts to conventions.
garyrussell 4ec81a1
Fix Race in Test
garyrussell 2651f1c
Fix Race in Test.
garyrussell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...gframework/amqp/rabbit/support/micrometer/DefaultRabbitListenerObservationConvention.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2022 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.amqp.rabbit.support.micrometer; | ||
|
||
import io.micrometer.common.KeyValues; | ||
|
||
/** | ||
* Default {@link RabbitListenerObservationConvention} for Rabbit listener key values. | ||
* | ||
* @author Gary Russell | ||
* @since 3.0 | ||
* | ||
*/ | ||
public class DefaultRabbitListenerObservationConvention implements RabbitListenerObservationConvention { | ||
|
||
/** | ||
* A singleton instance of the convention. | ||
*/ | ||
public static final DefaultRabbitListenerObservationConvention INSTANCE = | ||
new DefaultRabbitListenerObservationConvention(); | ||
|
||
@Override | ||
public KeyValues getLowCardinalityKeyValues(RabbitMessageReceiverContext context) { | ||
return KeyValues.of(RabbitListenerObservation.ListenerLowCardinalityTags.LISTENER_ID.asString(), | ||
context.getListenerId()); | ||
} | ||
|
||
@Override | ||
public String getContextualName(RabbitMessageReceiverContext context) { | ||
return context.getSource() + " receive"; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we took a
Supplier<Context>
here instead ofContext
where the supplier was only called ifObservationRegistry
wasn't a no-op, and therefore theContext
object wouldn't be allocated in the no-op case, would that simplify things for you? I think then you wouldn't need the if-else this is contained in, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me as well. And I probably agree with @marcingrzejszczak as well.
Only the problem that @garyrussell is off today and next Monday is release day.
I can fix this quickly myself, but we have to be sure that this one is good to go for merging.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, we could just use a singleton for the No-op case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget that, I shouldn’t comment from my iPad while not working. I see your point about them if/else.
we can go with this as is for Monday’s milestone and Polish later if you add the supplier variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one, Gary, in the
DocumentedObservation
:I'm not sure why name is like that, but looks like it does exactly what is expected from us here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're working on unifying the names. Sorry about the commotion cc @ttddyy