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
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.HttpStatusCode; | |
import org.springframework.http.client.ClientHttpResponse; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
/** | |
* Wrapper for {@link ClientHttpResponse} that ensures clients can repeatedly read the given response body. |
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
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.type.TypeFactory; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.http.HttpMethod; | |
import org.springframework.http.HttpStatusCode; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.client.ClientHttpResponse; | |
import org.springframework.lang.NonNull; | |
import org.springframework.web.client.DefaultResponseErrorHandler; |
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
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
public abstract class AbstractTokenManager<T> { | |
private static final long MIN_MILLIS_INDICATING_REFRESHED = 10_000L; |
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
package nl.trifork.mapstruct; | |
import org.mapstruct.ap.spi.DefaultEnumMappingStrategy; | |
import javax.lang.model.element.AnnotationMirror; | |
import javax.lang.model.element.AnnotationValue; | |
import javax.lang.model.element.ExecutableElement; | |
import javax.lang.model.element.Name; | |
import javax.lang.model.element.TypeElement; | |
import java.io.IOException; |
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
@AutoConfiguration(before = io.awspring.cloud.autoconfigure.sqs.SqsAutoConfiguration.class, | |
afterName = "org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration") | |
@ConditionalOnBean(Tracing.class) | |
public class SqsTracingAutoConfiguration { | |
@Bean(name = SqsBeanNames.SQS_LISTENER_ANNOTATION_BEAN_POST_PROCESSOR_BEAN_NAME) | |
TracingSqsListenerAnnotationBeanPostProcessor tracingSLABPP(Tracing tracing) { | |
return new TracingSqsListenerAnnotationBeanPostProcessor(tracing); | |
} | |
static class TracingSqsListenerAnnotationBeanPostProcessor extends SqsListenerAnnotationBeanPostProcessor { |
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
@Bean | |
SqsTemplate sqsTemplate(SqsAsyncClient sqsAsyncClient, ObjectMapper objectMapper, Tracing tracing) { | |
var injector = tracing.propagation().injector( | |
(Propagation.Setter<Map<String, Object>, String>) (headersMap, key, value) -> { | |
// only propagate the traceparent attr, no additional baggage, since SQS only supports a max of 10 attrs | |
if (key.startsWith("trace")) headersMap.put(key, value); | |
}); | |
var converter = new SqsMessagingMessageConverter() { | |
@Override | |
public Message fromMessagingMessage(org.springframework.messaging.Message<?> message, MessageConversionContext context) { |
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
/** | |
* Starting with Boot 3, the {@code client.name} tag is no longer included by default | |
* in the {@code http.client.requests} metrics. Restore it by overriding | |
* {@link DefaultClientRequestObservationConvention#getLowCardinalityKeyValues(ClientRequestObservationContext)}. | |
* | |
* @return {@link ClientRequestObservationConvention} that adds the {@code client.name} to the low cardinality key-values. | |
*/ | |
@Bean | |
ClientRequestObservationConvention clientNameAddingObservationConvention() { | |
return new DefaultClientRequestObservationConvention() { |
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
import org.apache.catalina.connector.Connector; | |
import org.apache.coyote.AbstractProtocol; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | |
import org.springframework.boot.web.server.WebServerFactoryCustomizer; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Profile; |
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
import io.micrometer.core.instrument.Gauge; | |
import io.micrometer.core.instrument.MeterRegistry; | |
import io.micrometer.core.instrument.binder.BaseUnits; | |
import io.micrometer.core.instrument.binder.MeterBinder; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.util.ReflectionUtils; | |
import java.lang.reflect.Method; |
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
import org.slf4j.MDC; | |
import org.springframework.core.task.TaskDecorator; | |
import java.util.Map; | |
public class MDCPropagatingTaskDecorator implements TaskDecorator { | |
@Override | |
public Runnable decorate(Runnable runnable) { | |
Map<String, String> callerContext = MDC.getCopyOfContextMap(); |
NewerOlder