Code Monkey home page Code Monkey logo

datadog / datadog-agent Goto Github PK

View Code? Open in Web Editor NEW
2.7K 516.0 1.1K 421.06 MB

Main repository for Datadog Agent

Home Page: https://docs.datadoghq.com/

License: Apache License 2.0

Shell 0.66% Go 71.58% Python 3.02% C 20.16% Ruby 0.92% HTML 0.58% C++ 0.49% JavaScript 1.07% CSS 0.06% Swift 0.03% Makefile 0.01% Dockerfile 0.06% Java 0.04% Batchfile 0.05% PowerShell 0.18% CMake 0.03% GDB 0.01% SCSS 0.04% HCL 0.01% C# 1.03%
monitoring go datadog apm-agent apm-instrumentation distributed-tracing logging metrics observability open-telemetry

datadog-agent's Introduction

Datadog Agent

CircleCI Windows unit tests Coverage status GoDoc Go Report Card

The present repository contains the source code of the Datadog Agent version 7 and version 6. Please refer to the Agent user documentation for information about differences between Agent v5, Agent v6 and Agent v7. Additionally, we provide a list of prepackaged binaries for an easy install process here

Note: the source code of Datadog Agent v5 is located in the dd-agent repository.

Documentation

The general documentation of the project, including instructions for installation and development, is located under the docs directory of the present repo.

Getting started

To build the Agent you need:

  • Go 1.21 or later. You'll also need to set your $GOPATH and have $GOPATH/bin in your path.
  • Python 3.9+ along with development libraries for tooling. You will also need Python 2.7 if you are building the Agent with Python 2 support.
  • Python dependencies. You may install these with pip install -r requirements.txt This will also pull in Invoke if not yet installed.
  • CMake version 3.12 or later and a C++ compiler

Note: you may want to use a python virtual environment to avoid polluting your system-wide python environment with the agent build/dev dependencies. You can create a virtual environment using virtualenv and then use the invoke agent.build parameters --python-home-2=<venv_path> and/or --python-home-3=<venv_path> (depending on the python versions you are using) to use the virtual environment's interpreter and libraries. By default, this environment is only used for dev dependencies listed in requirements.txt.

Note: You may have previously installed invoke via brew on MacOS, or pip in any other platform. We recommend you use the version pinned in the requirements file for a smooth development/build experience.

Note: You can enable auto completion for invoke tasks. Use the command below to add the appropriate line to your .zshrc file. echo "source <(inv --print-completion-script zsh)" >> ~/.zshrc

Builds and tests are orchestrated with invoke, type invoke --list on a shell to see the available tasks.

