Skip to content

Commit f463c7f

Browse files
authored
Merge pull request #97 from PerfectThymeTech/marvinbuss/exclude_app_insights_url
Exclude App Insights URL Dependency
2 parents 45cae24 + d96dd83 commit f463c7f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

code/function/fastapp/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Settings(BaseSettings):
1414
LOGGING_SCHEDULE_DELAY: int = 5000
1515
DEBUG: bool = False
1616
APPLICATIONINSIGHTS_CONNECTION_STRING: str = Field(
17-
default="", env="APPLICATIONINSIGHTS_CONNECTION_STRING"
17+
default="", alias="APPLICATIONINSIGHTS_CONNECTION_STRING"
1818
)
1919
WEBSITE_NAME: str = Field(default="test", alias="WEBSITE_SITE_NAME")
2020
WEBSITE_INSTANCE_ID: str = Field(default="0", alias="WEBSITE_INSTANCE_ID")

code/function/fastapp/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import logging
22
from logging import Logger
33

4-
from azure.monitor.opentelemetry import configure_azure_monitor
5-
64
# from azure.identity import ManagedIdentityCredential
75
from azure.monitor.opentelemetry.exporter import (
86
ApplicationInsightsSampler,
@@ -25,7 +23,7 @@
2523
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
2624
from opentelemetry.sdk.trace import TracerProvider
2725
from opentelemetry.sdk.trace.export import BatchSpanProcessor
28-
from opentelemetry.trace import Tracer, get_tracer_provider, set_tracer_provider
26+
from opentelemetry.trace import Tracer, set_tracer_provider
2927

3028

3129
def setup_logging(module) -> Logger:
@@ -130,7 +128,7 @@ def setup_opentelemetry(app: FastAPI):
130128
# Create instrumenter
131129
FastAPIInstrumentor.instrument_app(
132130
app,
133-
excluded_urls=f"{settings.API_V1_STR}/health/heartbeat",
131+
excluded_urls=f".*.in.applicationinsights.azure.com/.*,{settings.API_V1_STR}/health/heartbeat",
134132
tracer_provider=tracer_provider,
135133
meter_provider=meter_provider,
136134
)

code/function/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
# azure-identity~=1.15.0
66
azure-functions~=1.17.0
7-
fastapi~=0.106.0
7+
fastapi~=0.108.0
88
pydantic-settings~=2.1.0
99
httpx~=0.26.0
10-
azure-monitor-opentelemetry~=1.1.1
10+
azure-monitor-opentelemetry-exporter==1.0.0b20
11+
opentelemetry-instrumentation-fastapi==0.43b0
1112
opentelemetry-instrumentation-httpx~=0.43b0
1213
opentelemetry-instrumentation-system-metrics~=0.43b0

0 commit comments

Comments
 (0)