Skip to content

Commit b4bd598

Browse files
committed
Adding instrumentations aside from django
1 parent 181f9be commit b4bd598

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Adding requests, flask, and psycopg2 instrumentations
6+
([#190](https://github.com/microsoft/ApplicationInsights-Python/pull/190))
57
- Added publishing action
68
([#193](https://github.com/microsoft/ApplicationInsights-Python/pull/193))
79

azure-monitor-opentelemetry-distro/setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ zip_safe = False
3232
include_package_data = True
3333
install_requires =
3434
azure-monitor-opentelemetry-exporter == 1.0.0b7
35-
opentelemetry-instrumentation == 0.32b0
35+
opentelemetry-instrumentation == 0.33b0
36+
opentelemetry-instrumentation-requests == 0.33b0
37+
opentelemetry-instrumentation-flask == 0.33b0
38+
opentelemetry-instrumentation-psycopg2 == 0.33b0
3639

3740
[options.packages.find]
3841
where = src
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unittest
2+
3+
from opentelemetry.instrumentation.flask import FlaskInstrumentor
4+
5+
6+
class TestFlaskInstrumentation(unittest.TestCase):
7+
def test_instrument(self):
8+
excluded_urls = "client/.*/info,healthcheck"
9+
10+
try:
11+
FlaskInstrumentor().instrument(excluded_urls=excluded_urls)
12+
except Exception as ex: # pylint: disable=broad-except
13+
print(ex)
14+
self.fail(
15+
f"Unexpected exception raised when instrumenting {FlaskInstrumentor.__name__}"
16+
)
17+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import unittest
2+
3+
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
4+
5+
6+
class TestPsycopg2Instrumentation(unittest.TestCase):
7+
def test_instrument(self):
8+
try:
9+
Psycopg2Instrumentor().instrument()
10+
except Exception as ex: # pylint: disable=broad-except
11+
print(ex)
12+
self.fail(
13+
f"Unexpected exception raised when instrumenting {Psycopg2Instrumentor.__name__}"
14+
)
15+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
import unittest
3+
4+
from opentelemetry.instrumentation.requests import RequestsInstrumentor
5+
6+
7+
class TestRequestsInstrumentation(unittest.TestCase):
8+
def test_instrument(self):
9+
try:
10+
RequestsInstrumentor().instrument()
11+
except Exception as ex: # pylint: disable=broad-except
12+
print(ex)
13+
self.fail(
14+
f"Unexpected exception raised when instrumenting {RequestsInstrumentor.__name__}"
15+
)
16+

0 commit comments

Comments
 (0)