[llvm] [llvm]Add a simple Telemetry framework (PR #102323)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 07:17:09 PDT 2024


jh7370 wrote:

> > I've been thinking about it a bit more, and I think that it would make sense to have a single upstream implementation that writes a representation of some kind (JSON is fine) to a file. This would be off by default, but could be enabled via an option somehow (perhaps keep it in LLVM-only code and add a runtime option). This would have two benefits: 1) it would serve as a concrete example for vendors how to extend the interface, and 2) it could be used for testing the basic telemetry information is working in an end-to-end manner, via lit tests, in a way that the current unit tests can't really show. Thoughts?
> 
> Both (1) and (2) can be archived via the the test implementation. I've mentioned this in the library header comment, but we don't want to accidentally have telemetry data "leaked" by any chance - even if it's just to a local file, which could still be problematic. In various discussions, people were already slightly nervous with certain piece of data being collected (again, different vendors/organisations have different privacy/security models, hence they have different opinions on which data should be collected and whether if it's ok for such data to be "forwarded" anywhere by LLVM).

In my experience, unit test implementations are not sufficient to demonstrate how a concrete implementation works in practice, end-to-end, because they are more focused on making sure the individual components function independently and take short cuts (and indeed, I'd argue if they weren't taking these short cuts, the tests wouldn't be clear enough about what they were specifically testing). A real end-to-end implementation is much clearer to follow from a high-level point of view, typically.

Writing to a user-specified file is not a security risk. It only becomes a security risk if that file is somehow automatically gathered/sent somewhere, which is beyond the scope of this project. Anyway, you could add a cmake hook to disable logging telemetry (or whatever you want to call this writing to a file) entirely, if people really thought it was necessary (I don't).

https://github.com/llvm/llvm-project/pull/102323


More information about the llvm-commits mailing list