Skip to content

Commit 1f01f7e

Browse files
authored
Merge pull request #199 from jeremydvoss/instrumentations-minus-django
Adding instrumentations aside from django
2 parents 181f9be + 3d3cbd9 commit 1f01f7e

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-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+
([#199](https://github.com/microsoft/ApplicationInsights-Python/pull/199))
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
try:
10+
FlaskInstrumentor().instrument(excluded_urls=excluded_urls)
11+
except Exception as ex: # pylint: disable=broad-except
12+
print(ex)
13+
self.fail(
14+
f"Unexpected exception raised when instrumenting {FlaskInstrumentor.__name__}"
15+
)
16+
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import unittest
2+
3+
from opentelemetry.instrumentation.requests import RequestsInstrumentor
4+
5+
6+
class TestRequestsInstrumentation(unittest.TestCase):
7+
def test_instrument(self):
8+
try:
9+
RequestsInstrumentor().instrument()
10+
except Exception as ex: # pylint: disable=broad-except
11+
print(ex)
12+
self.fail(
13+
f"Unexpected exception raised when instrumenting {RequestsInstrumentor.__name__}"
14+
)
15+

0 commit comments

Comments
 (0)