Skip to content

Commit

Permalink
Revert "optimize loki"
Browse files Browse the repository at this point in the history
  • Loading branch information
PalNilsson authored Oct 4, 2024
1 parent 598ec6f commit 6ece3be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pilot/control/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def get_logging_info(job: JobData, args: object) -> dict:
logger.info("correct logserver formal: logging_type;protocol://hostname:port")
return {}

regex = r"logserver=(?P<logging_type>[^;]+);(?P<protocol>[^:]+)://(?P<hostname>[^:]+):(?P<port>\d+)"
regex = r"logserver='(?P<logging_type>[^;]+);(?P<protocol>[^:]+)://(?P<hostname>[^:]+):(?P<port>\d+)'"
match = search(regex, logserver)
if match:
logging_type = match.group('logging_type')
Expand Down
3 changes: 1 addition & 2 deletions pilot/util/https.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,7 @@ def request2(url: str = "",
# Send the request securely
try:
logger.debug('sending data to server')
timeout = int(config.Pilot.http_maxtime)
with urllib.request.urlopen(req, context=ssl_context, timeout=timeout) as response:
with urllib.request.urlopen(req, context=ssl_context, timeout=30) as response:
# Handle the response here
logger.debug(f"response.status={response.status}, response.reason={response.reason}")
ret = response.read().decode('utf-8')
Expand Down
8 changes: 2 additions & 6 deletions pilot/util/lokirealtimelogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,18 @@ def format(self, record: logging.LogRecord) -> dict:

formatted = {
"timestamp": record.created,
# "process": record.process,
# "thread": record.thread,
"process": record.process,
"thread": record.thread,
"function": record.funcName,
"module": record.module,
"name": record.name,
"level": record.levelname,
}

"""
# Not send all information, some loki services have limitations on number of labels.
record_keys = set(record.__dict__.keys())
for key in record_keys:
if key not in formatted and key not in ['msg']:
formatted[key] = getattr(record, key)
"""

message = record.msg
try:
Expand Down

0 comments on commit 6ece3be

Please sign in to comment.