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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96dd73b3bb42d74ca58c90ee63eacdcbd97f10d4b77eddd2c2c547ae8819dd7a |
|
MD5 | 2683bdaf18260091b82c264372f7303b |
|
BLAKE2b-256 | f3449802fc4a82e56e4aa6e5627c19c921abfdb5852cb0c287dd4826a39f87af |
Close
Hashes for datacollector_api_client-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6980997dc54e3d2a9f013b8e44b94107cd94bbd804dff1ee12a20239346b8a8e |
|
MD5 | f724d1eaf5e188db28b2395e5faf76c3 |
|
BLAKE2b-256 | 6372dbe0c9f90a2df3c64e7ca8b18d3aabf8dbab038a36ecff37816cfd07b254 |