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
+171Lines changed: 171 additions & 0 deletions
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]]
@@ -819,6 +831,7 @@ The Spring Boot Starter for SQS provides the following auto-configuration proper
819
831
| <<pollTimeout, `spring.cloud.aws.sqs.listener.poll-timeout`>> | Maximum amount of time to wait for messages in a poll. | No | 10 seconds
820
832
| <<maxDelayBetweenPolls, `spring.cloud.aws.sqs.listener.max-delay-between-polls`>> | Maximum amount of time to wait between polls. | No | 10 seconds
821
833
| `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
834
+
| `spring.cloud.aws.sqs.observation-enabled` | Enables observability support for SQS operations. | No | false
822
835
|===
823
836
824
837
@@ -976,6 +989,18 @@ For `FIFO` queues, visibility is extended for all messages in a message group be
976
989
See <<FIFO Support>>.
977
990
Otherwise, visibility is specified once when polling SQS.
978
991
992
+
|`observationRegistry`
993
+
|`ObservationRegistry`
994
+
|`ObservationRegistry.NOOP`
995
+
|Sets the `ObservationRegistry` to be used for recording observations during message processing.
996
+
See <<Observability Support>>.
997
+
998
+
|`observationConvention`
999
+
|`ObservationConvention`
1000
+
|`null`
1001
+
|Sets a custom `ObservationConvention` to be used for customizing observation key-value pairs.
1002
+
See <<Observability Support>>.
1003
+
979
1004
|`queueNotFoundStrategy`
980
1005
|`FAIL`, `CREATE`
981
1006
|`CREATE`
@@ -1803,6 +1828,152 @@ There can be multiple `SqsAsyncClientCustomizer` beans present in single applica
1803
1828
Note that `SqsAsyncClientCustomizer` beans are applied **after** `AwsAsyncClientCustomizer` beans and therefore can overwrite previously set configurations.
1804
1829
1805
1830
1831
+
=== Observability Support
1832
+
1833
+
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.
1834
+
1835
+
==== Enabling Observability
1836
+
1837
+
Observability can be enabled in a Spring Boot application by:
1838
+
1839
+
1. Setting the `spring.cloud.aws.sqs.observation-enabled` property to `true`
1840
+
2. Having a `ObservationRegistry` bean in your application context
1841
+
1842
+
When using direct SQS component configuration, observability can be enabled by:
1843
+
1844
+
1. Setting an `ObservationRegistry` in the container options or template options
1845
+
2. Optionally providing a custom `ObservationConvention` to customize the key-value pairs
Spring Cloud AWS SQS provides the following observations:
1868
+
1869
+
1. `spring.aws.sqs.template` - Records SQS operations performed through the `SqsTemplate`
1870
+
2. `spring.aws.sqs.listener` - Records message processing through the `SqsMessageListenerContainer`
1871
+
1872
+
Both observations include the following common tags:
1873
+
1874
+
Low cardinality tags:
1875
+
- `messaging.system`: "sqs"
1876
+
- `messaging.operation`: "publish" (template) or "receive" (listener)
1877
+
- `messaging.destination.name` or `messaging.source.name`: The queue name
1878
+
- `messaging.destination.kind` or `messaging.source.kind`: "queue"
1879
+
1880
+
High cardinality tags:
1881
+
- `messaging.message.id`: The SQS message ID from AWS.
1882
+
1883
+
For FIFO queues, the following additional high cardinality tags are included:
1884
+
- `messaging.message.message-group.id`: The message group ID
1885
+
- `messaging.message.message-deduplication.id`: The message deduplication ID
1886
+
1887
+
==== Customizing Observations
1888
+
1889
+
Custom observation conventions can be provided to add custom tags or replace the default ones with custom ones.
1890
+
1891
+
===== Adding Custom Tags
1892
+
1893
+
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, and no further action is required.
1952
+
1953
+
Remote baggage propagation is supported through the "baggage" message header.
1954
+
1955
+
For asynchronous variants of these components, the observation context is not automatically propagated between threads.
1956
+
However, the Observation object is injected in the message headers under the key `ObservationThreadLocalAccessor.KEY`.
1957
+
A scope can be manually opened in the new thread with the following approach:
1958
+
1959
+
```java
1960
+
// 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