cpp_client_telemetry icon indicating copy to clipboard operation
cpp_client_telemetry copied to clipboard

utils/Utils.cpp depending on http/HttpClient_Android.hpp?

Open maxgolov opened this issue 5 years ago • 2 comments

@larvacea - Martin, quick question - let me know your thoughts on this..

I've been working on a hackathon project (integrating OpenTelemetry C++ core instead of our 1DS core), and I noticed one interesting detail. It seems like only for Android - while figuring out what temp dir to use for DB files and stuff, we invoke something like this:

https://github.com/microsoft/cpp_client_telemetry/blob/b228d1b82522cf131a41f037938448336ed855d3/lib/utils/Utils.cpp#L108

to obtain temporary dir (app cache) path. That way we actually create tight coupling between a general routine to obtain TEMP dir path and Android HTTP client implementation, that could otherwise be avoided.

I wonder if we could have something like this instead: https://stackoverflow.com/questions/7595324/creating-temporary-files-in-android-with-ndk Basically a set of Android-specific helper Utils (maybe under lib/android_build or as lib/utils/android/Utils.cpp) that allow to decouple the routine to obtain temp (cache dir) path from HTTP client code? This would also help eventually when Edge-on-Android binds to their own Chromium stack (as their own implementation may not necessary need to implement the GetCacheFilePath in their HTTP client at all).

maxgolov avatar Jul 30 '20 21:07 maxgolov

The very short answer is yes, we should decouple these (and other similar methods) from httpClient.java and initialize all the PAL-layer android code without reference to httpClient.

larvacea avatar Jul 30 '20 22:07 larvacea

@larvacea - should we change this from question to enhancement ? (not that it's a bug per se, but more of an improvement to do things in a cleaner fashion ).

maxgolov avatar Jul 31 '20 00:07 maxgolov