mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-10 07:15:13 +02:00
Added an instance tag ID (#971)
This commit is contained in:
parent
00bb964e93
commit
60f861bac4
1 changed files with 4 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ Supports dual output to console and Loki for centralized log aggregation.
|
|||
import contextvars
|
||||
import logging
|
||||
import logging.handlers
|
||||
import uuid
|
||||
from argparse import ArgumentParser
|
||||
from queue import Queue
|
||||
from typing import Any
|
||||
|
|
@ -132,14 +133,12 @@ def setup_logging(args: dict[str, Any]) -> None:
|
|||
try:
|
||||
from logging_loki import LokiHandler
|
||||
|
||||
# Create Loki handler with optional authentication. The
|
||||
# processor label is NOT baked in here — it's stamped onto
|
||||
# each record by _ProcessorIdFilter reading the task-local
|
||||
# contextvar, and logging_loki's emitter reads record.tags
|
||||
# to build per-record Loki labels.
|
||||
instance_id = str(uuid.uuid4())[:8]
|
||||
|
||||
loki_handler_kwargs = {
|
||||
'url': loki_url,
|
||||
'version': "1",
|
||||
'tags': {'instance': instance_id},
|
||||
}
|
||||
|
||||
if loki_username and loki_password:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue