Skip to content

Commit e1842ed

Browse files
Fix infinite recursion bug when getting tracer (#760)
Co-authored-by: Bryce Buchanan <[email protected]>
1 parent 1290c9f commit e1842ed

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

Sources/OpenTelemetryApi/Trace/TracerProvider.swift

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,40 @@ public protocol TracerProvider {
1313
/// - instrumentationVersion: The version of the instrumentation library (e.g., "semver:1.0.0"). Optional
1414
/// - schemaUrl: The schema url. Optional
1515
/// - attributes: attributes to be associated with span created by this tracer. Optional
16-
func get(
17-
instrumentationName: String,
18-
instrumentationVersion: String?,
19-
schemaUrl: String?,
20-
attributes: [String: AttributeValue]?
21-
) -> any Tracer
16+
func get(instrumentationName: String,
17+
instrumentationVersion: String?,
18+
schemaUrl: String?,
19+
attributes: [String: AttributeValue]?) -> any Tracer
2220
}
2321

2422
public extension TracerProvider {
23+
func get(instrumentationName: String) -> any Tracer {
24+
get(
25+
instrumentationName: instrumentationName,
26+
instrumentationVersion: nil,
27+
schemaUrl: nil,
28+
attributes: nil
29+
)
30+
}
31+
32+
func get(instrumentationName: String,
33+
instrumentationVersion: String?) -> any Tracer {
34+
get(
35+
instrumentationName: instrumentationName,
36+
instrumentationVersion: instrumentationVersion,
37+
schemaUrl: nil,
38+
attributes: nil
39+
)
40+
}
41+
2542
func get(instrumentationName: String,
26-
instrumentationVersion: String? = nil,
27-
schemaUrl: String? = nil,
28-
attributes: [String: AttributeValue]? = nil) -> any Tracer {
29-
return get(
43+
instrumentationVersion: String?,
44+
schemaUrl: String?) -> any Tracer {
45+
get(
3046
instrumentationName: instrumentationName,
3147
instrumentationVersion: instrumentationVersion,
3248
schemaUrl: schemaUrl,
33-
attributes: attributes
49+
attributes: nil
3450
)
3551
}
3652
}

0 commit comments

Comments
 (0)