Thin client for Azure Monitor DataCollector API.
Project description
A thin client to send log data to Azure Monitor by using the HTTP Data Collector API.
Installation
$ pip install datacollector-api-client
Usage
from datacollector_api_client.client import DataCollectorWrapper wrapper = DataCollectorWrapper(LOGANALYTICS_WORKSPACE_ID, LOGANALYTICS_WORKSPACE_KEY) data = [{ "application": "my_app", "message": "my log message" }] response = wrapper.log_info(structured_log_message=data) print(response)
Enriching structured logging with Databricks information
Pass your dbutils instance from your Databricks session to the library
wrapper = DataCollectorWrapper(LOGANALYTICS_WORKSPACE_ID, LOGANALYTICS_WORKSPACE_KEY, dbutils) data = [{ "application": "Notebook", "message": f'Number of rows in dataframe: {df.count()}' }] response = wrapper.log_info(structured_log_message=data) print(response)
- The following data is also collected and appended to your log:
dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘clusterId’)
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘sessionId’)
dbutils.notebook.entry_point.getDbutils().notebook().getContext().tags().apply(‘user’)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datacollector-api-client-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | afd2ef47172cb7b16c12346113dfc6c25df747b5eb1a4d2627a78c441e5004bd |
|
MD5 | 397b8f6ab8111fea8ea04ca542ec11d8 |
|
BLAKE2b-256 | dc763a75be3b01b136dbf7cf1a6fdb5626bffff75989a89da7b20dd1867eabb2 |
Close
Hashes for datacollector_api_client-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b46e793b2a67017336830e01c8f04456d4f5415448e5d5f39c973c25279f79d |
|
MD5 | 126a0b2806a5eff3d8b3dd93bc30721c |
|
BLAKE2b-256 | 72cee73f9403caa2d0babe49c1be04b63d5160758d73e115cc1647eed2f45c91 |