-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add request attributes to tile trace logs
Use mosaic reader requests to add custom dimensions to trace log output
- Loading branch information
1 parent
05f3830
commit f461009
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import attr | ||
import morecantile | ||
from pccommon.logging import get_custom_dimensions | ||
import planetary_computer as pc | ||
from cogeo_mosaic.errors import NoAssetFoundError | ||
from fastapi import HTTPException | ||
|
@@ -134,17 +135,17 @@ def assets_for_tile( | |
bbox = self.tms.bounds(morecantile.Tile(x, y, z)) | ||
assets = self.get_assets(Polygon.from_bounds(*bbox), **asset_kwargs) | ||
|
||
te = time.perf_counter() | ||
logger.info( | ||
"Perf: Mosaic get assets for tile.", | ||
extra={ | ||
"custom_dimensions": { | ||
"duration": f"{te - ts:0.4f}", | ||
extra=get_custom_dimensions( | ||
{ | ||
"duration": f"{time.perf_counter() - ts:0.4f}", | ||
"collection": collection, | ||
"zxy": f"{z}/{x}/{y}", | ||
"count": len(assets), | ||
}, | ||
}, | ||
self.reader.request, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vincentsarago
Contributor
|
||
), | ||
) | ||
return assets | ||
|
||
|
This results in
AttributeError: type object 'MosaicSTACReader' has no attribute 'request'