|
17 | 17 |
|
18 | 18 | package com.intergral.deep.agent;
|
19 | 19 |
|
| 20 | +import com.intergral.deep.agent.api.DeepVersion; |
| 21 | +import com.intergral.deep.agent.api.IDeep; |
20 | 22 | import com.intergral.deep.agent.api.plugin.IPlugin;
|
| 23 | +import com.intergral.deep.agent.api.plugin.IPlugin.IPluginRegistration; |
21 | 24 | import com.intergral.deep.agent.api.resource.Resource;
|
| 25 | +import com.intergral.deep.agent.api.tracepoint.ITracepoint.ITracepointRegistration; |
22 | 26 | import com.intergral.deep.agent.grpc.GrpcService;
|
23 | 27 | import com.intergral.deep.agent.plugins.PluginLoader;
|
24 | 28 | import com.intergral.deep.agent.poll.LongPollService;
|
|
28 | 32 | import com.intergral.deep.agent.tracepoint.TracepointConfigService;
|
29 | 33 | import com.intergral.deep.agent.tracepoint.handler.Callback;
|
30 | 34 | import com.intergral.deep.agent.tracepoint.inst.TracepointInstrumentationService;
|
| 35 | +import com.intergral.deep.agent.types.TracePointConfig; |
| 36 | +import java.util.Collection; |
| 37 | +import java.util.Collections; |
31 | 38 | import java.util.List;
|
| 39 | +import java.util.Map; |
32 | 40 |
|
33 |
| -public class DeepAgent { |
| 41 | +public class DeepAgent implements IDeep { |
34 | 42 |
|
35 | 43 | private final Settings settings;
|
36 | 44 | private final GrpcService grpcService;
|
@@ -58,4 +66,26 @@ public void start() {
|
58 | 66 | this.grpcService.start();
|
59 | 67 | this.pollService.start(tracepointConfig);
|
60 | 68 | }
|
| 69 | + |
| 70 | + @Override |
| 71 | + public String getVersion() { |
| 72 | + return DeepVersion.VERSION; |
| 73 | + } |
| 74 | + |
| 75 | + public IPluginRegistration registerPlugin(final IPlugin plugin) { |
| 76 | + this.settings.addPlugin(plugin); |
| 77 | + return () -> this.settings.removePlugin(plugin); |
| 78 | + } |
| 79 | + |
| 80 | + @Override |
| 81 | + public ITracepointRegistration registerTracepoint(final String path, final int line) { |
| 82 | + return registerTracepoint(path, line, Collections.emptyMap(), Collections.emptyList()); |
| 83 | + } |
| 84 | + |
| 85 | + @Override |
| 86 | + public ITracepointRegistration registerTracepoint(final String path, final int line, final Map<String, String> args, |
| 87 | + final Collection<String> watches) { |
| 88 | + final TracePointConfig tracePointConfig = this.tracepointConfig.addCustom(path, line, args, watches); |
| 89 | + return () -> this.tracepointConfig.removeCustom(tracePointConfig); |
| 90 | + } |
61 | 91 | }
|
0 commit comments