The new class, maybe named AtcInsightsReporter, should take any arguments that are serializable, to json, and add them as properties to a log entry that is sent to the appinsights. Importantly, the class should use the job introspection available in atc-dataplatform to also add a link to the correct workspace and job-run, so that one can find the way back to the line that caused the log.
The class should be usable as a context manager, where it catches all exceptions and reports them to log analytics.
This will allow for developer attention, while also letting the job run to successful completion.
Set up a class that takes as its one parameter the instrumentation key of an azure app insight.
https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python
You can use the snippets from here to set up the app-insights and get that key:
https://github.com/atc-net/atc-snippets/tree/main/azure-cli/monitor
The new class, maybe named
AtcInsightsReporter
, should take any arguments that are serializable, to json, and add them as properties to a log entry that is sent to the appinsights. Importantly, the class should use the job introspection available in atc-dataplatform to also add a link to the correct workspace and job-run, so that one can find the way back to the line that caused the log.The class should be usable as a context manager, where it catches all exceptions and reports them to log analytics. This will allow for developer attention, while also letting the job run to successful completion.