File tree 2 files changed +14
-6
lines changed
java/org/example/kafkauser/common/annotation/trace/config
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 20
20
* */
21
21
@ Configuration
22
22
public class TracingConfig {
23
- // @Value("${opentelemetry.tracer.exporter.otlp.endpoint}")
24
- // private String url;
23
+ @ Value ("${opentelemetry.tracer.exporter.otlp.endpoint}" )
24
+ private String url ;
25
25
26
26
@ Value ("${otel.resource.attributes.service.name}" )
27
27
private String serviceName ;
@@ -33,17 +33,17 @@ public class TracingConfig {
33
33
public OpenTelemetry openTelemetry () {
34
34
// OtlpHttpSpanExporter 객체를 생성하여 OTLP HTTP 엔드포인트에 데이터 전송 설정.
35
35
// `url`은 OTLP Collector 엔드포인트 주소.
36
- // OtlpHttpSpanExporter spanExporter = OtlpHttpSpanExporter.builder()
37
- // .setEndpoint(url) // OTLP HTTP 수집기가 위치한 URL을 설정합니다.
38
- // .build();
36
+ OtlpHttpSpanExporter spanExporter = OtlpHttpSpanExporter .builder ()
37
+ .setEndpoint (url ) // OTLP HTTP 수집기가 위치한 URL을 설정합니다.
38
+ .build ();
39
39
40
40
// SdkTracerProvider 생성. 이는 OpenTelemetry SDK 의 트레이싱 구성 요소로, SpanProcessor와 리소스를 설정.
41
41
SdkTracerProvider tracerProvider = SdkTracerProvider .builder ()
42
42
.setResource (Resource .create (io .opentelemetry .api .common .Attributes .of (
43
43
// 서비스의 이름을 설정하여 각 Span에 서비스 정보를 포함시킴
44
44
ResourceAttributes .SERVICE_NAME , serviceName )))
45
45
// BatchSpanProcessor를 추가하여 Span을 일괄 처리하고 `spanExporter`로 전송.
46
- // .addSpanProcessor(BatchSpanProcessor.builder(spanExporter).build())
46
+ .addSpanProcessor (BatchSpanProcessor .builder (spanExporter ).build ())
47
47
.build ();
48
48
49
49
// OpenTelemetrySdk 객체 생성. 이를 통해 OpenTelemetry 추적 및 컨텍스트 전파 기능 구성.
Original file line number Diff line number Diff line change 40
40
attributes :
41
41
service.name : ${SERVICE_NAME}
42
42
43
+
44
+ opentelemetry :
45
+ tracer :
46
+ exporter :
47
+ otlp :
48
+ endpoint : ${OTEL_ENDPOINT}
49
+ protocol : ${OTEL_PROTOCOL}
50
+
43
51
grpc :
44
52
server :
45
53
port : 9090
You can’t perform that action at this time.
0 commit comments