File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
infrastructure/aws/lambda Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,11 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
55
66WORKDIR /tmp
77
8+ RUN dnf install -y gcc-c++
9+
810COPY uv.lock .python-version pyproject.toml LICENSE README.md ./
911COPY titiler/ ./titiler/
1012
11- RUN dnf install -y gcc-c++
1213RUN uv export --locked --no-editable --no-dev --extra lambda --extra telemetry --format requirements.txt -o requirements.txt && \
1314 uv pip install --compile-bytecode --no-binary pydantic --target /asset -r requirements.txt
1415
Original file line number Diff line number Diff line change 66
77import earthaccess
88from mangum import Mangum
9+ from opentelemetry import trace
10+ from opentelemetry .instrumentation .fastapi import FastAPIInstrumentor
11+ from opentelemetry .instrumentation .logging import LoggingInstrumentor
12+ from opentelemetry .sdk .resources import SERVICE_NAME , SERVICE_VERSION , Resource
13+ from opentelemetry .sdk .trace import TracerProvider
914
1015from titiler .cmr .main import app
1116from titiler .cmr .settings import AuthSettings
1621logging .getLogger ("mangum.http" ).setLevel (logging .ERROR )
1722
1823
24+ LoggingInstrumentor ().instrument (set_logging_format = True )
25+ FastAPIInstrumentor .instrument_app (app )
26+
27+ resource = Resource .create (
28+ {
29+ SERVICE_NAME : "titiler-cmr" ,
30+ SERVICE_VERSION : "0.1.0" ,
31+ }
32+ )
33+
34+ provider = TracerProvider (resource = resource )
35+
36+ # uses the OTEL_EXPORTER_OTLP_ENDPOINT env var
37+ # processor = BatchSpanProcessor(OTLPSpanExporter())
38+ # provider.add_span_processor(processor)
39+
40+ trace .set_tracer_provider (provider )
41+
42+
1943@app .on_event ("startup" )
2044async def startup_event () -> None :
2145 """startup."""
You can’t perform that action at this time.
0 commit comments