Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ interface ISpan extends AutoCloseable {
String traceId();

String spanId();

void addAttribute(String key, String value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public DeepAgent(final Settings settings,
this.grpcService = new GrpcService(settings);
this.pollService = new LongPollService(settings, this.grpcService);
this.tracepointConfig = new TracepointConfigService(tracepointInstrumentationService);
final PushService pushService = new PushService(settings, grpcService);
final PushService pushService = new PushService(grpcService);

Callback.init(settings, tracepointConfig, pushService);
}
Expand Down
28 changes: 2 additions & 26 deletions agent/src/main/java/com/intergral/deep/agent/push/PushService.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@

package com.intergral.deep.agent.push;

import com.intergral.deep.agent.api.plugin.ISnapshotContext;
import com.intergral.deep.agent.api.plugin.ISnapshotDecorator;
import com.intergral.deep.agent.api.resource.Resource;
import com.intergral.deep.agent.grpc.GrpcService;
import com.intergral.deep.agent.settings.Settings;
import com.intergral.deep.agent.types.snapshot.EventSnapshot;
import com.intergral.deep.proto.tracepoint.v1.Snapshot;
import com.intergral.deep.proto.tracepoint.v1.SnapshotResponse;
import io.grpc.stub.StreamObserver;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -36,42 +31,23 @@
public class PushService {

private static final Logger LOGGER = LoggerFactory.getLogger(PushService.class);
private final Settings settings;
private final GrpcService grpcService;


public PushService(final Settings settings, final GrpcService grpcService) {
this.settings = settings;
public PushService(final GrpcService grpcService) {
this.grpcService = grpcService;
}

/**
* Decorate and push the provided snapshot.
*
* @param snapshot the snapshot to push
* @param context the context of where the snapshot is collected
*/
public void pushSnapshot(final EventSnapshot snapshot, final ISnapshotContext context) {
decorate(snapshot, context);
public void pushSnapshot(final EventSnapshot snapshot) {
final Snapshot grpcSnapshot = PushUtils.convertToGrpc(snapshot);
this.grpcService.snapshotService().send(grpcSnapshot, new LoggingObserver(snapshot.getID()));
}

private void decorate(final EventSnapshot snapshot, final ISnapshotContext context) {
final Collection<ISnapshotDecorator> plugins = this.settings.getPlugins(ISnapshotDecorator.class);
for (ISnapshotDecorator plugin : plugins) {
try {
final Resource decorate = plugin.decorate(this.settings, context);
if (decorate != null) {
snapshot.mergeAttributes(decorate);
}
} catch (Throwable t) {
LOGGER.error("Error processing plugin {}", plugin.getClass().getName());
}
}
snapshot.close();
}

static class LoggingObserver implements StreamObserver<SnapshotResponse> {

private final String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.intergral.deep.agent.api.resource.Resource;
import com.intergral.deep.agent.api.settings.ISettings;
import com.intergral.deep.agent.api.spi.IDeepPlugin;
import com.intergral.deep.agent.types.TracePointConfig.EStage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand Down Expand Up @@ -182,6 +183,8 @@ public static <T> T coerc(final String str, final Class<T> type) {
return (T) Level.parse(str);
} else if (type == Pattern.class) {
return (T) Pattern.compile(str);
} else if (type == EStage.class) {
return (T) EStage.fromArg(str);
} else if (type == URL.class) {
try {
return (T) new URL(str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TracepointConfigService implements ITracepointConfig {
private final TracepointInstrumentationService tracepointInstrumentationService;
private String currentHash = null;
private final Collection<TracePointConfig> customTracepoints = new ArrayList<>();
private Collection<TracePointConfig> installedTracepoints = new ArrayList<>();
protected Collection<TracePointConfig> installedTracepoints = new ArrayList<>();
@SuppressWarnings("unused")
private long lastUpdate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public CFFrameProcessor(final Settings settings,
final IEvaluator evaluator,
final Map<String, Object> variables,
final Collection<TracePointConfig> tracePointConfigs,
final long[] lineStart, final StackTraceElement[] stack) {
super(settings, evaluator, variables, tracePointConfigs, lineStart, stack);
final long[] lineStart, final StackTraceElement[] stack,
final String methodName) {
super(settings, evaluator, variables, tracePointConfigs, lineStart, stack, methodName);
}

@Override
Expand Down
Loading