问题
From the documentation it is unclear how Azure Application Insights pings back to the Azure cloud service.
The only documentation here that gives a clue doesn't explain exactly how this works. I think what makes it a little more difficult to plan for is that the Azure monitor service is one piece and then the actual application's telemetry service applied through code is another part to make up the whole.
Here is the statement from this documentation:
Does the SDK create temporary local storage? Yes, certain Telemetry Channels will persist data locally if an endpoint cannot be reached. Please review below to see which frameworks and telemetry channels are affected.
Telemetry channels that utilize local storage create temp files in the TEMP or APPDATA directories which are restricted to the specific account running your application. This may happen when an endpoint was temporarily unavailable or you hit the throttling limit. Once this issue is resolved, the telemetry channel will resume sending all the new and persisted data.
For our purposes the plan would be to use Azure Application Insights but connectivity would be spotty or "planned" at best. I.e. every 12 or 24 hours.
Is there a way to plan when the service is actually pinged and used or is there a way to just submit "logs" at certain time intervals?
If not, what happens with spotty/intermittent connectivity in general?
回答1:
The ServerTelemetryChannel
, which is the one that persists data in local storage will hold data for up to 24 hours and transmit once it gets a connection. If there is no connectivity for longer than that it will keep trying, but it won't transmit anything older than 24 hours once it does get a connection. There is also a storage size limit of 50 MB. If you can reliably send data once every 12 hours you would be fine, but there isn't an easy way to tell when all the data has been transmitted, so the planned connection needs to be long enough to ensure you can transmit all the data.
Another option would be to create your own ITelemetryChannel
that implements a scheduled data transmission. Since the SDK is open source, you can use the Server Telemetry code to help guide you.
The final option would be to persist logs on local storage through some other means and then import them into Azure Monitor. The Data Collector API is in preview, but it would allow you to import data into Azure Monitor on whatever schedule you want as long as it's sent with a schema that Monitor understands.
来源:https://stackoverflow.com/questions/58342940/is-it-possible-to-use-logs-to-report-to-azure-application-insights-at-specific-t