Skip to content

Commit

Permalink
Set timeout for HTTP request in StableOtlpHttpMetricExporter (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
redryerye authored Apr 25, 2024
1 parent 63d579a commit 62772bd
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class StableOtlpHTTPMetricExporter: StableOtlpHTTPExporterBase, StableMet
$0.resourceMetrics = MetricsAdapter.toProtoResourceMetrics(stableMetricData: sendingMetrics)
}

let request = createRequest(body: body, endpoint: endpoint)
var request = createRequest(body: body, endpoint: endpoint)
request.timeoutInterval = min(TimeInterval.greatestFiniteMagnitude, config.timeout)
httpClient.send(request: request) { [weak self] result in
switch result {
case .success(_):
Expand All @@ -69,7 +70,8 @@ public class StableOtlpHTTPMetricExporter: StableOtlpHTTPExporterBase, StableMet
$0.resourceMetrics = MetricsAdapter.toProtoResourceMetrics(stableMetricData: pendingMetrics)
}
let semaphore = DispatchSemaphore(value: 0)
let request = createRequest(body: body, endpoint: endpoint)
var request = createRequest(body: body, endpoint: endpoint)
request.timeoutInterval = min(TimeInterval.greatestFiniteMagnitude, config.timeout)
httpClient.send(request: request) { result in
switch result {
case .success(_):
Expand Down

0 comments on commit 62772bd

Please sign in to comment.