in Sources/apm-agent-ios/Configuration/CentralConfigFetcher.swift [128:178]
func fetch() {
self.task?.cancel()
if let request = buildCentralConfigRequest() {
task = URLSession.shared.dataTask(with: request, completionHandler: { data, response, error in
if let error = error {
self.logger.error("\(error.localizedDescription)")
return
}
if let response = response as? HTTPURLResponse {
switch CentralConfigResponse(rawValue: response.statusCode) {
case .okay:
if let data = data {
self.callback(data)
self.etag = response.allHeaderFields["ETag"] as? String
if let cacheControl = response.allHeaderFields["Cache-Control"] as? String {
self.maxAge = Self.parseMaxAge(cacheControl: cacheControl)
}
}
case .forbidden:
self.logger.debug(
"""
Central configuration is disabled. \
Set kibana.enabled: true in your APM Server configuration.
""")
case .notFound:
self.logger.debug(
"""
This APM Server does not support central configuration. \
Update to APM Server 7.3+.
""")
case .notModified:
self.logger.debug("Central config did not change.")
case .unavailable:
self.logger.error(
"""
Remote configuration is not available. \
Check the connection between APM Server and Kibana.
""")
default:
self.logger.error("Unexpected status code (\(response.statusCode)) received.")
}
}
})
task?.resume()
}
}