formatting
This commit is contained in:
parent
b652c25242
commit
f20ed93741
|
@ -5,16 +5,15 @@ import com.mongodb.MongoClientOptions;
|
||||||
import com.mongodb.event.CommandStartedEvent;
|
import com.mongodb.event.CommandStartedEvent;
|
||||||
import io.opentracing.Span;
|
import io.opentracing.Span;
|
||||||
import io.opentracing.contrib.mongo.TracingCommandListener;
|
import io.opentracing.contrib.mongo.TracingCommandListener;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.bson.BsonDocument;
|
import org.bson.BsonDocument;
|
||||||
import org.bson.BsonString;
|
import org.bson.BsonString;
|
||||||
import org.bson.BsonValue;
|
import org.bson.BsonValue;
|
||||||
import org.jboss.byteman.rule.Rule;
|
import org.jboss.byteman.rule.Rule;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/** Patch the Mongo builder before constructing the final client */
|
/** Patch the Mongo builder before constructing the final client */
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MongoHelper extends DDAgentTracingHelper<MongoClientOptions.Builder> {
|
public class MongoHelper extends DDAgentTracingHelper<MongoClientOptions.Builder> {
|
||||||
|
|
|
@ -4,13 +4,12 @@ import com.datadoghq.trace.util.Clock;
|
||||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.opentracing.BaseSpan;
|
import io.opentracing.BaseSpan;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class DDBaseSpan<S extends BaseSpan> implements BaseSpan<S> {
|
public abstract class DDBaseSpan<S extends BaseSpan> implements BaseSpan<S> {
|
||||||
|
|
|
@ -12,37 +12,33 @@ public class DBStatementAsResourceName extends DDSpanContextDecorator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//{ "insert" : "calls", "ordered" : true, "documents" : [{ "_id" : { "$oid" : "5979bbb0ed6fed5749cc9e7c" }, "name" : "MongoDB", "type" : "database", "identifier" : "10", "versions" : ["v3.2", "v3.0", "v2.6"], "info" : { "x" : 203, "y" : 102 } }] }
|
//{ "insert" : "calls", "ordered" : true, "documents" : [{ "_id" : { "$oid" : "5979bbb0ed6fed5749cc9e7c" }, "name" : "MongoDB", "type" : "database", "identifier" : "10", "versions" : ["v3.2", "v3.0", "v2.6"], "info" : { "x" : 203, "y" : 102 } }] }
|
||||||
private void normalizeFilter(final Object f) {
|
private void normalizeFilter(final Object f) {}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
def normalize_filter(f=None):
|
def normalize_filter(f=None):
|
||||||
if f is None:
|
if f is None:
|
||||||
return {}
|
return {}
|
||||||
elif isinstance(f, list):
|
elif isinstance(f, list):
|
||||||
# normalize lists of filters
|
# normalize lists of filters
|
||||||
# e.g. {$or: [ { age: { $lt: 30 } }, { type: 1 } ]}
|
# e.g. {$or: [ { age: { $lt: 30 } }, { type: 1 } ]}
|
||||||
return [normalize_filter(s) for s in f]
|
return [normalize_filter(s) for s in f]
|
||||||
elif isinstance(f, dict):
|
elif isinstance(f, dict):
|
||||||
# normalize dicts of filters
|
# normalize dicts of filters
|
||||||
# {$or: [ { age: { $lt: 30 } }, { type: 1 } ]})
|
# {$or: [ { age: { $lt: 30 } }, { type: 1 } ]})
|
||||||
out = {}
|
out = {}
|
||||||
for k, v in iteritems(f):
|
for k, v in iteritems(f):
|
||||||
if k == "$in" or k == "$nin":
|
if k == "$in" or k == "$nin":
|
||||||
# special case $in queries so we don't loop over lists.
|
# special case $in queries so we don't loop over lists.
|
||||||
out[k] = "?"
|
out[k] = "?"
|
||||||
elif isinstance(v, list) or isinstance(v, dict):
|
elif isinstance(v, list) or isinstance(v, dict):
|
||||||
# RECURSION ALERT: needs to move to the agent
|
# RECURSION ALERT: needs to move to the agent
|
||||||
out[k] = normalize_filter(v)
|
out[k] = normalize_filter(v)
|
||||||
else:
|
else:
|
||||||
# NOTE: this shouldn't happen, but let's have a safeguard.
|
# NOTE: this shouldn't happen, but let's have a safeguard.
|
||||||
out[k] = '?'
|
out[k] = '?'
|
||||||
return out
|
return out
|
||||||
else:
|
else:
|
||||||
# FIXME[matt] unexpected type. not sure this should ever happen, but at
|
# FIXME[matt] unexpected type. not sure this should ever happen, but at
|
||||||
# least it won't crash.
|
# least it won't crash.
|
||||||
return {}*/
|
return {}*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue