Code Monkey home page Code Monkey logo

datadog's Introduction

gcr.io/paketo-buildpacks/datadog

The Paketo Buildpack for Datadog is a Cloud Native Buildpack that contributes and configures the Datadog Agent.

Behavior

This buildpack will participate if all the following conditions are met

  • The $BP_DATADOG_ENABLED is set to a truthy value (i.e. true, t, 1 ignoring case)

The buildpack will do the following for Java applications:

  • Contributes the Datadog Java agent to a layer and configures $JAVA_TOOL_OPTIONS or $BP_NATIVE_IMAGE_BUILD_ARGUMENTS to use it

The buildpack will do the following for Node.js applications:

  • Contributes the Datadog Node.js trace agent to a layer
  • Require the trace agent, if it's not present

Configuration

Environment Variable Description
$BP_DATADOG_ENABLED whether to contribute the Datadog trace agent
$BPL_DATADOG_DISABLED whether to disable the Datadog trace agent (non native-image Java applications only!)

Usage

Instructions for using the buildpack can be found at the links below:

Bindings

The buildpack optionally accepts the following bindings:

Type: dependency-mapping

Key Value Description
<dependency-digest> <uri> If needed, the buildpack will fetch the dependency with digest <dependency-digest> from <uri>

License

This buildpack is released under version 2.0 of the Apache License.

datadog's People

Contributors

anthonydahanne avatar dependabot[bot] avatar dmikusa avatar engine-workflow avatar paketo-bot avatar perfectslayer avatar pivotal-david-osullivan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

datadog's Issues

Datadog buildpack no longer participates in a Node.js build without a package manager

The node-start order group in the language family buildpack for Node.js is meant to support running Node.js applications which do not utilize a package manager such as npm or yarn. With the recent changes to include node_modules in this buildpack's detection criteria, it is no longer possible for the buildpack to participate in such a build (these apps do not have node_modules).

Expected Behavior

When BP_DATADOG_ENABLED is set to true and node_modules are not present, I can build a Node.js application which uses Datadog.

Current Behavior

The buildpack for Datadog does not participate in a build where the above criteria have been met.

Steps to Reproduce

  1. Clone the Paketo samples repo and navigate to the no-package-manager sample app under the nodejs subdirectory.
  2. pack build the application with the BP_DATADOG_ENABLED env var set to true
  3. Observe that Buildpack for Datadog does not appear in the build logs.

Write docs for Kubernetes

Describe the Enhancement

We have detailed docs for using this buildpack & Datadog on Docker. We should have docs for Kubernetes as well.

Possible Solution

Document the steps for using on Kubernetes here.

Motivation

Lots of people use Kubernetes :)

Allow toggling the Java Agent on/off at runtime

Describe the Enhancement

Right now, when you do a build the Java agent is enabled through JAVA_TOOL_OPTIONS at build time. This is difficult to disable without rebuilding. We should allow the Java agent to be enabled/disabled at runtime.

Possible Solution

Add a helper. The helper can be in charge of setting the JAVA_TOOL_OPTIONS options. It would look at an env variable and use that to turn on/off the agent.

Motivation

Sometimes you want to run with the Agent disabled and don't want to do a full rebuild, which is inconvenient.

Datadog Buildpack detecting java build as node

