question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicated messages in Azure Application Insights

See original GitHub issue

Environment

Python 3.9.6 - 64 bit Windows 10 pip 21.3.1 opencensus==0.8.0 opencensus-context==0.1.2 opencensus-ext-azure==1.1.0

Steps to reproduce

I tried running the following code in mutliple places including new venvs that have just the opencensus-ext-azure library

import logging

from opencensus.ext.azure.log_exporter import AzureLogHandler

logger = logging.getLogger(__name__)

handler = AzureLogHandler(connection_string="<My-InstrumentationKey>")
logger.addHandler(handler)

properties = {"custom_dimensions": {"key_1*****": "value_1", "key_2********": "value_2"}}
logger.error("Error 12 : Hello, World!", extra=properties)

What is the expected behavior?

We expect to see 1 message in the traces table in application insights

What is the actual behavior?

Duplicate records with the exact timestamp : image

Additional info

I am aware of the issue #901 and i think it’s not the same cause.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
corticalstackcommented, Jan 10, 2022

@lzchen adding of the AzureLogHandler multiple times to the root logger was indeed the issue for me (even though I had it wrapped arounf check of streamlit session state, but thats another issue).

Resolved by checking length of logger handlers. Thanks!

if len(logger.handlers) == 0:
  logger.addHandler(AzureLogHandler(connection_string=APPI_CONNECT_STRING))
1reaction
corticalstackcommented, Dec 22, 2021

@simonsben seen that many time repeat of same telemtry as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application Insights Duplicate Telemetry - Microsoft Q&A
I have application insights setup and configured in workspace mode and for a web app on the linux app service plan, I am...
Read more >
Azure Application Insights showing duplicate entries
Right now we are trying to review some performance issue and what we are observing is that Application Insights is showing duplicate records ......
Read more >
Duplicated messages in Azure Application Insights · Issue #901
This will in turn pass every log record through every handler attached to logger and as a result, export multiple of the exact...
Read more >
TelemetryClient (core 2.6.2 API) - javadoc.io
Sends a TraceTelemetry record to Application Insights. Appears in "traces" in Analytics and Search. Parameters: message - A log message. Max length 10000....
Read more >
Azure Application Insights — How not to burn money using it
In this blog post, I'm going to talk about Azure Application Insights and how I learned not to take certain things for granted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found