innomic / pulumi-datadog

Pulumi-based IaC for Datadog
https://www.pulumi.com/registry/packages/datadog/
0 stars 0 forks source link

[learn.datadoghq.com] Datadog 101: Developer #2

Open civilizeddev opened 2 years ago

civilizeddev commented 2 years ago

Application developers get enormous value out of Datadog, but in significantly different ways than DevOps engineers or SREs.

You’ll begin this course by installing the Datadog Agent in a containerized web application. You’ll then create Synthetic Tests to monitor critical front-end services with simulated customer interactions. And as the name implies, Real User Monitoring (RUM) will help you measure and improve the quality of your users’ experience.

Along the way you will see how Datadog’s core tools such as Logs, APM, Dashboards, Monitors, and Alerts can help you stay ahead of application issues before they cause problems for your users.

See Also

civilizeddev commented 2 years ago

SaaS 서비스로서 Datadog의 강점

  1. 대량 데이터 수집
  2. 저장
  3. 구조화 분석
civilizeddev commented 2 years ago

실습 내용

  1. installing the Datadog Agent
  2. working with integrations
  3. configuring your services for
    1. application performance monitoring (APM)
    2. log collection
    3. synthetic API and browser testing
    4. real user monitoring (RUM)
civilizeddev commented 2 years ago

당부 사항

The most important thing you can walk away with today is inspiration.

civilizeddev commented 2 years ago

The Agent on Docker

In this lab, you will install and configure the Agent in a Docker environment.

The objectives for this section are:

  1. Install and configure the Agent in a Docker environment.
  2. Add labels to service containers to ensure the Agent tags them correctly.
  3. Confirm that the Agent is collecting metrics correctly, and that they are tagged correctly in the Datadog app.
civilizeddev commented 2 years ago

docker-compose.yaml

  datadog:
    image: 'datadog/agent:7.31.1'
    environment:
      - DD_API_KEY
      - DD_LOGS_ENABLED=true
      - DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true
      - DD_PROCESS_AGENT_ENABLED=true
      - DD_DOCKER_LABELS_AS_TAGS={"my.custom.label.team":"team"}
      - DD_TAGS='env:dd101-dev'
      - DD_HOSTNAME=dd101-dev-host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /proc/:/host/proc/:ro
      - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro

References

civilizeddev commented 2 years ago

호스트 파일 연결

civilizeddev commented 2 years ago

환경변수

civilizeddev commented 2 years ago

docker-compose exec datadog agent status

Getting the status from the agent.

===============
Agent (v7.31.1)
===============

  Status date: 2022-07-08 00:28:16.898 UTC (1657240096898)
  Agent start: 2022-07-08 00:28:02.606 UTC (1657240082606)
  Pid: 380
  Go Version: go1.15.13
  Python Version: n/a
  Build arch: amd64
  Agent flavor: agent
  Check Runners: 4
  Log Level: info

  Paths
  =====
    Config File: /etc/datadog-agent/datadog.yaml
    conf.d: /etc/datadog-agent/conf.d
    checks.d: /etc/datadog-agent/checks.d

  Clocks
  ======
    System time: 2022-07-08 00:28:16.898 UTC (1657240096898)

  Host Info
  =========
    bootTime: 2022-07-07 23:50:29 UTC (1657237829000)
    kernelArch: x86_64
    kernelVersion: 5.13.0-1015-gcp
    os: linux
    platform: ubuntu
    platformFamily: debian
    platformVersion: 21.04
    procs: 150
    uptime: 37m48s
    virtualizationRole: guest
    virtualizationSystem: docker

  Hostnames
  =========
    host_aliases: [docker-vm.vvncnayhy5tj.svc.cluster.local p-vvncnayhy5tj-docker-vm.instruqt-prod]
    hostname: dd101-dev-host
    socket-fqdn: 425b34ad89c2
    socket-hostname: 425b34ad89c2
    host tags:
      'env:dd101-dev'
      accessible-from-goog-gke-node
      allow-external-ingress-high-ports
      allow-external-ingress-http
      allow-external-ingress-https
      p-vvncnayhy5tj
      zone:europe-west1-b
      instance-type:n1-standard-1
      internal-hostname:docker-vm.vvncnayhy5tj.svc.cluster.local
      instance-id:4193758585264197592
      project:instruqt-prod
      numeric_project_id:3390740675
      INSTRUQT_AWS_ACCOUNTS:
      INSTRUQT_AZURE_SUBSCRIPTIONS:
      INSTRUQT_GCP_PROJECTS:
      hostname:docker-vm
    hostname provider: configuration

  Metadata
  ========

=========
Collector
=========

  Running Checks
  ==============
    No checks have run yet

========
JMXFetch
========

  Information
  ==================
  Initialized checks
  ==================
    no checks

  Failed checks
  =============
    no checks

=========
Forwarder
=========

  Transactions
  ============
    Cluster: 0
    CronJob: 0
    DaemonSet: 0
    Deployment: 0
    Dropped: 0
    DroppedOnInput: 0
    Job: 0
    Node: 0
    PersistentVolume: 0
    PersistentVolumeClaim: 0
    Pod: 0
    ReplicaSet: 0
    Requeued: 0
    Retried: 0
    RetryQueueSize: 0
    Service: 0
    StatefulSet: 0

  API Keys status
  ===============
    API key ending with 582f5: API Key valid

==========
Endpoints
==========
  https://app.datadoghq.com - API Key ending with:
      - 582f5

==========
Logs Agent
==========

    Sending compressed logs in HTTPS to agent-http-intake.logs.datadoghq.com on port 443
    BytesSent: 0
    EncodedBytesSent: 28
    LogsProcessed: 0
    LogsSent: 0

=========
APM Agent
=========
  Status: Running
  Pid: 378
  Uptime: 14 seconds
  Mem alloc: 8,188,120 bytes
  Hostname: dd101-dev-host
  Receiver: 0.0.0.0:8126
  Endpoints:
    https://trace.agent.datadoghq.com

  Receiver (previous minute)
  ==========================
    No traces received in the previous minute.
    Default priority sampling rate: 100.0%

  Writer (previous minute)
  ========================
    Traces: 0 payloads, 0 traces, 0 events, 0 bytes
    Stats: 0 payloads, 0 stats buckets, 0 bytes

=========
Aggregator
=========
  Dogstatsd Metric Sample: 48
  Event: 1
=========
DogStatsD
=========
  Event Packets: 0
  Event Parse Errors: 0
  Metric Packets: 47
  Metric Parse Errors: 0
  Service Check Packets: 0
  Service Check Parse Errors: 0
  Udp Bytes: 3,597
  Udp Packet Reading Errors: 0
  Udp Packets: 32
  Uds Bytes: 0
  Uds Origin Detection Errors: 0
  Uds Packet Reading Errors: 0
  Uds Packets: 0
  Unterminated Metric Errors: 0
civilizeddev commented 2 years ago

docker-compose exec datadog agent config

필터링

docker-compose exec datadog agent config | grep -A1 "^tags:"
civilizeddev commented 2 years ago

컨테이너 목록 및 상태 조회

image
civilizeddev commented 2 years ago

컨테이너 (자세히)

누르면 더 상세히

image
civilizeddev commented 2 years ago

Log / Search

image

discount를 고르니

죄다 에러로 보이고 있다.

image

역시 누르면 더 자세히

image
civilizeddev commented 2 years ago

컨테이너 레이블을 태그로 활용

나중에 쿠버네티스 레이블도 마찬가지로 데이터 태그로 활용 가능

civilizeddev commented 2 years ago

Datadog Integrations

https://app.datadoghq.com/integrations

image
civilizeddev commented 2 years ago

Logs / Configuration / Pipelines

로그 수집 파이프라인

image
civilizeddev commented 2 years ago

Postgres Integration

로그 파싱 (JSON Attributes로 추출)

image
civilizeddev commented 2 years ago

Python Log Collection

인프라 유틸리티는 표준 파서가 있지만, 애플리케이션 로그 파싱은 개발자가 커스터마이즈 해야 한다.

https://docs.datadoghq.com/logs/log_collection/python/?tab=jsonlogformatter&tabs=jsonlogformatter

civilizeddev commented 2 years ago

APM Setup & Docs

https://app.datadoghq.com/apm/docs

civilizeddev commented 2 years ago

APM / Service Map

image
civilizeddev commented 2 years ago

APM / Service Map

클러스터 보기

image
civilizeddev commented 2 years ago

APM

엔드포인트 별 통계

image
civilizeddev commented 2 years ago

Monitors

Alert -> Resolved

image
civilizeddev commented 2 years ago

Profiling

https://docs.datadoghq.com/tracing/profiler/

civilizeddev commented 2 years ago

로그 질의 및 분석

안 되서 다음에 (...)

Sorry, we can't find the track you're looking for
datadog / dd101-for-developers-lab-05-log-querying-and-analytics