Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Brandon
    @thecompsciguy_twitter
    Yep! That was it. Thanks so much!
    Leighton Chen
    @lzchen
    Nice! Glad it worked!
    lakhotiaharshit
    @lakhotiaharshit

    Hi I am trying to use opencensus-ext-azure in the following way:

    import logging
    import logging.handlers
    from opencensus.ext.azure.log_exporter import AzureLogHandler
    
    
    log = logging.getLogger(__name__)
    
    
    root_logger = logging.getLogger()
    
    telemetry_handler = AzureLogHandler(
        connection_string='InstrumentationKey=00000-000-000-000-00000')
    telemetry_handler.setLevel(logging.INFO)
    root_logger.addHandler(telemetry_handler)
    
    
    def close_everything():
        log.info('closing everything')
        try:
            some_error
        except:
            log.exception('some exception', exc_info=False)
            pass
    
    import atexit
    atexit.register(close_everything)
    atexit.register(logging.shutdown)

    The issue is that python session hangs at exit(). I think line which is creating problem is log.exception('some exception', exc_info=False). Can you please help. Thanks !

    Leighton Chen
    @lzchen
    @lakhotiaharshit is exit() being called at the end of the script? I don't see it being executed
    lakhotiaharshit
    @lakhotiaharshit
    @lzchen Yes exit() is called at the end of the script
    Leighton Chen
    @lzchen
    also may i ask why you are setting the loghandler on the root logger instead of the log = logging.getlogger(__name__)?
    It also seems like close_everything isn't being called correct?
    Oh on exit I see nevermind LD
    lakhotiaharshit
    @lakhotiaharshit
    this is kind of init script of the package. I want to log all the messages from each module of the package that is why I use the root logger
    Leighton Chen
    @lzchen
    try removing logging.shutdown and see if the problem still persists
    As well, the AzureLogHandler registers a flush operation upon exit of the main script, how long is the session hanging for?
    lakhotiaharshit
    @lakhotiaharshit

    how long is the session hanging for?

    It never exited for few minutes. I have tried to manually flush before exiting but that didn't help either.

    Leighton Chen
    @lzchen
    @lakhotiaharshit can you file an issue on the OC github with details of your problem? https://github.com/census-instrumentation/opencensus-python/issues
    lakhotiaharshit
    @lakhotiaharshit
    @lzchen I made the issue census-instrumentation/opencensus-python#881 . Also just to give you a bit more idea on our exact use case, here is the QCoDeS/Qcodes#1968 where we are migrating from applicationinsights to opencensus. Thanks a lot for your help in advance.
    lakhotiaharshit
    @lakhotiaharshit
    @lzchen Things got fixed. try removing logging.shutdown your suggestion worked. In the background this was happening:
    1 ) logging.shutdown is called (this was the last thing we registered and atexit follows opposite order, which I was not aware of. I was thinking first close_everthing happens and logging.shutdown)
    2) Then close_everything is called
    3) Then logging.shutdown is called again (since this is registered as soon as logging is imported)
    I am closing my issue.
    Leighton Chen
    @lzchen
    @lakhotiaharshit Im glad your issue is solved :)
    Todor Popo
    @totopopov
    Hey, so I have attached python logging to Gunicorn logger and to flask workers but Application map still show only the gunicorn. Has anyone managed to resolve such cases ?
    1 reply
    Anmol Gupta
    @Anmol007

    Hi, I'm trying to log extra information in "customDimensions" of Application Insights Logs. I followed the example given in https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-azure#custom-properties
    but the custom_dimensions don't appear in "customDimensions" of Application Insights Logs. Am I missing something?

    logging.info( "Logging Information", extra={ 'custom_dimensions': { 'test': 1234 } } )

    14 replies
    Anmol Gupta
    @Anmol007
    Hi, I'm logging from the Azure Functions with Service Bus Trigger. I addded extra information in log using "custom_dimensions". When I visualize the logs in the Application Insights, the log is getting assigned operation_Id "00000000000000000000000000000000". An extra log appears with the same message and a valid operation_Id and operation_Name 'ServiceBusTopicTrigger" but without the extra information in "custom_dimensions".
    Is this a known issue? How can I have the extra information in the log corresponding to valid operation_Id?
    1 reply
    raphaelauv
    @raphaelauv

    Hi !

    I would like to produce custom metric from python code

    I dont find example or documentation for AZURE ( it's very easy for aws -> https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html )

    Could you help me find an exemple ?

    thank you !!!!

    1 reply
    Gautam
    @gautam-ergo

    Hi,
    We are using FastAPI in our production and successfully implemented log exporting using Azure log handers to App Insights.
    In an attempt to track incoming requests, we followed this article

    https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python-request#tracking-fastapi-applications

    Unfortunately this implementation is leading to OOM issues in our Kubernetes pods.
    Is there another way to track requests and associated stats.

    Any help would be greatly appreciated.

    Thanks !
    Gautam

    Gautam
    @gautam-ergo

    Follow up:
    Did end up finding OpenTelemetry but unfortunately no versions of azure-monitor-opentelemetry-exporter match >1.0.0-beta.3,<2.0.0, opentelemetry-instrumentation-fastapi (>=0.19b0,<0.20) is incompatible with azure-monitor-opentelemetry-exporter (>=1.0.0-beta.3,<2.0.0)

    Any thoughts.
    Thanks !

    gitforanand
    @gitforanand
    Is there a way to use opencensus in ASYNCIO to capture inside await
    Sudhanshu Kaushik
    @sKaushik108_twitter
    I am using opencensus-ext-azure==1.1.0 and exporting metrics, but in app insights UI within customMetrics 'value' column is coming empty while 'valCount', 'valueSum',
    etc are getting populated
    .
    I checked by printing envelope.data.baseData.metrics value is getting passed while min max etc are None