我们同时使用 FireBase应用性能监控和 HTTPMetric 来监控api。但是两者都不起作用。下面是示例代码。
let trace = Performance.startTrace(name: Constants.PerformanceMonitoring().apiCall)
trace?.setValue(urlString!, forAttribute: Constants.PerformanceMonitoring().url)
// guard let metric = HTTPMetric(url: URL.init(string: urlString!)!, httpMethod: .post) else { return }
// metric.setValue(urlString!, forAttribute: Constants.PerformanceMonitoring().url)
// metric.start()
HTTPClient().postData(urlString ?? "", paramaters: Parameters, isHeaders: isHeaders , success: { (success) in
trace?.stop()
// metric.responseCode = success?.responseCode ?? 0
// metric.responsePayloadSize = success?.responsePayloadSize ?? 0
// metric.requestPayloadSize = success?.requestPayloadSize ?? 0
// metric.stop()
let modal = APIHandler().handleUrl(urlString ?? "", response: success ?? "" as AnyObject)
successResponse(modal)
}, failure: { (failure) in
trace?.stop()
failureResponse(failure)
})