I am using spring boot 3.0.1 and the gradle buildpack plugin to setup my container. Today the builds started detecting something in the project indicating the project uses node (which it doesn't), and the datadog build step tries to setup the nodejs agent instead of the java step.

Still investigating on my end, but I saw this comment here on the commit and figured it might be worth raising as a bug.

I can't paste my whole build output here, but please let me know if there is anything else I should take a peek at that may indicate why it's getting detected as a node project or specific pieces that may help solve the issue.

Expected Behavior

Java agent is setup correctly

Current Behavior

Node agent is setup instead

Possible Solution

Something seems to be detecting as node, not sure what

Steps to Reproduce

With a gradle spring boot project

  1. run ./gradlew bootBuildImage with BP_DATADOG_ENABLED set to true
  2. See the buildpack steps for datadog outputting node js setup
  [creator]     Paketo Buildpack for Datadog 3.6.0
    [creator]       https://github.com/paketo-buildpacks/datadog
    [creator]       Datadog NodeJS Agent 3.13.1: Contributing to layer
    [creator]         Downloading from https://registry.npmjs.org/dd-trace/-/dd-trace-3.13.1.tgz
    [creator]         Verifying checksum
    [creator]         Installing to /layers/paketo-buildpacks_datadog/datadog-agent-nodejs
    [creator]     25l[..................] / idealTree: sill logfile done cleaning log files
    ,......
    25h
    [creator]     added 50 packages in 3s
    [creator]     
    [creator]     4 packages are looking for funding
    [creator]       run `npm fund` for details
    [creator]     npm notice 
    [creator]     npm notice New minor version of npm available! 9.3.1 -> 9.5.1
    [creator]     npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.5.1
    [creator]     npm notice Run npm install -g [email protected] to update!
    [creator]     npm notice 
    [creator]     unable to invoke layer creator
    [creator]     unable to read contents of /workspace/server.js
    [creator]     open /workspace/server.js: no such file or directory
    [creator]     ERROR: failed to build: exit status 1

Motivations

Currently this is blocking our builds since the buildpack is attempting to pull in the node agent instead of the java agent.

Buildpack downloads from Maven central but does not consider ~/.m2/settings.xml

Expected Behavior

Buildpack downloads Datadog Java Agent from company Maven proxy server.

Current Behavior

Buildpack tries to download Datadog Java Agent from Maven central.

Possible Solution

Buildpack uses Maven settings.xml or allows defining HTTP proxy variables, for instance, to ignore invalid certificates.

Steps to Reproduce

  1. Add mirror to Maven settings.xml
<mirror>
  <id>nexus</id>
  <mirrorOf>central</mirrorOf>
  <url>https://my-company.org/artifacts/repository/maven/</url>
</mirror>
  1. Add Datadog env var to pom.xml:
<env>
  <BP_DATADOG_ENABLED>true</BP_DATADOG_ENABLED>
</env>
  1. Execute build image using Maven:
mvn spring-boot:build-image
  1. Maven build will fail with the following console output:
[INFO]     [creator]     Paketo Buildpack for Datadog 2.3.0
[INFO]     [creator]       https://github.com/paketo-buildpacks/datadog
[INFO]     [creator]       Datadog Java Agent 0.109.0: Contributing to layer
[INFO]     [creator]         Downloading from https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/0.109.0/dd-java-agent-0.109.0.jar
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency datadog-agent-java
[INFO]     [creator]     unable to download https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/0.109.0/dd-java-agent-0.109.0.jar
[INFO]     [creator]     unable to request https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/0.109.0/dd-java-agent-0.109.0.jar
[INFO]     [creator]     Get "https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/0.109.0/dd-java-agent-0.109.0.jar": x509: certificate signed by unknown authority
[INFO]     [creator]     ERROR: failed to build: exit status 1

Motivations

This prevents me from using Paketo, as I need the Datadog Java Agent inside the image. I can import the certificate into my local Java installation, but this will only work for a short time, as the certificate from the proxy server is only valid for two weeks.

Buildpack not working

I'm new to buildpacks and tried to inject the dd-agent into my java app build but it somehow failed. My app is a very simple spring-cloud java app build with gradle. Without the dadatog-buildpack it works like a charm. If you need some more Informations, don't hesitate to ask ...

pack build base-product-service --builder paketobuildpacks/builder:tiny --buildpack paketo-buildpacks/[email protected] --buildpack paketo-buildpacks/[email protected]

base: Pulling from paketobuildpacks/builder
Digest: sha256:92b2e65a82eb5fef2f6acbb27468506802284bf49c14658f0bb861d995694823
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:bcab6379bf83f0657dab49f08c7da7f23a6b18145352b2e13178e35cf6bd39c1
Status: Image is up to date for paketobuildpacks/run:base-cnb
gcr.io/paketo-buildpacks/datadog@sha256:6f94305055e61bfb03d8c8a84679e8ef7c5971c060ee613ca1e653baf13b1a07: Pulling from paketo-buildpacks/datadog
Digest: sha256:6f94305055e61bfb03d8c8a84679e8ef7c5971c060ee613ca1e653baf13b1a07
Status: Image is up to date for gcr.io/paketo-buildpacks/datadog@sha256:6f94305055e61bfb03d8c8a84679e8ef7c5971c060ee613ca1e653baf13b1a07
gcr.io/paketo-buildpacks/java@sha256:190e0e0fca654c7991d770087acf0c9b8f551780f435bc0893217061be02ba70: Pulling from paketo-buildpacks/java
Digest: sha256:190e0e0fca654c7991d770087acf0c9b8f551780f435bc0893217061be02ba70
Status: Image is up to date for gcr.io/paketo-buildpacks/java@sha256:190e0e0fca654c7991d770087acf0c9b8f551780f435bc0893217061be02ba70
===> ANALYZING
Restoring data for sbom from previous image
===> DETECTING
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 20

Agent configuration through a properties file

Hi,

Recently switch from https://github.com/DataDog/datadog-trace-paketo-buildpack to this new buildpack.
Thanks for your work ;-)
The buildpack I used before provide a convenient way to configure the DataDog agent through a properties file.
Personally, I really prefer to do it like that than to provide a lot of environment variables and didn't find anything in your documentation about that.
Could be great to add this feature :-)

Describe the Enhancement

Provide a easy way to configure the DataDog agent through a properties file.

Possible Solution

Provide a mechanism similar to https://github.com/DataDog/datadog-trace-paketo-buildpack.

Motivation

Ease the configuration of the agent.

Add support for graal native image

The buildpack does worktogehther spring-boot:build-image
It shall download and copy the dd-trace-agent.jar and add a agent param "-J-javaagent:target/dependency/dd-trace-agent.jar" to the native-image compile call

It looks like its only supporting basic jvm build but not native image
image
I tried following but then no buildpack is detected. With commented <buildpack>gcr.io/paketo-buildpacks/datadog</buildpack>
it works but of course dd agent is not part of the image.

     <plugin><!-- modify buildpack which creates a container image to include DD specific args -->
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <image>
                                <name>${project.artifactId}:buildpacks-nativeDD</name>
                                <buildpacks>
                                    <buildpack>gcr.io/paketo-buildpacks/bellsoft-liberica:${bellsoft-liberica.version}
                                    </buildpack>
                                    <buildpack>gcr.io/paketo-buildpacks/datadog</buildpack>
                                    <buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
                                </buildpacks>
                                <env>
                                    <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
                                    <BP_DATADOG_ENABLED>true</BP_DATADOG_ENABLED>
                                    <BP_JVM_VERSION>17</BP_JVM_VERSION>
                                    <BP_NATIVE_IMAGE_BUILD_ARGUMENTS>--enable-url-protocols=http -H:+AddAllCharsets
                                    </BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
                                    <BP_BINARY_COMPRESSION_METHOD>upx</BP_BINARY_COMPRESSION_METHOD>
                                    <pullPolicy>IF_NOT_PRESENT</pullPolicy>
                                </env>
                            </image>
                        </configuration>
                        <executions>
                            <execution>
                                <id>process-aot</id>
                                <goals>
                                    <goal>process-aot</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>build-image</id>
                                <goals>
                                    <goal>build-image-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

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.