Skip to content

Commit d4053a6

Browse files
Merge pull request #998 from M-Tsur/re-enable-takipi
Re-add Takipi Agent
2 parents ca00cef + 1466ed8 commit d4053a6

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

config/components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,6 @@ frameworks:
7575
- "JavaBuildpack::Framework::SpringInsight"
7676
- "JavaBuildpack::Framework::SkyWalkingAgent"
7777
- "JavaBuildpack::Framework::YourKitProfiler"
78+
- "JavaBuildpack::Framework::TakipiAgent"
7879
- "JavaBuildpack::Framework::JavaSecurity"
7980
- "JavaBuildpack::Framework::JavaOpts"

config/takipi_agent.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
# Configuration for the Takipi framework
1717
---
1818
version: 4.+
19-
repository_root: ""
19+
repository_root: https://get.takipi.com/cloudfoundry
2020
node_name_prefix: node
2121
application_name:

docs/framework-takipi_agent.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ The framework can be configured by modifying the [`config/takipi_agent.yml`][] f
3636
| `node_name_prefix` | Node name prefix, will be concatenated with `-` and instance index
3737
| `application_name` | Override the CloudFoundry default application name
3838

39+
### Remarks
40+
In case **Java 9+** is being used, 2 JVM flags will be added to the execution:
41+
| Name | Description
42+
| ---- | -----------
43+
| `-XX:-UseTypeSpeculation` | Disable type speculation optimization of the JVM which might not work properly in some situations where an agent is present.
44+
| `-Xshare:off` | Disable class sharing as it might affect the agent's bytecode manipulation work.
45+
46+
These two flags are needs as otherwise the agent or the JVM might not work properly together.
47+
3948
## Logs
4049

41-
Currently, you can get the Takipi agent logs using `cf files` command:
50+
Currently, you can view the Takipi agent logs using the `cf ssh` command:
4251
```
43-
cf files app_name app/.java-buildpack/takipi_agent/log/
52+
cf ssh app_name
53+
cat ~/app/.java-buildpack/takipi_agent/log/agents/*.log
4454
```
4555

4656
## Troubleshooting

lib/java_buildpack/framework/takipi_agent.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class TakipiAgent < JavaBuildpack::Component::VersionedDependencyComponent
3131
def compile
3232
download_tar
3333
@droplet.copy_resources
34+
FileUtils.mkdir_p @droplet.sandbox + 'log/agents/'
3435
end
3536

3637
# (see JavaBuildpack::Component::BaseComponent#release)
@@ -39,6 +40,8 @@ def release
3940
.add_agentpath(agent)
4041
.add_system_property('takipi.name', application_name)
4142

43+
update_java9
44+
4245
@droplet.environment_variables
4346
.add_environment_variable('LD_LIBRARY_PATH',
4447
"$LD_LIBRARY_PATH:#{qualify_path(lib, @droplet.root)}")
@@ -99,6 +102,14 @@ def node_name
99102
"#{@configuration['node_name_prefix']}-$CF_INSTANCE_INDEX"
100103
end
101104

105+
def update_java9
106+
return unless @droplet.java_home.java_9_or_later?
107+
108+
@droplet.java_opts
109+
.add_preformatted_options('-Xshare:off')
110+
.add_preformatted_options('-XX:-UseTypeSpeculation')
111+
end
112+
102113
end
103114

104115
end

0 commit comments

Comments
 (0)