You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/sqs.adoc
+169
Original file line number
Diff line number
Diff line change
@@ -219,6 +219,18 @@ Such attributes are available as `MessageHeaders` in received messages.
219
219
#AUTO
220
220
|Set the ContentBasedDeduplication queue attribute value of the queues the template is sending messages to.
221
221
With `ContentBasedDeduplication#AUTO`, the queue attribute value will be resolved automatically.
222
+
223
+
|`observationRegistry`
224
+
|ObservationRegistry
225
+
|ObservationRegistry.NOOP
226
+
|Set the `ObservationRegistry` to be used for recording observations during message sending and receiving operations.
227
+
See <<Observability Support>> for more information.
228
+
229
+
|`observationConvention`
230
+
|ObservationConvention
231
+
|null
232
+
|Sets a custom `ObservationConvention` to be used for customizing observation key-value pairs.
233
+
See <<Observability Support>> for more information.
222
234
|===
223
235
224
236
[[sqs-send-message]]
@@ -817,6 +829,7 @@ The Spring Boot Starter for SQS provides the following auto-configuration proper
817
829
| <<maxMessagesPerPoll, `spring.cloud.aws.sqs.listener.max-messages-per-poll`>> | Maximum number of messages to be received per poll. | No | 10
818
830
| <<pollTimeout, `spring.cloud.aws.sqs.listener.poll-timeout`>> | Maximum amount of time to wait for messages in a poll. | No | 10 seconds
819
831
| `spring.cloud.aws.sqs.queue-not-found-strategy` | The strategy to be used by SqsTemplate and SqsListeners when a queue does not exist. | No | CREATE
832
+
| `spring.cloud.aws.sqs.observation-enabled` | Enables observability support for SQS operations. | No | false
820
833
|===
821
834
822
835
@@ -974,6 +987,18 @@ For `FIFO` queues, visibility is extended for all messages in a message group be
974
987
See <<FIFO Support>>.
975
988
Otherwise, visibility is specified once when polling SQS.
976
989
990
+
|`observationRegistry`
991
+
|`ObservationRegistry`
992
+
|`ObservationRegistry.NOOP`
993
+
|Sets the `ObservationRegistry` to be used for recording observations during message processing.
994
+
See <<Observability Support>>.
995
+
996
+
|`observationConvention`
997
+
|`ObservationConvention`
998
+
|`null`
999
+
|Sets a custom `ObservationConvention` to be used for customizing observation key-value pairs.
1000
+
See <<Observability Support>>.
1001
+
977
1002
|`queueNotFoundStrategy`
978
1003
|`FAIL`, `CREATE`
979
1004
|`CREATE`
@@ -1724,6 +1749,150 @@ There can be multiple `SqsAsyncClientCustomizer` beans present in single applica
1724
1749
Note that `SqsAsyncClientCustomizer` beans are applied **after** `AwsAsyncClientCustomizer` beans and therefore can overwrite previously set configurations.
1725
1750
1726
1751
1752
+
=== Observability Support
1753
+
1754
+
Spring Cloud AWS SQS supports observability through Micrometer's Observation API. This integration provides the ability to monitor and trace SQS operations throughout your application.
1755
+
1756
+
==== Enabling Observability
1757
+
1758
+
Observability can be enabled in a Spring Boot application by:
1759
+
1760
+
1. Setting the `spring.cloud.aws.sqs.observation-enabled` property to `true`
1761
+
2. Having a `ObservationRegistry` bean in your application context
1762
+
1763
+
When using direct SQS component configuration, observability can be enabled by:
1764
+
1765
+
1. Setting an `ObservationRegistry` in the container options or template options
1766
+
2. Optionally providing a custom `ObservationConvention` to customize the key-value pairs
Spring Cloud AWS SQS provides the following observations:
1789
+
1790
+
1. `spring.aws.sqs.template` - Records SQS operations performed through the `SqsTemplate`
1791
+
2. `spring.aws.sqs.listener` - Records message processing through the `SqsMessageListenerContainer`
1792
+
1793
+
Both observations include the following common tags:
1794
+
1795
+
Low cardinality tags:
1796
+
- `messaging.system`: "sqs"
1797
+
- `messaging.operation`: "publish" (template) or "receive" (listener)
1798
+
- `messaging.destination.name` or `messaging.source.name`: The queue name
1799
+
- `messaging.destination.kind` or `messaging.source.kind`: "queue"
1800
+
1801
+
High cardinality tags:
1802
+
- `messaging.message.id`: The SQS message ID from AWS.
1803
+
1804
+
For FIFO queues, the following additional high cardinality tags are included:
1805
+
- `messaging.message.message-group.id`: The message group ID
1806
+
- `messaging.message.message-deduplication.id`: The message deduplication ID
1807
+
1808
+
==== Customizing Observations
1809
+
1810
+
Custom observation conventions can be provided to add custom tags or replace the default ones with custom ones.
1811
+
1812
+
===== Adding Custom Tags
1813
+
1814
+
To add custom tags while preserving all default tags, the `DefaultConvention` classes can be extended and the `getCustomLowCardinalityKeyValues` and / or getCustomHighCardinalityKeyValues method overridden:
For regular blocking components such as message listeners, interceptors, and error handlers, observation scopes are automatically managed, so no further action is required.
1873
+
1874
+
For asynchronous variants of these components, the observation context is not automatically propagated between threads.
1875
+
However, the Observation object is injected in the message headers under the key `ObservationThreadLocalAccessor.KEY`.
1876
+
A scope can be manually opened in the new thread with the following approach:
1877
+
1878
+
```java
1879
+
// Set up the context registry with the appropriate accessors
Copy file name to clipboardExpand all lines: spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/sqs/SqsAutoConfiguration.java
0 commit comments