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

reduce trace errors #869

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
16 changes: 8 additions & 8 deletions platform_monitoring/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from async_timeout import timeout
from cachetools import LRUCache
from iso8601 import UTC, ParseError
from neuro_logging import trace
from neuro_logging import trace, trace_cm

from .base import LogReader
from .kube_client import ContainerStatus, JobNotFoundException, KubeClient
Expand Down Expand Up @@ -377,15 +377,15 @@
if self._cache_metadata:
metadata = self._cache.get(pod_name)
if metadata is None:
try:
metadata = await self._get_from_s3(pod_name)
except s3_client_error("NoSuchKey"):
metadata = S3LogsMetadata()
if self._cache_metadata:
self._cache[pod_name] = metadata
async with trace_cm("get_from_s3"):
try:
metadata = await self._get_from_s3(pod_name)
except s3_client_error("NoSuchKey"):
metadata = S3LogsMetadata()

Check warning on line 384 in platform_monitoring/logs.py

View check run for this annotation

Codecov / codecov/patch

platform_monitoring/logs.py#L380-L384

Added lines #L380 - L384 were not covered by tests
if self._cache_metadata:
self._cache[pod_name] = metadata

Check warning on line 386 in platform_monitoring/logs.py

View check run for this annotation

Codecov / codecov/patch

platform_monitoring/logs.py#L386

Added line #L386 was not covered by tests
return metadata

@trace
async def _get_from_s3(self, pod_name: str) -> S3LogsMetadata:
response = await self._s3_client.get_object(
Bucket=self._bucket_name,
Expand Down
Loading