formatting
This commit is contained in:
parent
b652c25242
commit
f20ed93741
|
@ -5,16 +5,15 @@ import com.mongodb.MongoClientOptions;
|
|||
import com.mongodb.event.CommandStartedEvent;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.contrib.mongo.TracingCommandListener;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.BsonDocument;
|
||||
import org.bson.BsonString;
|
||||
import org.bson.BsonValue;
|
||||
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 */
|
||||
@Slf4j
|
||||
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.JsonIgnore;
|
||||
import io.opentracing.BaseSpan;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
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 } }] }
|
||||
private void normalizeFilter(final Object f) {
|
||||
|
||||
|
||||
}
|
||||
private void normalizeFilter(final Object f) {}
|
||||
}
|
||||
|
||||
/*
|
||||
def normalize_filter(f=None):
|
||||
if f is None:
|
||||
return {}
|
||||
elif isinstance(f, list):
|
||||
# normalize lists of filters
|
||||
# e.g. {$or: [ { age: { $lt: 30 } }, { type: 1 } ]}
|
||||
return [normalize_filter(s) for s in f]
|
||||
elif isinstance(f, dict):
|
||||
# normalize dicts of filters
|
||||
# {$or: [ { age: { $lt: 30 } }, { type: 1 } ]})
|
||||
out = {}
|
||||
for k, v in iteritems(f):
|
||||
if k == "$in" or k == "$nin":
|
||||
# special case $in queries so we don't loop over lists.
|
||||
out[k] = "?"
|
||||
elif isinstance(v, list) or isinstance(v, dict):
|
||||
# RECURSION ALERT: needs to move to the agent
|
||||
out[k] = normalize_filter(v)
|
||||
else:
|
||||
# NOTE: this shouldn't happen, but let's have a safeguard.
|
||||
out[k] = '?'
|
||||
return out
|
||||
else:
|
||||
# FIXME[matt] unexpected type. not sure this should ever happen, but at
|
||||
# least it won't crash.
|
||||
return {}*/
|
||||
|
||||
def normalize_filter(f=None):
|
||||
if f is None:
|
||||
return {}
|
||||
elif isinstance(f, list):
|
||||
# normalize lists of filters
|
||||
# e.g. {$or: [ { age: { $lt: 30 } }, { type: 1 } ]}
|
||||
return [normalize_filter(s) for s in f]
|
||||
elif isinstance(f, dict):
|
||||
# normalize dicts of filters
|
||||
# {$or: [ { age: { $lt: 30 } }, { type: 1 } ]})
|
||||
out = {}
|
||||
for k, v in iteritems(f):
|
||||
if k == "$in" or k == "$nin":
|
||||
# special case $in queries so we don't loop over lists.
|
||||
out[k] = "?"
|
||||
elif isinstance(v, list) or isinstance(v, dict):
|
||||
# RECURSION ALERT: needs to move to the agent
|
||||
out[k] = normalize_filter(v)
|
||||
else:
|
||||
# NOTE: this shouldn't happen, but let's have a safeguard.
|
||||
out[k] = '?'
|
||||
return out
|
||||
else:
|
||||
# FIXME[matt] unexpected type. not sure this should ever happen, but at
|
||||
# least it won't crash.
|
||||
return {}*/
|
||||
|
|
Loading…
Reference in New Issue