Skip to content

Commit 04b221e

Browse files
authored
Upgrade datadog agents to the latest versions (#849)
Upgrade dd-trace-agent & datadog-cf-buildpack versions
1 parent 2307311 commit 04b221e

File tree

5 files changed

+46
-7
lines changed

5 files changed

+46
-7
lines changed

buildpack/core/runtime.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ def stage(buildpack_dir, build_path, cache_path):
6868
os.path.join(buildpack_dir, "etc", "m2ee", "m2ee.yaml"),
6969
os.path.join(build_path, ".local", "m2ee.yaml"),
7070
)
71+
72+
scripts_path_source = os.path.join(buildpack_dir, "etc", "scripts")
73+
scripts_path_dest = os.path.join(build_path, ".local", "scripts")
74+
shutil.copytree(
75+
scripts_path_source,
76+
scripts_path_dest,
77+
dirs_exist_ok=True
78+
)
79+
80+
# Add +x permission for all sh scripts
81+
for root, _, files in os.walk(scripts_path_dest):
82+
for file in files:
83+
file_path = os.path.join(root, file)
84+
util.set_executable(file_path)
85+
7186
resolve_runtime_dependency(buildpack_dir, build_path, cache_path)
7287

7388

@@ -613,15 +628,35 @@ def _pre_process_m2ee_yaml():
613628
"-i",
614629
f"s|BUILD_PATH|{os.getcwd()}|g; "
615630
f"s|RUNTIME_PORT|{util.get_runtime_port()}|; "
616-
f"s|ADMIN_PORT|{util.get_admin_port()}|; "
617-
f"s|PYTHONPID|{os.getpid()}|",
631+
f"s|ADMIN_PORT|{util.get_admin_port()}|",
618632
".local/m2ee.yaml",
619633
]
620634
)
621635

622636

637+
def _pre_process_on_error_scripts():
638+
logging.debug("Preprocessing on error scripts...")
639+
subprocess.check_call(
640+
[
641+
"sed",
642+
"-i",
643+
f"s|PYTHONPID|{os.getpid()}|",
644+
".local/scripts/on_error.sh",
645+
]
646+
)
647+
subprocess.check_call(
648+
[
649+
"sed",
650+
"-i",
651+
f"s|PYTHONPID|{os.getpid()}|",
652+
".local/scripts/on_out_of_memory_error.sh",
653+
]
654+
)
655+
656+
623657
def setup(vcap_data):
624658
_pre_process_m2ee_yaml()
659+
_pre_process_on_error_scripts()
625660
_activate_license()
626661

627662
client = m2ee_class(

dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ dependencies:
2121
buildpack:
2222
alias: cf-datadog-sidecar
2323
artifact: datadog/datadog-cloudfoundry-buildpack-{{ version }}.zip
24-
version: 4.37.0
24+
version: 4.42.0
2525
trace-agent:
2626
artifact: datadog/dd-java-agent-{{ version }}.jar
27-
version: 1.27.0
27+
version: 1.45.2
2828
dynatrace:
2929
agent:
3030
artifact: "{{ url }}/e/{{ environment }}/api/v1/deployment/installer/agent/unix/paas/latest?include=java&bitness=64&Api-Token={{ token }}"

etc/m2ee/m2ee.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ m2ee:
2222
javaopts:
2323
[
2424
"-Dfile.encoding=UTF-8",
25-
"-Djava.io.tmpdir=BUILD_PATH/data/tmp",
26-
"-XX:OnError=kill -s USR1 PYTHONPID",
27-
"-XX:OnOutOfMemoryError=kill -s USR2 PYTHONPID",
25+
"-Djava.io.tmpdir=/tmp",
26+
"-XX:OnError=BUILD_PATH/.local/scripts/on_error.sh",
27+
"-XX:OnOutOfMemoryError=BUILD_PATH/.local/scripts/on_out_of_memory_error.sh",
2828
]
2929

3030
jetty:

etc/scripts/on_error.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
kill -s USR1 PYTHONPID
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
kill -s USR2 PYTHONPID

0 commit comments

Comments
 (0)