File tree Expand file tree Collapse file tree
paas_wl/workloads/tracing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515# We undertake not to change the open source license (MIT license) applicable
1616# to the current version of the project delivered to anyone in the future.
1717
18+ import socket
19+
1820from django .conf import settings
1921from opentelemetry import trace
2022from opentelemetry .exporter .otlp .proto .grpc .trace_exporter import OTLPSpanExporter
@@ -32,12 +34,15 @@ def setup_trace_config():
3234
3335 # Note: Since v1.35, the Jaeger supports OTLP natively. Please use the OTLP exporter instead.
3436 # pypi ref: https://pypi.org/project/opentelemetry-exporter-jaeger/
37+ host_ip = socket .gethostbyname (socket .gethostname ())
38+
3539 trace .set_tracer_provider (
3640 tracer_provider = TracerProvider (
3741 resource = Resource .create (
3842 {
3943 "service.name" : settings .OTEL_SERVICE_NAME ,
4044 "bk.data.token" : settings .OTEL_BK_DATA_TOKEN ,
45+ "net.host.ip" : host_ip ,
4146 },
4247 ),
4348 sampler = _KNOWN_SAMPLERS [settings .OTEL_SAMPLER ], # type: ignore
Original file line number Diff line number Diff line change 1515# We undertake not to change the open source license (MIT license) applicable
1616# to the current version of the project delivered to anyone in the future.
1717
18+ import socket
19+
1820from django .conf import settings
1921from opentelemetry import trace
2022from opentelemetry .exporter .otlp .proto .grpc .trace_exporter import OTLPSpanExporter
@@ -32,12 +34,15 @@ def setup_trace_config():
3234
3335 # Note: Since v1.35, the Jaeger supports OTLP natively. Please use the OTLP exporter instead.
3436 # pypi ref: https://pypi.org/project/opentelemetry-exporter-jaeger/
37+ host_ip = socket .gethostbyname (socket .gethostname ())
38+
3539 trace .set_tracer_provider (
3640 tracer_provider = TracerProvider (
3741 resource = Resource .create (
3842 {
3943 "service.name" : settings .OTEL_SERVICE_NAME ,
4044 "bk.data.token" : settings .OTEL_BK_DATA_TOKEN ,
45+ "host_ip" : host_ip ,
4146 },
4247 ),
4348 sampler = _KNOWN_SAMPLERS [settings .OTEL_SAMPLER ], # type: ignore
You can’t perform that action at this time.
0 commit comments