-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too much traces in AppInsights #317
Comments
I have seen that those logs come from:
sdkVersion Same as the explicit log that I do. |
I have tried raising logs to:
But I still see them |
Fixed with following code: from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry import trace
import logging
logging.getLogger().handlers = []
configure_azure_monitor(connection_string=os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"])
logging.getLogger().setLevel(logging.WARNING)
tracer = trace.get_tracer(__name__)
app = fastapi.FastAPI()
@app.get("/x")
async def x():
with tracer.start_as_current_span("aaaaa"):
logging.warning("a",extras={"b":1})
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.AsgiMiddleware(app).handle(req, context) |
Do this and it should suppress those verbose logs.
|
This helped, thank you very much @macieyng . The only thing that I don't understand is why disabling the automatic instrumentations and excluding urls didn't help |
It didn't work because Azure SDK is instrumenting itself while suppressing any other instrumentation. Read this comment: Azure/azure-sdk-for-python#31292 (comment) |
These additional logs are appearing in the "traces" table in your Application Insights resource correct? We have recently implemented a feature to define the specific logger that you want to collect traces telemetry. This should allow you to define the logger to your application logger instead of the default which is the root logger. This is why you are seeing logs collected from the SDK itself. This feature should be available soon in the next release. |
Migrating to Azure sdk: Azure/azure-sdk-for-python#32503 |
I have the following function code:
With this code I removed the duplicated logs and I can see custom dimensions. However I am seeing 3 taces each 5s creating too much logs:
I tried the following env vars:
However, I am still seeing this. I have seen that your sdk calls this endpoint. https://github.com/Azure/azure-sdk-for-python/blob/11437bbf7be952401581641f556ac8c897667e59/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_generated/operations/_azure_monitor_client_operations.py#L39
But i don't know which library you use for http requests, probably this one: https://github.com/Azure/azure-sdk-for-python/blob/11437bbf7be952401581641f556ac8c897667e59/sdk/core/azure-core/azure/core/utils/_pipeline_transport_rest_shared.py#L27.
Any idea on how to disable this logs being sent to AI?
The text was updated successfully, but these errors were encountered: