opencensus-python icon indicating copy to clipboard operation
opencensus-python copied to clipboard

Request Logs are not Flowing from Azure Pods

Open apurvjain17 opened this issue 4 years ago • 0 comments

Describe your environment. We are using Python version 3.8.3 with Django 3.1.3 and Opencencus-ext-azure version 1.0.7

Steps to reproduce. We have a Django Rest application, whenever we are running the application in our local environment we see the request logs flowing to Azure app Insights. However when the app is deployed to Azure Kubernetes cluster we only see trace logs, request level logs are no longer visible. Logging Configuration:-

    "version": 1,
    "disable_existing_loggers": True,
    "formatters": {
        "verbose": {
            "format": "%(asctime)s|%(created)f|%(levelname)s|%(module)s.%(funcName)s|%(process)d|%(thread)d|%(message)s",
            "datefmt": "%d/%b/%Y %H:%M:%S",
        },
        "simple": {"format": "%(asctime)s|%(levelname)s|%(message)s"},
        'default': {
            'format': '%(asctime)s - %(levelname)s - %(processName)s - %(name)s\n%(message)s',
        }
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "level": "DEBUG",
            "formatter": "default",
        },
        "azure_ai": {
            "class": "opencensus.ext.azure.log_exporter.AzureLogHandler",
            "level": "DEBUG",
            "formatter": "default",
            "instrumentation_key": AZURE_APP_INSIGHTS
            # https://pypi.org/project/opencensus-ext-azure/
            # Assumed ENV APPLICATIONINSIGHTS_CONNECTION_STRING
        },
    },
    "loggers": {
        "django": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "django.request": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "django.db.backends": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "item": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "core": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "publishing": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "publishing.tasks": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "pim": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "user": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "base": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
        "": {
            "handlers": [ "azure_ai", "console"],
            "level": "DEBUG",
            "propagate": True,
        },
    },
}
OPENCENSUS = {
    "TRACE": {
        "SAMPLER": "opencensus.trace.samplers.ProbabilitySampler(rate=1.0)",
        "EXPORTER": """opencensus.ext.azure.trace_exporter.AzureExporter(
            connection_string="InstrumentationKey={}"
        )""".format(
            AZURE_APP_INSIGHTS
        ),
    }
}

What is the expected behavior? We expect to see Requests being logged in our local env as well as through the Kubernetes Cluster

What is the actual behavior? We don't see the Request logs from the application deployed in the Kubernetes cluster.

apurvjain17 avatar Feb 11 '21 09:02 apurvjain17