mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +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
|
if TRACING_ENABLED: # pragma: no cover
|
||||||
_t_endpoint = get_setting('INVENTREE_TRACING_ENDPOINT', 'tracing.endpoint', None)
|
_t_endpoint = get_setting('INVENTREE_TRACING_ENDPOINT', 'tracing.endpoint', None)
|
||||||
_t_headers = get_setting('INVENTREE_TRACING_HEADERS', 'tracing.headers', None, dict)
|
_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(
|
_t_resources = get_setting(
|
||||||
'INVENTREE_TRACING_RESOURCES', 'tracing.resources', {}, dict
|
'INVENTREE_TRACING_RESOURCES', 'tracing.resources', {}, dict
|
||||||
)
|
)
|
||||||
@ -751,20 +757,20 @@ if TRACING_ENABLED: # pragma: no cover
|
|||||||
setup_tracing(
|
setup_tracing(
|
||||||
_t_endpoint,
|
_t_endpoint,
|
||||||
_t_headers,
|
_t_headers,
|
||||||
tracing_resources,
|
resources_input=tracing_resources,
|
||||||
get_boolean_setting('INVENTREE_TRACING_CONSOLE', 'tracing.console', False),
|
console=get_boolean_setting(
|
||||||
get_setting('INVENTREE_TRACING_AUTH', 'tracing.auth', {}),
|
'INVENTREE_TRACING_CONSOLE', 'tracing.console', False
|
||||||
get_setting('INVENTREE_TRACING_IS_HTTP', 'tracing.is_http', False),
|
),
|
||||||
get_boolean_setting(
|
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
|
'INVENTREE_TRACING_APPEND_HTTP', 'tracing.append_http', True
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
# Run tracing/logging instrumentation
|
# Run tracing/logging instrumentation
|
||||||
setup_instruments()
|
setup_instruments()
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning('OpenTelemetry tracing not enabled because endpoint is not set')
|
||||||
'OpenTelemetry tracing not enabled because endpoint or headers are not set'
|
|
||||||
)
|
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user