Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "optimize loki" #147

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading