mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Tracing tweaks (#6278)
* Tweaks for OpenTelemetry tracing: - Add logger info message if enabled - Explicit kwargs to setup_tracing method - Change is_http to True by default (as per internal docs) * Allow operation without specifying tracing.headers * Clean up log message
This commit is contained in:
parent
357f715789
commit
a0b595de6e
@ -741,7 +741,13 @@ TRACING_ENABLED = get_boolean_setting(
|
||||
if TRACING_ENABLED: # pragma: no cover
|
||||
_t_endpoint = get_setting('INVENTREE_TRACING_ENDPOINT', 'tracing.endpoint', None)
|
||||
_t_headers = get_setting('INVENTREE_TRACING_HEADERS', 'tracing.headers', None, dict)
|
||||
if _t_endpoint and _t_headers:
|
||||
|
||||
if _t_headers is None:
|
||||
_t_headers = {}
|
||||
|
||||
if _t_endpoint:
|
||||
logger.info('OpenTelemetry tracing enabled')
|
||||
|
||||
_t_resources = get_setting(
|
||||
'INVENTREE_TRACING_RESOURCES', 'tracing.resources', {}, dict
|
||||
)
|
||||
@ -751,20 +757,20 @@ if TRACING_ENABLED: # pragma: no cover
|
||||
setup_tracing(
|
||||
_t_endpoint,
|
||||
_t_headers,
|
||||
tracing_resources,
|
||||
get_boolean_setting('INVENTREE_TRACING_CONSOLE', 'tracing.console', False),
|
||||
get_setting('INVENTREE_TRACING_AUTH', 'tracing.auth', {}),
|
||||
get_setting('INVENTREE_TRACING_IS_HTTP', 'tracing.is_http', False),
|
||||
get_boolean_setting(
|
||||
resources_input=tracing_resources,
|
||||
console=get_boolean_setting(
|
||||
'INVENTREE_TRACING_CONSOLE', 'tracing.console', False
|
||||
),
|
||||
auth=get_setting('INVENTREE_TRACING_AUTH', 'tracing.auth', {}),
|
||||
is_http=get_setting('INVENTREE_TRACING_IS_HTTP', 'tracing.is_http', True),
|
||||
append_http=get_boolean_setting(
|
||||
'INVENTREE_TRACING_APPEND_HTTP', 'tracing.append_http', True
|
||||
),
|
||||
)
|
||||
# Run tracing/logging instrumentation
|
||||
setup_instruments()
|
||||
else:
|
||||
logger.warning(
|
||||
'OpenTelemetry tracing not enabled because endpoint or headers are not set'
|
||||
)
|
||||
logger.warning('OpenTelemetry tracing not enabled because endpoint is not set')
|
||||
|
||||
# endregion
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user