- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
Supported OS
Datadog 에이전트는 Gunicorn에 대한 하나의 주요 메트릭, 즉 실행 중인 작업자 프로세스의 수를 수집합니다. 또한 Gunicorn이 실행 중인지 여부에 대한 서비스 점검 정보를 전송합니다.
Gunicorn 자체에서 DogStatsD를 사용하여 다음을 포함한 메트릭을 추가로 제공할 수 있습니다:
Datadog 에이전트의 Gunicorn 점검은 Datadog 에이전트 패키지에 포함되어 있으므로 Gunicorn 서버에 아무 것도 설치할 필요가 없습니다.
Gunicorn 점검을 사용하려면 Gunicorn 앱의 파이썬(Python) 환경에 setproctitle
패키지가 있어야 합니다. 없는 경우 Datadog 에이전트는 gunicorn
마스터 프로세스를 찾을 수 없다고 보고합니다(따라서 작업자를 찾을 수 없음). gunicorn.workers
메트릭을 수집하려면 앱의 파이썬 환경에 setproctitle
패키지를 설치하세요.
에이전트의 설정 디렉토리 루트의 conf.d/
폴더에 있는 gunicorn.d/conf.yaml
파일을 수정하여 Gunicorn [메트릭](#메트릭 수집) 및 [로그](#로그 수집) 수집을 시작하세요.
사용 가능한 모든 설정 옵션은 gunicorn.yaml 샘플을 참조하세요.
버전 19.1부터 Gunicorn은 DogStatsD과 마찬가지로 StatsD 프로토콜을 구현하는 데몬에 메트릭을 전송하는 옵션6을 제공합니다. 다른 많은 Gunicorn 옵션과 같이 CLI에서 gunicorn
(--statsd-host
)로 전달하거나 앱의 설정 파일(statsd_host
)에 설정할 수 있습니다. 모든 Gunicorn 메트릭을 수집하려면 앱을 설정하여 "localhost:8125"
에서 DogStatsD로 메트릭을 전송하합니다. 그런 다음 앱을 다시 시작하세요.
gunicorn.d/conf.yaml
파일에 설정 블록을 추가하여 Gunicorn 메트릭 수집을 시작하세요.
init_config:
instances:
## @param proc_name - string - required
## The name of the gunicorn process. For the following gunicorn server:
##
## gunicorn --name <WEB_APP_NAME> <WEB_APP_CONFIG>.ini
##
## the name is `<WEB_APP_NAME>`
- proc_name: <YOUR_APP_NAME>
에이전트 버전 6.0 이상에서 사용 가능
Datadog 에이전트에서 로그 수집은 기본적으로 사용하지 않도록 설정되어 있습니다. datadog.yaml
파일에서 로그 수집을 사용하도록 설정합니다.
logs_enabled: true
다음 명령을 사용하여 액세스 로그 파일의 경로를 설정합니다.
--access-logfile <MY_FILE_PATH>
다음 명령을 사용하여 오류 로그 파일의 경로를 설정합니다.
--error-logfile FILE, --log-file <MY_FILE_PATH>
이 설정 블록을 gunicorn.d/conf.yaml
파일에 추가하여 Gunicorn 로그 수집을 시작하세요.
logs:
- type: file
path: /var/log/gunicorn/access.log
service: "<MY_SERVICE>"
source: gunicorn
- type: file
path: /var/log/gunicorn/error.log
service: "<MY_SERVICE>"
source: gunicorn
log_processing_rules:
- type: multi_line
name: log_start_with_date
pattern: \[\d{4}-\d{2}-\d{2}
service
및 path
파라미터 값을 변경하고 환경에 맞게 설정합니다. 사용 가능한 모든 설정 옵션은 gunicorn.yaml 샘플을 참조하세요.
에이전트의 상태 하위 명령을 실행하고 점검 섹션에서 gunicorn
을 찾습니다.
상태가 OK
가 아닌 경우 트러블슈팅 섹션을 참조하세요.
netstat
을 사용하여 Gunicorn이 자체 메트릭도 전송하는지 확인합니다:
sudo netstat -nup | grep "127.0.0.1:8125.*ESTABLISHED"
udp 0 0 127.0.0.1:38374 127.0.0.1:8125 ESTABLISHED 15500/gunicorn: mas
Gunicorn 점검은 이벤트를 포함하지 않습니다.
Checks
======
gunicorn (5.12.1)
-----------------
- instance #0 [ERROR]: 'Found no master process with name: gunicorn: master [my_web_app]'
- Collected 0 metrics, 0 events & 1 service check
- Dependencies:
- psutil: 4.4.1
Gunicorn이 실제로 실행되고 있지 않거나 앱의 파이썬(Python) 환경에 setproctitle
패키지가 설치되어 있지 않습니다.
setproctitle
이 설치되어 있지 않으면 프로세스 표에 Gunicorn이 다음과 같이 표시됩니다.
$ ps -ef | grep gunicorn
ubuntu 18013 16695 2 20:23 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn --config test-app-config.py gunicorn-test:app
ubuntu 18018 18013 0 20:23 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn --config test-app-config.py gunicorn-test:app
ubuntu 18019 18013 0 20:23 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn --config test-app-config.py gunicorn-test:app
설치되어_있는_경우 gunicorn
프로세스가 Datadog 에이전트에서 예상한 형식대로 표시됩니다.
$ ps -ef | grep gunicorn
ubuntu 18457 16695 5 20:26 pts/0 00:00:00 gunicorn: master [my_app]
ubuntu 18462 18457 0 20:26 pts/0 00:00:00 gunicorn: worker [my_app]
ubuntu 18463 18457 0 20:26 pts/0 00:00:00 gunicorn: worker [my_app]