Skip to content
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

"dd.trace_id": "0", "dd.span_id": "0" #33

Open
ewertonhm opened this issue Mar 14, 2024 · 1 comment
Open

"dd.trace_id": "0", "dd.span_id": "0" #33

ewertonhm opened this issue Mar 14, 2024 · 1 comment

Comments

@ewertonhm
Copy link

  • Django DataDog Logger version:latest
  • Python version:3.11
  • Operating System:debian-based/container

Description

I'm trying to correlate my traces and logs, my logs are being output as json, the dd.trace_id and dd.span_id are in the log but their value is 0

What I Did

On my settings.json I put:

MIDDLEWARE = [
    'django_datadog_logger.middleware.request_id.RequestIdMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django_datadog_logger.middleware.error_log.ErrorLoggingMiddleware',
    'django_datadog_logger.middleware.request_log.RequestLoggingMiddleware',
]

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    "formatters": {
        "console": {"format": "{levelname} {message}", "style": "{"},
        "json": {"()": "django_datadog_logger.formatters.datadog.DataDogJSONFormatter"},
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            "formatter": "json",
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'WARNING',
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
            'propagate': False,
        },
    },
}

Also put the env "DD_LOGS_INJECTION=true" in the container, also started the app with "ddtrace-run python manage.py runserver"

Traces are working fine in datadog, logs are also in datadog, but the trace.id on logs is aways 0 and the correlations is not working

@don4of4
Copy link

don4of4 commented Apr 11, 2024

@ewertonhm did you ever get this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants