-
Notifications
You must be signed in to change notification settings - Fork 138
/
applicationContext.xml
89 lines (81 loc) · 4.06 KB
/
applicationContext.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<!-- Configuration for how to send spans to Zipkin -->
<bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
<property name="endpoint" value="${zipkin.baseUrl:http://127.0.0.1:9411}/api/v2/spans"/>
</bean>
<!-- Configuration for how to buffer spans into messages for Zipkin -->
<bean id="zipkinSpanHandler" class="zipkin2.reporter.beans.AsyncZipkinSpanHandlerFactoryBean">
<property name="sender" ref="sender"/>
<!-- wait up to half a second for any in-flight spans on close -->
<property name="closeTimeout" value="500"/>
</bean>
<!-- Defines a propagated field "userName" that uses the remote header "user_name" -->
<bean id="userNameBaggageField" class="brave.baggage.BaggageField" factory-method="create">
<constructor-arg value="userName"/>
</bean>
<bean id="propagationFactory" class="brave.spring.beans.BaggagePropagationFactoryBean">
<property name="configs">
<bean class="brave.spring.beans.SingleBaggageFieldFactoryBean">
<property name="field" ref="userNameBaggageField"/>
<property name="keyNames" value="user_name"/>
</bean>
</property>
</bean>
<!-- Allows log patterns to use %{traceId} %{spanId} and %{userName} -->
<bean id="correlationScopeDecorator"
class="brave.spring.beans.CorrelationScopeDecoratorFactoryBean">
<property name="builder">
<bean class="brave.context.log4j12.MDCScopeDecorator" factory-method="newBuilder"/>
</property>
<property name="configs">
<list>
<bean class="brave.spring.beans.SingleCorrelationFieldFactoryBean">
<property name="baggageField">
<util:constant static-field="brave.baggage.BaggageFields.TRACE_ID"/>
</property>
</bean>
<bean class="brave.spring.beans.SingleCorrelationFieldFactoryBean">
<property name="baggageField">
<util:constant static-field="brave.baggage.BaggageFields.SPAN_ID"/>
</property>
</bean>
<bean class="brave.spring.beans.SingleCorrelationFieldFactoryBean">
<property name="baggageField" ref="userNameBaggageField"/>
</bean>
</list>
</property>
</bean>
<!-- allows us to read the service name from spring config -->
<context:property-placeholder/>
<!-- Controls aspects of tracing such as the service name that shows up in the UI -->
<bean id="tracing" class="brave.spring.beans.TracingFactoryBean">
<property name="localServiceName" value="${brave.localServiceName}"/>
<property name="supportsJoin" value="${brave.supportsJoin:true}"/>
<property name="traceId128Bit" value="${brave.traceId128Bit:false}"/>
<property name="propagationFactory" ref="propagationFactory"/>
<property name="currentTraceContext">
<bean class="brave.spring.beans.CurrentTraceContextFactoryBean">
<property name="scopeDecorators" ref="correlationScopeDecorator"/>
</bean>
</property>
<property name="spanHandlers" ref="zipkinSpanHandler"/>
</bean>
<!-- Allows someone to add tags to a span if a trace is in progress, via SpanCustomizer -->
<bean id="spanCustomizer" class="brave.CurrentSpanCustomizer" factory-method="create">
<constructor-arg index="0" ref="tracing"/>
</bean>
<!-- Decides how to name and tag spans. By default they are named the same as the HTTP method. -->
<bean id="httpTracing" class="brave.spring.beans.HttpTracingFactoryBean">
<property name="tracing" ref="tracing"/>
</bean>
</beans>