Skip to content

Commit

Permalink
Convert elasticsearch tests to java (#12300)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Sep 24, 2024
1 parent 6d94506 commit e4752ab
Show file tree
Hide file tree
Showing 44 changed files with 2,575 additions and 2,906 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.v5_0;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticTransportRequest;
Expand All @@ -14,6 +15,11 @@
public class Elasticsearch5TransportExperimentalAttributesExtractor
extends ElasticsearchTransportExperimentalAttributesExtractor {

private static final AttributeKey<String> ELASTICSEARCH_REQUEST_WRITE_TYPE =
AttributeKey.stringKey("elasticsearch.request.write.type");
private static final AttributeKey<String> ELASTICSEARCH_REQUEST_WRITE_ROUTING =
AttributeKey.stringKey("elasticsearch.request.write.routing");

@Override
public void onStart(
AttributesBuilder attributes,
Expand All @@ -24,8 +30,8 @@ public void onStart(
Object request = transportRequest.getRequest();
if (request instanceof DocumentRequest) {
DocumentRequest<?> req = (DocumentRequest<?>) request;
attributes.put("elasticsearch.request.write.type", req.type());
attributes.put("elasticsearch.request.write.routing", req.routing());
attributes.put(ELASTICSEARCH_REQUEST_WRITE_TYPE, req.type());
attributes.put(ELASTICSEARCH_REQUEST_WRITE_ROUTING, req.routing());
}
}
}

This file was deleted.

Loading

0 comments on commit e4752ab

Please sign in to comment.