Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* GH-1444: Listener Observability Initial Commit - expand scope to include error handler: #1287 - tracing can't be used with a batch listener (multiple messages in listener call) * Rename Sender/Receiver contexts and other PR review comments. * Rename contexts to Rabbit...; supply default KeyValues via the conventions. * Javadoc polishing. * Don't add default KV to high-card KVs. * Fix previous commit. * Fix contextual name (receiver side). * Fix checkstyle. * Polish previous commit. * Fix contextual name (sender side) * Remove contextual names from observations. * Fix checkstyle. * Remove customization of KeyValues from conventions. * Add `getDefaultConvention()` to observations. * Fix since 3.0. * Support wider convention customization. * Convention type safety. * Fix Test - not sure why PR build succeeded. * Add Meters to ObservationTests. * Fix checkstyle. * Make INSTANCE final. * Add integration test. * Test all available integrations. * Remove redundant test code. * Move getContextualName to conventions. * Add docs. * Fix doc link. Co-authored-by: Artem Bilan <abilan@vmware.com> * Remove unnecessary method overrides; make tag names more meaningful. * Move getName() from contexts to conventions. * Fix Race in Test * Fix Race in Test. Co-authored-by: Artem Bilan <abilan@vmware.com>
- Loading branch information
1 parent
80f8c9c
commit 66e5c11
Showing
17 changed files
with
1,043 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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.