问题
I maintain a lot of applications which reports events, errors etc to Application Insights.
I also have applications running in corporate environments not open to internet.
Is it possible to store telemetry data locally and then bulk upload it to application insights?
It will of course not be real time information but it allows me to reuse reports and tools I already got.
Looked at the persistence channel but it seems to be for temporary off-line scenarios where the same application creates and eventually send the information.
In my scenario all telemetry would be stored in a file which is later moved to a machine with internet access and another application uploads the information.
回答1:
Not without some major drawbacks, let me explain:
First of all, Application Insights only allows you to add telemetry that is not older than 48 hours. (See the 1st comment in this question
Second, you will run into trouble when it comes to sending exception telemetry to application insights. You will have to somehow serialize the exception to disk or something and then, when the upload process kicks in, you will have to deserialize that exception data. Those are often hard to deserialize so you will loose some information like the actual exception type.
回答2:
Yes, it should be possible. A few options:
- Implement TelemetryProcessor which saves everything somewhere and then returns false (so, it would not be processed by the rest of a chain => will not be send)
- Implement own telemetry channel and replace persistence channel
On top of it you'll need to implement uploader which reads telemetry from where you store it and then uploads using some SDK.
For more details please create github issue and ask for guidance =)
来源:https://stackoverflow.com/questions/53721396/can-application-insights-be-used-off-line