To start working on the Agent, you can build the main branch:

  1. Checkout the repo: git clone https://github.com/DataDog/datadog-agent.git $GOPATH/src/github.com/DataDog/datadog-agent.

  2. cd into the project folder: cd $GOPATH/src/github.com/DataDog/datadog-agent.

  3. Install go tools: invoke install-tools (if you have a timeout error, you might need to prepend the GOPROXY=https://proxy.golang.org,https://goproxy.io,direct env var to the command).

  4. Create a development datadog.yaml configuration file in dev/dist/datadog.yaml, containing a valid API key: api_key: <API_KEY>. You can either start with an empty one or use the full one generated by the Agent build from Step 5 (located in cmd/agent/dist/datadog.yaml after the build finishes).

  5. Build the agent with invoke agent.build --build-exclude=systemd.

    By default, the Agent will be built to use Python 3 but you can select which Python version you want to use:

    • invoke agent.build --python-runtimes 2 for Python2 only
    • invoke agent.build --python-runtimes 3 for Python3 only
    • invoke agent.build --python-runtimes 2,3 for both Python2 and Python3

    You can specify a custom Python location for the agent (useful when using virtualenvs):

    invoke agent.build \
      --python-runtimes 2,3 \
      --python-home-2=$GOPATH/src/github.com/DataDog/datadog-agent/venv2 \
      --python-home-3=$GOPATH/src/github.com/DataDog/datadog-agent/venv3
    

    Running invoke agent.build:

    • Discards any changes done in bin/agent/dist.
    • Builds the Agent and writes the binary to bin/agent/agent.
    • Copies files from dev/dist to bin/agent/dist. See https://github.com/DataDog/datadog-agent/blob/main/dev/dist/README.md for more information.

    If you built an older version of the agent, you may have the error make: *** No targets specified and no makefile found. Stop.. To solve the issue, you should remove CMakeCache.txt from rtloader folder with rm rtloader/CMakeCache.txt.

    Please note that the trace agent needs to be built and run separately.

Please refer to the Agent Developer Guide for more details. For instructions on setting up a windows dev environment, refer to Windows Dev Env.

Testing

Run unit tests using invoke test.

invoke test --targets=./pkg/aggregator

You can also use invoke linter.go to run just the go linters.

invoke linter.go

When testing code that depends on rtloader, build and install it first.

invoke rtloader.make && invoke rtloader.install
invoke test --targets=./pkg/collector/python

Run

You can run the agent with:

./bin/agent/agent run -c bin/agent/dist/datadog.yaml

The file bin/agent/dist/datadog.yaml is copied from dev/dist/datadog.yaml by invoke agent.build and must contain a valid api key.

Run a JMX check

In order to run a JMX based check locally, you must have:

  1. A copy of a JMXFetch jar copied to dev/dist/jmx/jmxfetch.jar
  2. java available on your $PATH

For detailed instructions, see JMX checks

Contributing code

You'll find information and help on how to contribute code to this project under the docs/dev directory of the present repo.

License

The Datadog agent user space components are licensed under the Apache License, Version 2.0. The BPF code is licensed under the General Public License, Version 2.0.

datadog-agent's People

Contributors

ahmed-mez avatar albertvaka avatar alexandreyang avatar arbll avatar brycekahle avatar dependabot[bot] avatar derekwbrown avatar djmitche avatar gbbr avatar gui774ume avatar guyarb avatar hmahmood avatar hush-hush avatar julien-lebot avatar juliogreff avatar kserrania avatar l3n41c avatar lebauce avatar masci avatar mfpierre avatar mx-psi avatar ogaca-dd avatar olivielpeau avatar p-lambert avatar paulcacheux avatar remeh avatar safchain avatar truthbk avatar vboulineau avatar xvello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datadog-agent's Issues

[scheduler] Avoid to reschedule a check if it's already waiting in the pipeline

ATM the scheduler knows nothing about the state of checks, it just send them to a channel at certain time intervals.

We would like to avoid to schedule a check when the same check is already waiting to be executed.

One way could be providing checks with a lock: the scheduler acquires the lock, the executor releases it.

Port memory check form agent5

Port the memory check to the new agent:

  • see if the GoPsutil package abstract win/linux or if we still need to have 2 check

Add SunOS support to gopsutils

For now we only need the memory check but we need to see with the maintainer how he would accept the support of SunOS.

[bug] Memory leak

The agent6 seems to leak memory (cf agent6 testing board in production).

Provide a way to keep state between checks

Provide a memcache-like system exposed through both Go and Python APIs so checks can persist their state across runs (no need to persist across restarts of the agent)

[dogstream] Add benchmarks

Ideally to be able to compare it to:

  • different versions of itself ;)
  • the agent 5 python dogstream
  • fluentd
  • mtail

Set up an apt repo

On a new S3 bucket on our AWS demo account.

  • make our gitlab pipeline push new packages there
  • make our QA env pull packages from there

[check][aggregator] Make checks identify themselves to the aggregator

Currently the aggregator assigns an arbitrary ID to each Sender that's registered to it. This allows the aggregator to know which check a metric comes from.

It would make more sense for each check to have an ID that they would pass to the Sender/aggregator to identify themselves, i.e. the responsibility of identifying a check should be assumed by the check itself instead of by the Sender/aggregator.

The check could then call GetSender(id) to initialize a Sender (id type TBD)

Rename `Configure` to `Init`

Configure method on the Check interface was meant to support configuration injection on the checks but it's also useful to execute code only once in a check lifetime (e.g. computing the # of CPUs in the memory check). To better support the idea, we should rename the method to something more meaningful like Init or Initialize

[tooling] pass the right PKG_CONFIG env vars to rake

Since tests are supposed to use the system python while omnibus is supposed to use the embedded python, it should be possible to invoke test and build tasks with different parameters (either using command line or env vars).

[aggregator] De-dupe tags

Agent5 de-dupes duplicated tags in the list of tags of a metric/event/service check, we could do the same thing in Agent6

[aggregator] Support all existing check metric types

  • rate (use the avg timestamp btw the 2 samples)
  • histogram
  • increment/decrement (Counter python class)
  • count
  • monotonic_count

Check why we've added some of the types in Agent 5
Stop using those that are deprecated on dogweb side

Handle windows for system checks

We need to handle Windows in the system checks (ie: memory, cpu, ...). For that we have to port the logic in the agent5 to gopsutils.

Benchmark agent6 on QA

configure the agent6 with hundred of instances on QA. Do the same with the agent5 to compare.

better config file

We need a working config file for the QA, let's fix minor issues to make it usable

Add init_config support to the agent6

Add very simple support for init_config in the agent6:

For now we're going to duplicate the init_config entry per instances just for the __init__.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.