Removed conn str and added exclude
This commit is contained in:
Родитель
d15c427a03
Коммит
7aa4adc091
|
@ -10,7 +10,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
from opentelemetry import trace
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
# connection_string="<your-connection-string>",
|
||||
)
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
|
|
@ -8,9 +8,7 @@ from logging import DEBUG, getLogger
|
|||
|
||||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
logger = getLogger(__name__)
|
||||
logger.setLevel(DEBUG)
|
||||
|
|
|
@ -8,9 +8,7 @@ from logging import WARNING, getLogger
|
|||
|
||||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ from logging import INFO, getLogger
|
|||
import flask
|
||||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
logger = getLogger(__name__)
|
||||
logger.setLevel(INFO)
|
||||
|
|
|
@ -9,9 +9,7 @@ from logging import WARNING, getLogger
|
|||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
from opentelemetry.sdk.resources import Resource, ResourceAttributes
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
from opentelemetry import metrics
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
attribute_set1 = {"key1": "val1"}
|
||||
attribute_set2 = {"key2": "val2"}
|
||||
|
|
|
@ -8,9 +8,7 @@ from opentelemetry.metrics import CallbackOptions, Observation
|
|||
from opentelemetry.sdk.resources import Resource, ResourceAttributes
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
|
||||
# Callback functions for observable instruments
|
||||
|
|
|
@ -7,9 +7,7 @@ import psycopg2
|
|||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
# Database calls using the psycopg2 library will be automatically captured
|
||||
cnx = psycopg2.connect(database="test", user="<user>", password="<password>")
|
||||
|
|
|
@ -8,9 +8,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
from django.http import HttpResponse
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
|
||||
# Requests sent to the django application will be automatically captured
|
||||
|
|
|
@ -7,9 +7,7 @@ import fastapi
|
|||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
app = fastapi.FastAPI()
|
||||
|
||||
|
@ -26,6 +24,7 @@ async def exception():
|
|||
raise Exception("Hit an exception")
|
||||
|
||||
|
||||
# Set the OTEL_PYTHON_EXCLUDE_URLS environment variable to "http://127.0.0.1:8000/exclude"
|
||||
# Telemetry from this endpoint will not be captured due to excluded_urls config above
|
||||
@app.get("/exclude")
|
||||
async def exclude():
|
||||
|
|
|
@ -8,7 +8,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
# connection_string="<your-connection-string>",
|
||||
)
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
|
|
|
@ -12,15 +12,14 @@ from opentelemetry import trace
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
with tracer.start_as_current_span("Request parent span") as span:
|
||||
try:
|
||||
# Requests made using the requests library will be automatically captured
|
||||
response = requests.get("https://azure.microsoft.com/", timeout=5)
|
||||
# Set the OTEL_PYTHON_EXCLUDE_URLS environment variable to "http://example.com"
|
||||
# This request will not be tracked due to the excluded_urls configuration
|
||||
response = requests.get("http://example.com", timeout=5)
|
||||
logger.warning("Request sent")
|
||||
|
|
|
@ -12,9 +12,7 @@ from opentelemetry import trace
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
with tracer.start_as_current_span("Request parent span") as span:
|
||||
|
|
|
@ -12,9 +12,7 @@ from opentelemetry import trace
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Configure Azure monitor collection telemetry pipeline
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
# SQLAlchemy instrumentation is not officially supported by this package
|
||||
|
|
|
@ -11,9 +11,7 @@ from opentelemetry import trace
|
|||
# Sampling ratio of between 0 and 1 inclusive
|
||||
# 0.1 means approximately 10% of your traces are sent
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
|
||||
|
|
|
@ -8,9 +8,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor
|
|||
from opentelemetry import trace
|
||||
from opentelemetry.sdk.resources import Resource, ResourceAttributes
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="<your-connection-string>",
|
||||
)
|
||||
configure_azure_monitor()
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче