Skip to content

Conversation

@devindford
Copy link
Contributor

@devindford devindford commented Apr 5, 2023

Description

  • Adds some commands and files for DBM
  • Give the agent container a static ip (fixed web-1's connection issues)
  • Updated the DBM query to hit the db harder and have more room for improvement in the lab
  • Updated the README with instructions

How to test

  • Pull this branch
  • in services/frontend/site/featureFlags.config.json find the object with name:dbm and set active:true
  • run docker-compose --profile dbm up -d
  • once all the containers are up, run docker exec storedog-postgres-1 ./dbm_exec.sh this will add a few things we need for dbm to the database
  • run docker restart storedog-postgres-1 to restart the postgres container
  • to test the connections run this code snippet:
docker-compose exec postgres psql -h localhost -U datadog postgres -A \
  -c "select * from pg_stat_database limit 1;" \
  && echo -e "\e[0;32mPostgres connection - OK\e[0m" \
  || echo -e "\e[0;31mCannot connect to Postgres\e[0m"
docker-compose exec postgres psql -h localhost -U datadog postgres -A \
  -c "select * from pg_stat_activity limit 1;" \
  && echo -e "\e[0;32mPostgres pg_stat_activity read OK\e[0m" \
  || echo -e "\e[0;31mCannot read from pg_stat_activity\e[0m"
docker-compose exec postgres psql -h localhost -U datadog postgres -A \
  -c "select * from pg_stat_statements limit 1;" \
  && echo -e "\e[0;32mPostgres pg_stat_statements read OK\e[0m" \
  || echo -e "\e[0;31mCannot read from pg_stat_statements\e[0m"
  • All statuses should return OK

You should now see your logs in DBM here https://dd-corpsite.datadoghq.com/databases/list

- DD_APM_ENABLED=true
- DD_APM_NON_LOCAL_TRAFFIC=true
- DD_LOGS_ENABLED=true
- DD_HOSTNAME=172.43.0.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be set to make sure we are able to send logs into the agent since by default it uses localhost

Comment on lines +213 to +214
storedog-net:
ipv4_address: 172.43.0.4
Copy link
Contributor Author

@devindford devindford Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting a static IP for the agent so it doesn't change

DB_PORT: 5432
DISABLE_SPRING: 1
DD_APPSEC_ENABLED: 1
DD_AGENT_HOST: 172.43.0.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the solve for the tcp connection errors

agent status output after fixes
==========
Logs Agent
==========
    Reliable: Sending compressed logs in HTTPS to agent-http-intake.logs.datadoghq.com on port 443
    BytesSent: 642355
    EncodedBytesSent: 92185
    LogsProcessed: 651
    LogsSent: 759

  container_collect_all
  ---------------------
    - Type: docker
      Service: storedog-dbm
      Source: storedog-dbm
      Status: OK
      Inputs:
        38867147581eff5f9db8b8ac550861b5fa9091e2dc281d1348654924b272871b
      Bytes Read: 531
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: redis
      Source: redis
      Status: OK
      Inputs:
        806e394bca692eb253365cd5948b776042e29b453c66df9edaf5692b5de8527a
      Bytes Read: 1400
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: agent
      Source: agent
      Status: OK
      Inputs:
        d11e307af8e186922804c9168986d5a0b62d70328b70a33cea75ab4ec6cbb2c8
      Bytes Read: 77443
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 3
        24h Peak Latency (ms): 3
    - Type: docker
      Service: storedog-frontend
      Source: storedog-frontend
      Status: OK
        The log file tailer could not be made, falling back to socket
      Inputs:
        1d66a2f080dbcac5776c004923b5ae4c2ff5a92b2c0e359d435a9a39d471b55f
      Bytes Read: 9325
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: storedog-worker
      Source: storedog-worker
      Status: OK
      Inputs:
        e1219a669848bba7dbe27f9c17288fab3e456ccf94c388ebe9de66f6ffc076e8
      Bytes Read: 0
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: storedog-web
      Source: storedog-web
      Status: OK
      Inputs:
        0b952a80bbb217232e3f3bcc41ed592b1cf5323762645abd2c539a3174fb5807
      Bytes Read: 0
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0

  docker
  ------
    - Type: docker
      Service: discounts
      Source: python
      Status: OK
      Inputs:
        5e58af55aee69b932391d25a298b957144fcfe3720db2b790823e7f55995fcd2
      Bytes Read: 1616
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: postgresql
      Source: postgresql
      Status: OK
      Inputs:
        5f5962c945c3285ef0abe4378ea02fa58897ae1fc1afafa66661ce62a754683f
      Bytes Read: 494
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: ads
      Source: python
      Status: OK
      Inputs:
        8bd2b5bc49b180f1263de39f459d07629ddca1f57a93c15b68508492b798548e
      Bytes Read: 1186
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: ads-java
      Source: java
      Status: OK
      Inputs:
        f45d6e533f4188c829b4e74d41ae499bfed0164532deedb91c6bc99d0fa1148c
      Bytes Read: 4503
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0
    - Type: docker
      Service: nginx
      Source: nginx
      Status: OK
      Inputs:
        44f125a1980489581ae12d3128e10c84ed450f01d64e64a1482780306c6aae4f
      Bytes Read: 0
      Pipeline Latency:
        Average Latency (ms): 0
        24h Average Latency (ms): 0
        Peak Latency (ms): 0
        24h Peak Latency (ms): 0

@devindford devindford merged commit 93db870 into main Apr 7, 2023
@devindford devindford deleted the devin.ford/dbm-connection branch April 7, 2023 13:56
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

Successfully merging this pull request may close these issues.

3 participants