Skip to content

Commit 65cac6d

Browse files
committed
optionally enable appinsights
1 parent fedd9cd commit 65cac6d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
app = Flask(__name__)
1717

1818
# Setup Azure Monitor
19-
# middleware = FlaskMiddleware(
20-
# app,
21-
# exporter=AzureExporter(connection_string="InstrumentationKey={0}".format(os.environ['APPINSIGHTS_KEY'])),
22-
# sampler=ProbabilitySampler(rate=1.0),
23-
# )
19+
if 'APPINSIGHTS_KEY' in os.environ:
20+
middleware = FlaskMiddleware(
21+
app,
22+
exporter=AzureExporter(connection_string="InstrumentationKey={0}".format(os.environ['APPINSIGHTS_KEY'])),
23+
sampler=ProbabilitySampler(rate=1.0),
24+
)
2425

2526
# Setup Flask Restful framework
2627
api = Api(app)

0 commit comments

Comments
 (0)