Skip to content

Commit 990b230

Browse files
committed
Shorter Heap Dump IDs
Previously the heapdump file location embedded the entire UUID for the space, the application, and the instance. This was, to put it mildly, long. This change shrinks that value to only include the first 8 characters (everything before the first hyphen) of those ids.
1 parent 4c94631 commit 990b230

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/java_buildpack/jre/jvmkill_agent.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def supports?
5757
private_constant :FILTER
5858

5959
def application_identifier
60-
"#{@application.details['application_name']}-#{@application.details['application_id']}"
60+
"#{@application.details['application_name']}-#{@application.details['application_id'][0...8]}"
6161
end
6262

6363
def container_dir
@@ -69,15 +69,15 @@ def heap_dump_path
6969
end
7070

7171
def instance_identifier
72-
'$CF_INSTANCE_INDEX-%FT%T%z-$CF_INSTANCE_GUID'
72+
'$CF_INSTANCE_INDEX-%FT%T%z-${CF_INSTANCE_GUID:0:8}'
7373
end
7474

7575
def jvmkill_agent
7676
@droplet.sandbox + "bin/jvmkill-#{@version}"
7777
end
7878

7979
def space_identifier
80-
"#{@application.details['space_name']}-#{@application.details['space_id']}"
80+
"#{@application.details['space_name']}-#{@application.details['space_id'][0...8]}"
8181
end
8282

8383
end

spec/java_buildpack/jre/jvmkill_agent_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
component.release
5151

5252
expect(java_opts).to include('-agentpath:$PWD/.java-buildpack/jvmkill_agent/bin/jvmkill-0.0.0=' \
53-
'printHeapHistogram=1,heapDumpPath=test-container-dir/test-space-name-test-space-id/' \
54-
'test-application-name-test-application-id/$CF_INSTANCE_INDEX-%FT%T%z-' \
55-
'$CF_INSTANCE_GUID.hprof')
53+
'printHeapHistogram=1,heapDumpPath=test-container-dir/test-space-name-test-spa/' \
54+
'test-application-name-test-app/$CF_INSTANCE_INDEX-%FT%T%z-' \
55+
'${CF_INSTANCE_GUID:0:8}.hprof')
5656
end
5757

5858
end

0 commit comments

Comments
 (0)