Skip to content

Commit 11a3acc

Browse files
committed
Polishing
[resolves #684] Signed-off-by: Ben Hale <[email protected]>
1 parent 35a60a9 commit 11a3acc

File tree

2 files changed

+57
-30
lines changed

2 files changed

+57
-30
lines changed

lib/java_buildpack/framework/app_dynamics_agent.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ class AppDynamicsAgent < JavaBuildpack::Component::VersionedDependencyComponent
2828
# (see JavaBuildpack::Component::BaseComponent#compile)
2929
def compile
3030
download_zip(false, @droplet.sandbox, 'AppDynamics Agent')
31-
32-
# acessor for resources dir through @droplet?
31+
32+
# acessor for resources dir through @droplet?
3333
resources_dir = Pathname.new(File.expand_path('../../../resources', __dir__)).freeze
3434
default_conf_dir = resources_dir + @droplet.component_id + 'defaults'
35-
35+
3636
copy_appd_default_configuration(default_conf_dir)
37-
37+
3838
@droplet.copy_resources
3939
end
4040

4141
# (see JavaBuildpack::Component::BaseComponent#release)
4242
def release
4343
credentials = @application.services.find_service(FILTER, 'host-name')['credentials']
44-
java_opts = @droplet.java_opts
44+
java_opts = @droplet.java_opts
4545
java_opts.add_javaagent(@droplet.sandbox + 'javaagent.jar')
4646

4747
application_name java_opts, credentials
@@ -116,10 +116,10 @@ def tier_name(java_opts, credentials)
116116
# @param [Pathname] default_conf_dir the 'defaults' directory present in app_dynamics_agent resources.
117117
# @return [Void]
118118
def copy_appd_default_configuration(default_conf_dir)
119-
if default_conf_dir.exist?
120-
Dir.glob(@droplet.sandbox + 'ver*') do |target_directory|
121-
FileUtils.cp_r"#{default_conf_dir}/.", target_directory
122-
end
119+
return unless default_conf_dir.exist?
120+
121+
Dir.glob(@droplet.sandbox + 'ver*') do |target_directory|
122+
FileUtils.cp_r "#{default_conf_dir}/.", target_directory
123123
end
124124
end
125125

resources/app_dynamics_agent/defaults/conf/app-agent-config.xml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@
9191
<sensitive-data-filter applies-to="environment-variables,system-properties"
9292
match-type="CONTAINS"
9393
match-pattern="key"/>
94-
95-
<sensitive-data-filter applies-to="environment-variables"
96-
match-type="STARTSWITH"
97-
match-pattern="*"/>
94+
95+
<sensitive-data-filter applies-to="environment-variables,system-properties"
96+
match-type="STARTSWITH"
97+
match-pattern="VCAP_"/>
9898

9999
</sensitive-data-filters>
100100

@@ -179,6 +179,7 @@
179179
<exclude-override filter-type="EQUALS" filter-value="spray.client.pipelining$$anonfun$sendReceive$1"/>
180180
<!-- overriding for supporting akka-http microservice-->
181181
<exclude-override filter-type="EQUALS" filter-value="akka.http.scaladsl.server.Route$$anonfun$asyncHandler$1"/>
182+
<exclude-override filter-type="EQUALS" filter-value="akka.http.scaladsl.server.Route$$anonfun$asyncHandler$1$$anonfun$apply$1"/>
182183
<exclude-override filter-type="EQUALS" filter-value="akka.http.scaladsl.server.Route$$anonfun$asyncHandler$1$$anonfun$apply$2"/>
183184
<exclude-override filter-type="EQUALS" filter-value="akka.http.scaladsl.server.StandardRoute$$anon$1"/>
184185
<exclude-override filter-type="STARTSWITH"
@@ -279,16 +280,16 @@
279280
<!-- add classname/method e.g. foo/bar where foo is class name and bar is methd name to mark the method demarcating the end
280281
of an async distributed transaction , does not need a restart -->
281282
<!-- property name="async-transaction-demarcator" value=""/-->
282-
283-
<!--
283+
284+
<!--
284285
Add comma-separated list of async environment names. These will be used to enable async transaction detection
285286
for supported environments. Current supported async environments: mule,camel,jbossesb,tibcobw,scala
286287
-->
287288
<!-- property name="enable-async-correlation-for" value="mule,camel,jbossesb,tibcobw,scala"/ -->
288-
289+
289290
<!--
290291
Cassandra CQL / Datastax driver: uncomment to name Cassandra backends with IP/port instead of naming
291-
with cluster name. In any case the IP/port info goes into snapshot details.
292+
with cluster name. In any case the IP/port info goes into snapshot details.
292293
-->
293294
<!-- property name="enable-cassandra-backend-ip-naming" value="true" -->
294295

@@ -316,14 +317,19 @@
316317
instance: getter-chain eg. getName().toString()
317318
318319
action
319-
type: announcement, execution, suppression
320+
type: announcement, execution, suppression, cancellation, shutdown
320321
token:
321322
announcement:
322323
this - invoked object
323324
<paramIndex> - argument (first argument is 0)
324325
execution:
325326
this - invoked object
326327
<paramIndex> - argument (first argument is 0)
328+
cancellation:
329+
this - invoked object
330+
<paramIndex> - argument (first argument is 0)
331+
shutdown:
332+
return - returned object
327333
-->
328334
<!-- Announcement jobs -->
329335
<job>
@@ -344,6 +350,22 @@
344350
<action type="announcement" token="this"/>
345351
<name-config operation="" type="4"/>
346352
</job>
353+
<!-- Cancellation and Shutdown jobs -->
354+
<job>
355+
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.concurrent.FutureTask"/></match-class>
356+
<match-method><name filter-type="EQUALS" filter-value="cancel"/></match-method>
357+
<action type="cancellation" token="this"/>
358+
</job>
359+
<job>
360+
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.concurrent.ThreadPoolExecutor"/></match-class>
361+
<match-method><name filter-type="EQUALS" filter-value="reject"/></match-method>
362+
<action type="cancellation" token="0"/>
363+
</job>
364+
<job>
365+
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.concurrent.ThreadPoolExecutor"/></match-class>
366+
<match-method><name filter-type="EQUALS" filter-value="shutdownNow"/></match-method>
367+
<action type="shutdown" token="return"/>
368+
</job>
347369
<!-- Execution jobs -->
348370
<job>
349371
<match-class type="implements-interface"><name filter-type="EQUALS" filter-value="java.lang.Runnable"/></match-class>
@@ -362,43 +384,48 @@
362384
<match-method><name filter-type="EQUALS" filter-value="run"/></match-method>
363385
<action type="execution" token="this"/>
364386
<name-config operation="" type="4"/>
365-
</job>
387+
</job>
366388
<!-- Suppression jobs -->
367389
<job>
368390
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.Timer"/></match-class>
369391
<match-method><name filter-type="EQUALS" filter-value="&lt;init&gt;"/></match-method>
370392
<action type="suppression"/>
371-
</job>
393+
</job>
372394
<job>
373395
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.concurrent.ThreadPoolExecutor"/></match-class>
374396
<match-method><name filter-type="EQUALS" filter-value="addWorker"/></match-method>
375397
<action type="suppression"/>
376-
</job>
398+
</job>
377399
<job>
378400
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="java.util.concurrent.ForkJoinPool"/></match-class>
379401
<match-method><name filter-type="EQUALS" filter-value="createWorker"/></match-method>
380402
<action type="suppression"/>
381-
</job>
403+
</job>
404+
<job>
405+
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="scala.concurrent.forkjoin.ForkJoinPool"/></match-class>
406+
<match-method><name filter-type="EQUALS" filter-value="tryAddWorker"/></match-method>
407+
<action type="suppression"/>
408+
</job>
382409
<job>
383410
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="akka.actor.ActorSystemImpl"/></match-class>
384411
<match-method><name filter-type="EQUALS" filter-value="tryAddWorker"/></match-method>
385412
<action type="suppression"/>
386-
</job>
413+
</job>
387414
<job>
388415
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="io.netty.util.concurrent.SingleThreadEventExecutor"/></match-class>
389416
<match-method><name filter-type="EQUALS" filter-value="startThread"/></match-method>
390417
<action type="suppression"/>
391-
</job>
418+
</job>
392419
<job>
393420
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase"/></match-class>
394421
<match-method><name filter-type="EQUALS" filter-value="start"/></match-method>
395422
<action type="suppression"/>
396-
</job>
423+
</job>
397424
<job>
398425
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor"/></match-class>
399426
<match-method><name filter-type="EQUALS" filter-value="execute"/></match-method>
400427
<action type="suppression"/>
401-
</job>
428+
</job>
402429
<job>
403430
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="org.jboss.netty.util.internal.DeadLockProofWorker"/></match-class>
404431
<match-method><name filter-type="EQUALS" filter-value="start"/></match-method>
@@ -408,12 +435,12 @@
408435
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="com.ning.http.client.providers.netty.NettyAsyncHttpProvider"/></match-class>
409436
<match-method><name filter-type="EQUALS" filter-value="newNettyTimer"/></match-method>
410437
<action type="suppression"/>
411-
</job>
438+
</job>
412439
<job>
413440
<match-class type="matches-class"><name filter-type="EQUALS" filter-value="io.netty.util.concurrent.SingleThreadEventExecutor"/></match-class>
414441
<match-method><name filter-type="EQUALS" filter-value="doStartThread"/></match-method>
415442
<action type="suppression"/>
416-
</job>
443+
</job>
417444
</async-config>
418445
<fork-config>
419446
<!-- This is the configuration for the "constructor" strategy -->
@@ -675,7 +702,7 @@
675702
</agent-service>
676703
<agent-service name="LogParserService" enabled="true">
677704
</agent-service>
678-
<agent-service name="ResourceMonitoringService" enabled="true">
705+
<agent-service name="ResourceMonitoringService" enabled="false">
679706
<service-dependencies>BCIEngine</service-dependencies>
680707
</agent-service>
681708

@@ -698,5 +725,5 @@
698725
<service-configuration-properties agent-service="SnapshotService">
699726
<property name="enable-startup-snapshot-policy" value="true"/>
700727
</service-configuration-properties>
701-
-->
728+
-->
702729
</app-agent-configuration>

0 commit comments

Comments
 (0)