microsoft / cpp_client_telemetry

1DS C++ SDK
Apache License 2.0
86 stars 47 forks source link

Expose PAL xxxInformation interfaces (Device, Network, System) in the API #527

Open larvacea opened 4 years ago

larvacea commented 4 years ago

This came up in the onboarding channel as a request:

These classes are currently being used by our Teams app and are present in Aria SDK. ... com.microsoft.applications.telemetry.pal.hardware.DeviceInformation

I could add this to the API, and thence (as the "com.microsoft.stuff" names imply) to the Java wrappers. If there's some factoid in there that they are used to pulling out of the PAL layer, I'm willing to oblige. If I do the other two members of the triumvirate, it gives client code access to some information that does not make it into common schema (power state on mobile, for instance, which potentially affects transmission policy).

Thoughts? Any philosophical objection? The obvious downside is that anything that one exposes this way is harder to change going forward, so if we decided to drop NetworkCost_Metered and add NetworkCost_Fluorescent and NetworkCost_SyncopatedBanana, someone is bound to have taken an expensive-to-alter dependency on the immutability of the NetworkCost enum. Well, how sad. We already have what are essentially unused and unusable enum values, so we could take a commitment to never change the meaning of an enum value, and introduce new ones for new meanings. "Now you get NetworkCost_SyncopatedBanana, and you get to deal with integrating that in your metrics and dashboards, but at least NetworkCost_Metered still means what it used to mean." We already have enum values that are either never generated at all, or are only generated on one or two platforms, or are generated with slightly different meanings on different platforms, and that's especially likely for PAL enums because P stands for Peculiar.

maxgolov commented 4 years ago

This was never part of Telemetry SDK API surface. I doubt that Teams app was doing it properly, OR in a portable way. This API never existed for Windows, Mac or Obj-C. I think usage of internal API is discouraged, and I am still not sure that there is actual real-world use-case for that (and what it is, since most props can be otherwise obtained in Android via its own API set).

If ever implemented - I'd see this as a collection of get/set properties, such as device information tree / map similar to sysinfo_sources. Closest Android analog is (lower-level) properties: https://source.android.com/devices/architecture/sysprops-apis

getprop / setprop , std::map<std::strinng, std::string>

I'm still not sure why this is a blocker.

maxgolov commented 4 years ago

As for exposing the full original set of PAL classes in the higher-level API - I think the answer should be NO.

maxgolov commented 3 years ago

One customer asked for this ability to obtain system-level detail. Perhaps could be done by adding getters to ISemanticContext, that way the semantic context may obtain the info from lower level PAL classes.