While developing an application (mobile app for Android), our team always strives to use best development practices such as interfaces, layering and separation of concerns.
When it comes to reporting analytics events from our app, the requirements sometimes force us to send events with data that is stored and managed by multiple different app "components".
Some of this data is not directly available at the component/layer that does the reporting, nor at any central location in the application.
To me, this seems like it contradicts all the efforts of architecture and design that were made during the development of the application.
My question is:
What is the correct way to deal with this issue?
Is the problem in the requirements we received, or is it a common issue that a layered/modular application sometimes needs to make things "global" ? if so, what is the way to solve this issue while still reaping the benefits of development best practices?