use of com.navercorp.pinpoint.plugin.elasticsearch.accessor.ClusterInfoAccessor in project pinpoint by naver.
the class ElasticsearchExecutorInterceptor method recordeESattributes.
// TODO max dsl limit need
private void recordeESattributes(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (recordESVersion) {
if (target instanceof ClusterInfoAccessor) {
// record elasticsearch version and cluster name.
recorder.recordAttribute(ElasticsearchConstants.ARGS_VERSION_ANNOTATION_KEY, ((ClusterInfoAccessor) target)._$PINPOINT$_getClusterInfo());
}
}
if (recordDsl) {
if (args[0] instanceof SearchRequest) {
SearchRequest request = (SearchRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(request.source().toString(), 256));
} else if (args[0] instanceof GetRequest) {
// GetRequest request = (GetRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof IndexRequest) {
// IndexRequest request = (IndexRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof DeleteRequest) {
// DeleteRequest request = (DeleteRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof UpdateRequest) {
// UpdateRequest request = (UpdateRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
}
}
}
Aggregations