在关于如何使用opencensus-python
向Azure Application Insights提交跟踪的the documentation中,详细说明了如何向customDimensions
字段添加附加信息。就是
import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
logger = logging.getLogger(__name__)
logger.addHandler(AzureLogHandler(
connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000')
)
logger.error('blooh')
logger.error('blooh2', extra={'custom_dimensions': {'woot': 42}})
变成
在Application Insights UI中
这很好,但是从customDimensions
中删除默认包含的项目的预期方法是什么;i、 e.像fileName
和process
这样的事情
通过inspection of the source code,似乎很难避免创建属性,但是可以通过对
envelope
进行后处理来删除它们:这是在{}版本1.0.5中测试和工作的
还请注意,使用这种方法,在日志记录时不再需要指定
extra
相关问题 更多 >
编程相关推荐