Skip to content

Commit dcfd501

Browse files
committed
zipkin use configured serviceName at first span
1 parent c7eb143 commit dcfd501

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Exporters/Zipkin/Implementation/ZipkinConversionExtension.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ struct ZipkinConversionExtension {
2121
static var localEndpointCache = [String: ZipkinEndpoint]()
2222
static var remoteEndpointCache = [String: ZipkinEndpoint]()
2323

24+
static let defaultServiceName = "unknown_service:" + ProcessInfo.processInfo.processName
25+
2426
struct AttributeEnumerationState {
2527
var tags = [String: String]()
2628
var RemoteEndpointServiceName: String?
@@ -44,10 +46,12 @@ struct ZipkinConversionExtension {
4446

4547
var localEndpoint = defaultLocalEndpoint
4648

47-
if let serviceName = attributeEnumerationState.serviceName, !serviceName.isEmpty {
49+
if let serviceName = attributeEnumerationState.serviceName, !serviceName.isEmpty && !defaultServiceName.elementsEqual(serviceName) {
4850
if localEndpointCache[serviceName] == nil {
4951
localEndpoint = defaultLocalEndpoint.clone(serviceName: serviceName)
5052
localEndpointCache[serviceName] = localEndpoint
53+
} else {
54+
localEndpoint = localEndpointCache[serviceName]
5155
}
5256
}
5357

0 commit comments

Comments
 (0)