Sidekiq

Supported OS Mac OS Windows

통합 버전3.0.0

개요

이 통합은 DogstatsdSidekiq을 모니터합니다. Datadog Dogstatsd Ruby 클라이언트를 통해 메트릭을 수집합니다.

참고: Sidekiq Pro(>= 3.6) 또는 Enterprise(>= 1.1.0) 사용자만 메트릭을 수집할 수 있습니다.

설정

설치

Sidekiq 통합은 Datadog Agent 패키지에 포함되어 있습니다. 서버에 추가 설치가 필요하지 않습니다.

구성

  1. dogstatsd-ruby Gem을 설치합니다.

     gem install dogstatsd-ruby
    
  2. 이니셜라이저에 이를 포함하여 Sidekiq Pro 메트릭 수집을 활성화합니다. 컨테이너화 배포의 경우 localhost를 Agent 컨테이너 주소로 업데이트합니다.

         require 'datadog/statsd' # gem 'dogstatsd-ruby'
    
         Sidekiq::Pro.dogstatsd = ->{ Datadog::Statsd.new('localhost', 8125, namespace:'sidekiq') }
    
         Sidekiq.configure_server do |config|
           config.server_middleware do |chain|
             require 'sidekiq/middleware/server/statsd'
             chain.add Sidekiq::Middleware::Server::Statsd
           end
         end
    

    Sidekiq Enterprise를 사용 중이고 과거 메트릭을 수집하려면 다음 줄도 포함합니다.

           Sidekiq.configure_server do |config|
             # history is captured every 30 seconds by default
             config.retain_history(30)
           end
    

    자세한 내용은 Sidekiq ProEnterprise 문서를, 추가 구성 옵션은 Dogstatsd Ruby 문서를 참조하세요.

  3. Datadog Agent 메인 구성 파일 datadog.yaml에 다음 구성을 추가해 업데이트합니다.

    # dogstatsd_mapper_cache_size: 1000  # default to 1000
    dogstatsd_mapper_profiles:
      - name: sidekiq
        prefix: "sidekiq."
        mappings:
          - match: 'sidekiq\.sidekiq\.(.*)'
            match_type: "regex"
            name: "sidekiq.$1"
          - match: 'sidekiq\.jobs\.(.*)\.perform'
            name: "sidekiq.jobs.perform"
            match_type: "regex"
            tags:
              worker: "$1"
          - match: 'sidekiq\.jobs\.(.*)\.(count|success|failure)'
            name: "sidekiq.jobs.worker.$2"
            match_type: "regex"
            tags:
              worker: "$1"
    

    해당 파라미터는 Datadog Agent에 DD_DOGSTATSD_MAPPER_PROFILES 환경 변수를 추가하여 설정할 수도 있습니다.

  4. Agent를 재시작합니다.

수집한 데이터

메트릭

sidekiq.batches.complete
(count)
Count of when a batch is completed
sidekiq.batches.created
(count)
Count of when a batch is created
sidekiq.batches.success
(count)
Count of when a batch is successful
sidekiq.busy
(count)
Total Busy Size (Enterprise only)
Shown as job
sidekiq.dead
(count)
Total Dead Size (Enterprise only)
Shown as job
sidekiq.enqueued
(count)
Total size of all known queues (Enterprise only)
Shown as job
sidekiq.failed
(count)
Number of job executions which raised an error (Enterprise only)
Shown as job
sidekiq.jobs.count
(count)
Total count of Sidekiq jobs
Shown as job
sidekiq.jobs.expired
(count)
Count of when a job is expired
Shown as job
sidekiq.jobs.failure
(count)
Total count of failed Sidekiq jobs
Shown as job
sidekiq.jobs.perform.95percentile
(gauge)
95th percentile of amount of time spent in a worker
Shown as millisecond
sidekiq.jobs.perform.avg
(gauge)
Average amount of time spent in a worker
Shown as millisecond
sidekiq.jobs.perform.count
(count)
The number of times that the amount of time spent in a worker was measured
sidekiq.jobs.perform.max
(gauge)
Max amount of time spent in a worker
Shown as millisecond
sidekiq.jobs.perform.median
(gauge)
Median amount of time spent in a worker
Shown as millisecond
sidekiq.jobs.recovered.fetch
(count)
Count of when a job is recovered by super_fetch after process crash
Shown as job
sidekiq.jobs.recovered.push
(count)
Count of when a job is recovered by reliable_push after network outage
Shown as job
sidekiq.jobs.success
(count)
Total count of successful Sidekiq jobs
Shown as job
sidekiq.jobs.worker.count
(count)
Count of Sidekiq jobs
Shown as job
sidekiq.jobs.worker.failure
(count)
Count of failed Sidekiq jobs
Shown as job
sidekiq.jobs.worker.success
(count)
Count of successful Sidekiq jobs
Shown as job
sidekiq.processed
(count)
Number of job executions completed (success or failure) (Enterprise only)
Shown as job
sidekiq.retries
(count)
Total retries size (Enterprise only)
Shown as job
sidekiq.scheduled
(count)
Total Scheduled Size (Enterprise only)
Shown as job

The Sidekiq integration also allows custom metrics, see Sidekiq Enterprise Historical Metrics.

Sidekiq 통합으로 커스텀 메트릭도 사용할 수 있습니다. Sidekiq Enterprise Historical Metrics를 참조하세요.

로그 수집

  1. 로그 수집은 Datadog Agent에서 기본적으로 비활성화되어 있습니다. 다음을 사용하여 datadog.yaml 파일에서 활성화합니다.

      logs_enabled: true
    
  2. 이 설정 블록을 sidekiq.d/conf.yaml 파일에 추가하여 Sidekiq 로그 수집을 시작하세요.

      logs:
        - type: file
          path:  /var/log/sidekiq.log
          source: sidekiq
          service: <SERVICE>
    

    pathservice 파라미터 값을 변경하여 사용자 환경에 맞게 설정합니다. 로그를 찾을 수 없다면 Sidekiq Logging을 참조하세요.

  3. Agent를 재시작합니다.

서비스 점검

Sidekiq은 서비스 점검을 포함하지 않습니다.

이벤트

Sidekiq은 이벤트를 포함하지 않습니다.

트러블슈팅

도움이 필요하신가요? Datadog 고객 지원팀에 문의해주세요.