Skip to content

Commit

Permalink
remove unused imports and fix env issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hyusap committed Mar 17, 2024
1 parent 881ffae commit dbf7f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion api/src/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from sqlalchemy.ext.declarative import declarative_base

load_dotenv()
load_dotenv(override=True)

connect_args = {}

Expand Down
22 changes: 3 additions & 19 deletions api/src/main.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
import json
import logging
import os
import uuid
from contextlib import asynccontextmanager
from typing import Optional, Sequence

import sentry_sdk
from fastapi import (
APIRouter,
Depends,
FastAPI,
HTTPException,
Request,
)
from fastapi.responses import PlainTextResponse
from fastapi_pagination import Page, add_pagination
from fastapi_pagination.ext.sqlalchemy import paginate
from fastapi_pagination import add_pagination
from opentelemetry import trace
from opentelemetry._logs import (
SeverityNumber,
get_logger,
get_logger_provider,
set_logger_provider,
std_to_otel,
)

# from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
# from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.exporter.otlp.proto.http._log_exporter import (
OTLPLogExporter,
)
Expand All @@ -53,12 +40,9 @@
from slowapi.errors import RateLimitExceeded
from slowapi.middleware import SlowAPIMiddleware
from slowapi.util import get_remote_address
from sqlalchemy.ext.asyncio import AsyncSession
from starlette.exceptions import HTTPException as StarletteHTTPException

from . import agent, crud, schemas
from .db import engine, scaffold_db
from src.dependencies import db
from src.routers import (
apps,
users,
Expand Down Expand Up @@ -108,11 +92,11 @@ def otel_trace_init():
otlp_span_exporter = OTLPSpanExporter(
endpoint=otel_endpoint_url, headers=otel_http_headers
)
trace.get_tracer_provider().add_span_processor(
trace.get_tracer_provider().add_span_processor( # type: ignore
BatchSpanProcessor(otlp_span_exporter)
)
if DEBUG_LOG_OTEL_TO_CONSOLE:
trace.get_tracer_provider().add_span_processor(
trace.get_tracer_provider().add_span_processor( # type: ignore
SimpleSpanProcessor(ConsoleSpanExporter())
)

Expand Down

0 comments on commit dbf7f70

Please sign in to comment.