aliyun / aliyun/aliyun-log-python-sdk

add more retry for random failure for logging handler

Open
#99 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
176
Forks
119
Avg merge
3h 56m
Merged PRs (30d)
2

Description

class MyQueuedLogHandler(QueuedLogHandler):
    """some times, RAM may return 403, but retry may work again??? """

    def _post(self):
        while not self.stop_flag or (
                time.time() - self.stop_time) <= self.close_wait:
            try:
                req = self._get_batch_requests(timeout=2)
            except Empty as ex:
                if self.stop_flag:
                    break
                else:
                    continue

            try:
                self.send(req)

            except LogException as ex:
                if ex.get_error_code() == "Unauthorized":
                    # Unauthorized RAM, retry may work in some case.
                    _LOGGER.error(
                        "Ram Unauthorized error, put back to queue: %s", ex)
                    try:
                        self.queue.put(req, timeout=self.put_wait)

                    except Full as ex:
                        self.handleError(req.__record__)
                else:
                    self.handleError(req.__record__)

            except Exception as ex:
                self.handleError(req.__record__)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating QueuedLogHandler and its _post/send flow, then inspect how LogException error codes and queue failures are handled. Clarify which transient failures should be retried and the retry limit; done should mean the specified failures retry without changing handling of terminal errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.