Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.opencensus.exporter.trace.jaeger;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;
import io.jaegertracing.internal.exceptions.SenderException;
import io.jaegertracing.thrift.internal.senders.ThriftSender;
import io.jaegertracing.thriftjava.Log;
import io.jaegertracing.thriftjava.Process;
import io.jaegertracing.thriftjava.Span;
import io.jaegertracing.thriftjava.SpanRef;
import io.jaegertracing.thriftjava.SpanRefType;
import io.jaegertracing.thriftjava.Tag;
import io.jaegertracing.thriftjava.TagType;
import io.opencensus.common.Duration;
import io.opencensus.common.Function;
import io.opencensus.common.Timestamp;
import io.opencensus.exporter.trace.util.TimeLimitedHandler;
import io.opencensus.trace.Annotation;
import io.opencensus.trace.AttributeValue;
import io.opencensus.trace.Link;
import io.opencensus.trace.MessageEvent;
import io.opencensus.trace.MessageEvent.Type;
import io.opencensus.trace.SpanContext;
import io.opencensus.trace.SpanId;
import io.opencensus.trace.Status;
import io.opencensus.trace.TraceId;
import io.opencensus.trace.TraceOptions;
import io.opencensus.trace.export.SpanData;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
@NotThreadSafe
final class JaegerExporterHandler extends TimeLimitedHandler {
private static final String EXPORT_SPAN_NAME = "ExportJaegerTraces";
@VisibleForTesting static final String SPAN_KIND = "span.kind";
private static final Tag SERVER_KIND_TAG = new Tag(SPAN_KIND, TagType.STRING).setVStr("server");
private static final Tag CLIENT_KIND_TAG = new Tag(SPAN_KIND, TagType.STRING).setVStr("client");
private static final String DESCRIPTION = "message";
private static final Tag RECEIVED_MESSAGE_EVENT_TAG =
new Tag(DESCRIPTION, TagType.STRING).setVStr("received message");
private static final Tag SENT_MESSAGE_EVENT_TAG =
new Tag(DESCRIPTION, TagType.STRING).setVStr("sent message");
private static final String MESSAGE_EVENT_ID = "id";
private static final String MESSAGE_EVENT_COMPRESSED_SIZE = "compressed_size";
private static final String MESSAGE_EVENT_UNCOMPRESSED_SIZE = "uncompressed_size";
@VisibleForTesting static final String STATUS_CODE = "status.code";
@VisibleForTesting static final String STATUS_MESSAGE = "status.message";
private static final Function super String, Tag> stringAttributeConverter =
new Function() {
@Override
public Tag apply(final String value) {
final Tag tag = new Tag();
tag.setVType(TagType.STRING);
tag.setVStr(value);
return tag;
}
};
private static final Function super Boolean, Tag> booleanAttributeConverter =
new Function() {
@Override
public Tag apply(final Boolean value) {
final Tag tag = new Tag();
tag.setVType(TagType.BOOL);
tag.setVBool(value);
return tag;
}
};
private static final Function super Double, Tag> doubleAttributeConverter =
new Function() {
@Override
public Tag apply(final Double value) {
final Tag tag = new Tag();
tag.setVType(TagType.DOUBLE);
tag.setVDouble(value);
return tag;
}
};
private static final Function super Long, Tag> longAttributeConverter =
new Function() {
@Override
public Tag apply(final Long value) {
final Tag tag = new Tag();
tag.setVType(TagType.LONG);
tag.setVLong(value);
return tag;
}
};
private static final Function