Skip to content

Commit 6f8c2a5

Browse files
committed
Use gRPC header data instead of a dedicated field
Signed-off-by: Antoine Toulme <[email protected]>
1 parent 34aad13 commit 6f8c2a5

File tree

12 files changed

+225
-240
lines changed

12 files changed

+225
-240
lines changed

fabric-chaincode-protos/src/main/java/org/hyperledger/fabric/protos/common/Common.java

Lines changed: 36 additions & 174 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fabric-chaincode-protos/src/main/protos/common/common.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ message MetadataSignature {
6868
message Header {
6969
bytes channel_header = 1;
7070
bytes signature_header = 2;
71-
string b3_header = 3;
7271
}
7372

7473
// Header is a generic replay prevention and identity message to include in a signed payload

fabric-chaincode-shim/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ dependencies {
5656
compile 'io.grpc:grpc-netty-shaded:1.34.1'
5757
compile 'io.grpc:grpc-protobuf:1.34.1'
5858
compile 'io.grpc:grpc-stub:1.34.1'
59-
compile platform("io.opentelemetry:opentelemetry-bom:0.13.1")
59+
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.0'
60+
61+
62+
compile platform("io.opentelemetry:opentelemetry-bom:0.14.1")
6063

6164
compile "io.opentelemetry:opentelemetry-api"
6265
compile "io.opentelemetry:opentelemetry-proto"
6366
compile "io.opentelemetry:opentelemetry-sdk"
6467
compile "io.opentelemetry:opentelemetry-sdk-trace"
6568
compile 'io.opentelemetry:opentelemetry-exporter-otlp'
66-
compile 'io.opentelemetry:opentelemetry-exporter-otlp-metrics:0.13.1-alpha'
69+
compile 'io.opentelemetry:opentelemetry-exporter-otlp-metrics:0.14.1-alpha'
6770
compile 'io.opentelemetry:opentelemetry-extension-trace-propagators'
71+
compile "io.opentelemetry.instrumentation:opentelemetry-grpc-1.5:0.14.0"
6872
}
6973

7074
dependencyCheck {

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeStub.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ public interface ChaincodeStub {
7979
*/
8080
String getTxId();
8181

82-
/**
83-
* Return the combined B3 header of the caller for this particular contract invocation.
84-
* <p>
85-
* This allows correlation of the caller to this contract invocation.
86-
*
87-
* @return the remote trace ID, or null.
88-
*/
89-
String getB3Header();
90-
9182
/**
9283
* Returns the channel id for the current proposal.
9384
* <p>

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/ChaincodeSupportClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.function.Consumer;
1212
import java.util.logging.Logger;
1313

14+
import io.grpc.ClientInterceptor;
1415
import org.hyperledger.fabric.Logging;
1516
import org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage;
1617
import org.hyperledger.fabric.protos.peer.ChaincodeSupportGrpc;
@@ -19,6 +20,7 @@
1920
import io.grpc.ManagedChannel;
2021
import io.grpc.ManagedChannelBuilder;
2122
import io.grpc.stub.StreamObserver;
23+
import org.hyperledger.fabric.traces.Traces;
2224

2325
public class ChaincodeSupportClient {
2426
private static final int DEFAULT_TIMEOUT = 5;
@@ -31,6 +33,10 @@ public class ChaincodeSupportClient {
3133
* @param channelBuilder
3234
*/
3335
public ChaincodeSupportClient(final ManagedChannelBuilder<?> channelBuilder) {
36+
ClientInterceptor interceptor = Traces.getProvider().createInterceptor();
37+
if (interceptor != null) {
38+
channelBuilder.intercept(interceptor);
39+
}
3440
this.channel = channelBuilder.build();
3541
this.stub = ChaincodeSupportGrpc.newStub(channel);
3642
}

0 commit comments

Comments
 (0)