-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cant produce api request log data #553
Comments
URLSessionLogger.runningSpans always 0 elements |
The library is probably not identifying the Alamofire created URL session, I think it did in the past so probably Alamofire has updated something and we have lost visibility. In URLSessionInstrumentation line 329 there is some code to handle it, explicitly in line 341, can you check if it is properly entering there and af_resume is still the internal name the library uses? If not we would need a basic sample app reproducing the issue in order to try to fix it. |
The library is then clearly outdated, we would need a sample app that reproduces the issue in order to add support. We are also open to contributions 😉 |
In Alamofire 5, AFURLSessionManager and many of the classes and methods related to it have been refactored or removed. AFURLSessionManager is a core class in Alamofire 4 that handles all URLSession related tasks. However, with the release of Alamofire 5, the codebase has been simplified and refactored to better support Swift language features and a more modern API design. In Alamofire 5, AFURLSessionManager was replaced by the Session class, which manages all request and response handling and underlying URLSession tasks. In Alamofire 5, the af_resume method is deprecated because Alamofire's design has been refactored to better support Swift language features and simplify the management of network requests. In Alamofire 4, af_resume is a method in the AFURLSessionManager class that initiates a pending network request. In Alamofire 5, it is no longer necessary to explicitly call the af_resume method to initiate network requests because all requests are initiated immediately upon creation. The new Session class manages the creation and execution of all requests, simplifying the API and improving ease of use. |
I don't know how to fix the code to solve the problem I am currently experiencing, if there is an update on openmetry-swift, please let me know here, thank you very much 🙏 |
As said previously, if you can provide a sample project with a minimum setup that reproduces the issue it will help a lot to have it solved, because it removes the barrier of setting up a project to anyone willing to help. |
URLSessionInstrumentation+Alamofire.zip |
This is because you are using the SimpleSpanProcessor, which will trigger an export as soon as it processes any spans, combining this with the instrumented http exporter it causes an infinite loop. The SimpleSpanProcessor isn't intended to be used for anything more than testing. If you swap it out for a BatchSpanProcessor it will behave correctly. If you used something like this :
It will prevent the repeated trace exports. This will limit the upload of spans to minutely |
cant produce api request log data
let networkInstrumentation = URLSessionInstrumentation(configuration: URLSessionInstrumentationConfiguration())
we use Alamofire Make network request
The text was updated successfully, but these errors were encountered: