Java Code Examples for io.opencensus.trace.Span#addMessageEvent()
The following examples show how to use
io.opencensus.trace.Span#addMessageEvent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CensusTracingModule.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
private static void recordMessageEvent( Span span, MessageEvent.Type type, int seqNo, long optionalWireSize, long optionalUncompressedSize) { MessageEvent.Builder eventBuilder = MessageEvent.builder(type, seqNo); if (optionalUncompressedSize != -1) { eventBuilder.setUncompressedMessageSize(optionalUncompressedSize); } if (optionalWireSize != -1) { eventBuilder.setCompressedMessageSize(optionalWireSize); } span.addMessageEvent(eventBuilder.build()); }
Example 2
Source File: SpanOperationsBenchmark.java From opencensus-java with Apache License 2.0 | 5 votes |
/** Add message events. */ @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public Span addMessageEvent(Data data) { Span span = data.messageEventSpan; for (int i = 0; i < data.size; i++) { span.addMessageEvent(data.messageEvents[i]); } return span; }
Example 3
Source File: OpenCensusUtils.java From google-http-java-client with Apache License 2.0 | 5 votes |
/** * Records a message event of a certain {@link MessageEvent.Type}. This method is package * protected since {@link MessageEvent} might be deprecated in future releases. * * @param span The {@code span} in which the event occurs. * @param size Size of the message. * @param eventType The {@code NetworkEvent.Type} of the message event. */ @VisibleForTesting static void recordMessageEvent(Span span, long size, Type eventType) { Preconditions.checkArgument(span != null, "span should not be null."); if (size < 0) { size = 0; } MessageEvent event = MessageEvent.builder(eventType, idGenerator.getAndIncrement()) .setUncompressedMessageSize(size) .build(); span.addMessageEvent(event); }
Example 4
Source File: CensusTracingModule.java From grpc-java with Apache License 2.0 | 5 votes |
private static void recordMessageEvent( Span span, MessageEvent.Type type, int seqNo, long optionalWireSize, long optionalUncompressedSize) { MessageEvent.Builder eventBuilder = MessageEvent.builder(type, seqNo); if (optionalUncompressedSize != -1) { eventBuilder.setUncompressedMessageSize(optionalUncompressedSize); } if (optionalWireSize != -1) { eventBuilder.setCompressedMessageSize(optionalWireSize); } span.addMessageEvent(eventBuilder.build()); }
Example 5
Source File: AbstractHttpHandler.java From opencensus-java with Apache License 2.0 | 3 votes |
/** * A convenience to record a {@link MessageEvent} with given parameters. * * @param span the span which this {@code MessageEvent} will be added to. * @param id the id of the event. * @param type the {@code MessageEvent.Type} of the event. * @param uncompressedMessageSize size of the message before compressed (optional). * @param compressedMessageSize size of the message after compressed (optional). * @since 0.19 */ static void recordMessageEvent( Span span, long id, Type type, long uncompressedMessageSize, long compressedMessageSize) { MessageEvent messageEvent = MessageEvent.builder(type, id) .setUncompressedMessageSize(uncompressedMessageSize) .setCompressedMessageSize(compressedMessageSize) .build(); span.addMessageEvent(messageEvent); }