code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private static ViewData createInternal(
View view,
Map<List</*@Nullable*/ TagValue>, AggregationData> aggregationMap,
AggregationWindowData window,
Timestamp start,
Timestamp end) {
@SuppressWarnings("nullness")
Map<List<TagValue>, AggregationData> map = aggregationMap;
return ... | java |
static Endpoint produceLocalEndpoint(String serviceName) {
Endpoint.Builder builder = Endpoint.newBuilder().serviceName(serviceName);
try {
Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
if (nics == null) {
return builder.build();
}
while (nics.hasM... | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public AttributeValue[] createAttributeValues(Data data) {
return getAttributeValues(data.size, data.attributeType);
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Map<String, AttributeValue> createAttributeMap(Data data) {
Map<String, AttributeValue> attributeMap = new HashMap<>(data.size);
for (int i = 0; i < data.size; i++) {
attributeMap.put(data.attributeKeys[i], data... | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Annotation createAnnotation(Data data) {
return Annotation.fromDescriptionAndAttributes(ANNOTATION_DESCRIPTION, data.attributeMap);
} | java |
static MetricFamilySamples createMetricFamilySamples(Metric metric, String namespace) {
MetricDescriptor metricDescriptor = metric.getMetricDescriptor();
String name = getNamespacedName(metricDescriptor.getName(), namespace);
Type type = getType(metricDescriptor.getType());
List<String> labelNames = con... | java |
static MetricFamilySamples createDescribableMetricFamilySamples(
MetricDescriptor metricDescriptor, String namespace) {
String name = getNamespacedName(metricDescriptor.getName(), namespace);
Type type = getType(metricDescriptor.getType());
List<String> labelNames = convertToLabelNames(metricDescripto... | java |
@VisibleForTesting
static List<String> convertToLabelNames(List<LabelKey> labelKeys) {
final List<String> labelNames = new ArrayList<String>(labelKeys.size());
for (LabelKey labelKey : labelKeys) {
labelNames.add(Collector.sanitizeMetricName(labelKey.getKey()));
}
return labelNames;
} | java |
static TraceConfig getCurrentTraceConfig(io.opencensus.trace.config.TraceConfig traceConfig) {
TraceParams traceParams = traceConfig.getActiveTraceParams();
return toTraceConfigProto(traceParams);
} | java |
static TraceParams getUpdatedTraceParams(
UpdatedLibraryConfig config, io.opencensus.trace.config.TraceConfig traceConfig) {
TraceParams currentParams = traceConfig.getActiveTraceParams();
TraceConfig traceConfigProto = config.getConfig();
return fromTraceConfigProto(traceConfigProto, currentParams);
... | java |
@SuppressWarnings("nullness")
public static void createAndRegister(
ElasticsearchTraceConfiguration elasticsearchTraceConfiguration)
throws MalformedURLException {
synchronized (monitor) {
Preconditions.checkState(handler == null, "Elasticsearch exporter already registered.");
Precondition... | java |
public boolean isEnabled(String featurePath) {
checkArgument(!Strings.isNullOrEmpty(featurePath));
return config.getConfig(featurePath).getBoolean("enabled");
} | java |
synchronized void sendInitialMessage(Node node) {
io.opencensus.proto.trace.v1.TraceConfig currentTraceConfigProto =
TraceProtoUtils.getCurrentTraceConfig(traceConfig);
// First config must have Node set.
CurrentLibraryConfig firstConfig =
CurrentLibraryConfig.newBuilder().setNode(node).setC... | java |
private synchronized void sendCurrentConfig() {
// Bouncing back CurrentLibraryConfig to Agent.
io.opencensus.proto.trace.v1.TraceConfig currentTraceConfigProto =
TraceProtoUtils.getCurrentTraceConfig(traceConfig);
CurrentLibraryConfig currentLibraryConfig =
CurrentLibraryConfig.newBuilder()... | java |
private synchronized void sendCurrentConfig(CurrentLibraryConfig currentLibraryConfig) {
if (isCompleted() || currentConfigObserver == null) {
return;
}
try {
currentConfigObserver.onNext(currentLibraryConfig);
} catch (Exception e) { // Catch client side exceptions.
onComplete(e);
... | java |
public static void main(String[] args) throws IOException, InterruptedException {
// Register the view. It is imperative that this step exists,
// otherwise recorded metrics will be dropped and never exported.
View view =
View.create(
Name.create("task_latency_distribution"),
... | java |
synchronized void onExport(ExportTraceServiceRequest request) {
if (isCompleted() || exportRequestObserver == null) {
return;
}
try {
exportRequestObserver.onNext(request);
} catch (Exception e) { // Catch client side exceptions.
onComplete(e);
}
} | java |
public static Duration create(long seconds, int nanos) {
if (seconds < -MAX_SECONDS) {
throw new IllegalArgumentException(
"'seconds' is less than minimum (" + -MAX_SECONDS + "): " + seconds);
}
if (seconds > MAX_SECONDS) {
throw new IllegalArgumentException(
"'seconds' is gr... | java |
static Node getNodeInfo(String serviceName) {
String jvmName = ManagementFactory.getRuntimeMXBean().getName();
Timestamp censusTimestamp = Timestamp.fromMillis(System.currentTimeMillis());
return Node.newBuilder()
.setIdentifier(getProcessIdentifier(jvmName, censusTimestamp))
.setLibraryInfo... | java |
@VisibleForTesting
static LibraryInfo getLibraryInfo(String currentOcJavaVersion) {
return LibraryInfo.newBuilder()
.setLanguage(Language.JAVA)
.setCoreLibraryVersion(currentOcJavaVersion)
.setExporterVersion(OC_AGENT_EXPORTER_VERSION)
.build();
} | java |
@VisibleForTesting
static ServiceInfo getServiceInfo(String serviceName) {
return ServiceInfo.newBuilder().setName(serviceName).build();
} | java |
public HttpRequestContext handleStart(C carrier, Q request) {
checkNotNull(carrier, "carrier");
checkNotNull(request, "request");
SpanBuilder spanBuilder = null;
String spanName = getSpanName(request, extractor);
// de-serialize the context
SpanContext spanContext = null;
try {
spanCon... | java |
private Map<String, StatsSnapshot> getStatsSnapshots(boolean isReceived) {
SortedMap<String, StatsSnapshot> map = Maps.newTreeMap(); // Sorted by method name.
if (isReceived) {
getStatsSnapshots(map, SERVER_RPC_CUMULATIVE_VIEWS);
getStatsSnapshots(map, SERVER_RPC_MINUTE_VIEWS);
getStatsSnapsho... | java |
private static double getDurationInSecs(
ViewData.AggregationWindowData.CumulativeData cumulativeData) {
return toDoubleSeconds(cumulativeData.getEnd().subtractTimestamp(cumulativeData.getStart()));
} | java |
public static void main(String[] args) throws InterruptedException {
TagContextBuilder tagContextBuilder =
tagger.currentBuilder().put(FRONTEND_KEY, TagValue.create("mobile-ios9.3.5"));
SpanBuilder spanBuilder =
tracer
.spanBuilder("my.org/ProcessVideo")
.setRecordEvents(... | java |
@VisibleForTesting
public static TagKey[] createTagKeys(int size, String name) {
TagKey[] keys = new TagKey[size];
for (int i = 0; i < size; i++) {
keys[i] = TagKey.create(name + i);
}
return keys;
} | java |
@VisibleForTesting
public static TagValue[] createTagValues(int size, String name) {
TagValue[] values = new TagValue[size];
for (int i = 0; i < size; i++) {
values[i] = TagValue.create(name + i);
}
return values;
} | java |
@VisibleForTesting
public static TagContext createTagContext(TagContextBuilder tagsBuilder, int numTags) {
for (int i = 0; i < numTags; i++) {
tagsBuilder.put(TAG_KEYS.get(i), TAG_VALUES.get(i), UNLIMITED_PROPAGATION);
}
return tagsBuilder.build();
} | java |
private static DisruptorEventQueue create() {
// Create new Disruptor for processing. Note that Disruptor creates a single thread per
// consumer (see https://github.com/LMAX-Exchange/disruptor/issues/121 for details);
// this ensures that the event handler can take unsynchronized actions whenever possible.... | java |
@Override
public void shutdown() {
enqueuer =
new DisruptorEnqueuer() {
final AtomicBoolean logged = new AtomicBoolean(false);
@Override
public void enqueue(Entry entry) {
if (!logged.getAndSet(true)) {
logger.log(Level.INFO, "Attempted to enqueue e... | java |
public final Span getCurrentSpan() {
Span currentSpan = CurrentSpanUtils.getCurrentSpan();
return currentSpan != null ? currentSpan : BlankSpan.INSTANCE;
} | java |
public static void unregister() {
synchronized (monitor) {
checkState(handler != null, "Zipkin exporter is not registered.");
unregister(Tracing.getExportComponent().getSpanExporter());
handler = null;
}
} | java |
@javax.annotation.Nullable
static Span getCurrentSpan() {
SpanContext currentSpanContext = CURRENT_SPAN.get();
return currentSpanContext != null ? currentSpanContext.span : null;
} | java |
static void setCurrentSpan(Span span) {
if (log.isTraceEnabled()) {
log.trace("Setting current span " + span);
}
push(span, /* autoClose= */ false);
} | java |
static void close(SpanFunction spanFunction) {
SpanContext current = CURRENT_SPAN.get();
while (current != null) {
spanFunction.apply(current.span);
current = removeCurrentSpanInternal(current.parent);
if (current == null || !current.autoClose) {
return;
}
}
} | java |
static void push(Span span, boolean autoClose) {
if (isCurrent(span)) {
return;
}
setSpanContextInternal(new SpanContext(span, autoClose));
} | java |
public static void main(String... args) {
// Step 1. Enable OpenCensus Metrics.
try {
setupOpenCensusAndPrometheusExporter();
} catch (IOException e) {
System.err.println("Failed to create and register OpenCensus Prometheus Stats exporter " + e);
return;
}
BufferedReader stdin = n... | java |
@javax.annotation.Nullable
public String get(String key) {
for (Entry entry : getEntries()) {
if (entry.getKey().equals(key)) {
return entry.getValue();
}
}
return null;
} | java |
private static boolean validateValue(String value) {
if (value.length() > VALUE_MAX_SIZE || value.charAt(value.length() - 1) == ' ' /* '\u0020' */) {
return false;
}
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
if (c == ',' || c == '=' || c < ' ' /* '\u0020' */ || c... | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public TagContext timeNestedTagContext(Data data) {
return TagsBenchmarksUtil.createTagContext(
data.tagger.toBuilder(data.baseTagContext), data.numTags);
} | java |
public static void createAndRegister(final String thriftEndpoint, final String serviceName) {
synchronized (monitor) {
checkState(handler == null, "Jaeger exporter is already registered.");
final SpanExporter.Handler newHandler = newHandler(thriftEndpoint, serviceName);
JaegerTraceExporter.handler... | java |
public static void createWithSender(final ThriftSender sender, final String serviceName) {
synchronized (monitor) {
checkState(handler == null, "Jaeger exporter is already registered.");
final SpanExporter.Handler newHandler = newHandlerWithSender(sender, serviceName);
JaegerTraceExporter.handler ... | java |
private static void performWork(Span parent) {
SpanBuilder spanBuilder =
tracer
.spanBuilderWithExplicitParent("internal_work", parent)
.setRecordEvents(true)
.setSampler(Samplers.alwaysSample());
try (Scope scope = spanBuilder.startScopedSpan()) {
Span span = t... | java |
@SuppressWarnings("deprecation")
private static void emitTraceParamsTable(TraceParams params, PrintWriter out) {
out.write(
"<b class=\"title\">Active tracing parameters:</b><br>\n"
+ "<table class=\"small\" rules=\"all\">\n"
+ " <tr>\n"
+ " <td class=\"col_headR\">... | java |
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span putAttribute(Data data) {
data.span.putAttribute(ATTRIBUTE_KEY, AttributeValue.stringAttributeValue(ATTRIBUTE_VALUE));
return data.span;
} | java |
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addAnnotation(Data data) {
data.span.addAnnotation(ANNOTATION_DESCRIPTION);
return data.span;
} | java |
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addMessageEvent(Data data) {
data.span.addMessageEvent(
io.opencensus.trace.MessageEvent.builder(Type.RECEIVED, 1)
.setUncompressedMessageSize(3)
.build());
return data.span;
} | java |
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addLink(Data data) {
data.span.addLink(
Link.fromSpanContext(data.linkedSpan.getContext(), Link.Type.PARENT_LINKED_SPAN));
return data.span;
} | java |
static OcAgentMetricsServiceExportRpcHandler create(MetricsServiceStub stub) {
OcAgentMetricsServiceExportRpcHandler exportRpcHandler =
new OcAgentMetricsServiceExportRpcHandler();
ExportResponseObserver exportResponseObserver = new ExportResponseObserver(exportRpcHandler);
try {
StreamObserve... | java |
public static Timestamp create(long seconds, int nanos) {
if (seconds < -MAX_SECONDS) {
throw new IllegalArgumentException(
"'seconds' is less than minimum (" + -MAX_SECONDS + "): " + seconds);
}
if (seconds > MAX_SECONDS) {
throw new IllegalArgumentException(
"'seconds' is g... | java |
public static Timestamp fromMillis(long epochMilli) {
long secs = floorDiv(epochMilli, MILLIS_PER_SECOND);
int mos = (int) floorMod(epochMilli, MILLIS_PER_SECOND);
return create(secs, (int) (mos * NANOS_PER_MILLI)); // Safe int * NANOS_PER_MILLI
} | java |
private Timestamp plus(long secondsToAdd, long nanosToAdd) {
if ((secondsToAdd | nanosToAdd) == 0) {
return this;
}
long epochSec = TimeUtils.checkedAdd(getSeconds(), secondsToAdd);
epochSec = TimeUtils.checkedAdd(epochSec, nanosToAdd / NANOS_PER_SECOND);
nanosToAdd = nanosToAdd % NANOS_PER_SE... | java |
private static long floorDiv(long x, long y) {
return BigDecimal.valueOf(x).divide(BigDecimal.valueOf(y), 0, RoundingMode.FLOOR).longValue();
} | java |
private static Map<String, String> initializeAwsIdentityDocument() {
InputStream stream = null;
try {
stream = openStream(AWS_INSTANCE_IDENTITY_DOCUMENT_URI);
String awsIdentityDocument = slurp(new InputStreamReader(stream, Charset.forName("UTF-8")));
return parseAwsIdentityDocument(awsIdentit... | java |
private static Set<View> filterExportedViews(Collection<View> allViews) {
Set<View> views = Sets.newHashSet();
for (View view : allViews) {
if (view.getWindow() instanceof View.AggregationWindow.Cumulative) {
views.add(view);
}
}
return Collections.unmodifiableSet(views);
} | java |
synchronized void record(TagContext tags, MeasureMapInternal stats, Timestamp timestamp) {
Iterator<Measurement> iterator = stats.iterator();
Map<String, AttachmentValue> attachments = stats.getAttachments();
while (iterator.hasNext()) {
Measurement measurement = iterator.next();
Measure measure... | java |
synchronized void clearStats() {
for (Entry<String, Collection<MutableViewData>> entry : mutableMap.asMap().entrySet()) {
for (MutableViewData mutableViewData : entry.getValue()) {
mutableViewData.clearStats();
}
}
} | java |
synchronized void resumeStatsCollection(Timestamp now) {
for (Entry<String, Collection<MutableViewData>> entry : mutableMap.asMap().entrySet()) {
for (MutableViewData mutableViewData : entry.getValue()) {
mutableViewData.resumeStatsCollection(now);
}
}
} | java |
@VisibleForTesting
static ProcessIdentifier getProcessIdentifier(String jvmName, Timestamp censusTimestamp) {
String hostname;
int pid;
// jvmName should be something like '<pid>@<hostname>', at least in Oracle and OpenJdk JVMs
int delimiterIndex = jvmName.indexOf('@');
if (delimiterIndex < 1) {
... | java |
public static void main(String[] args) throws InterruptedException {
configureAlwaysSample(); // Always sample for demo purpose. DO NOT use in production.
registerAllViews();
LongGauge gauge = registerGauge();
String endPoint = getStringOrDefaultFromArgs(args, 0, DEFAULT_ENDPOINT);
registerAgentExp... | java |
public State get() {
InternalState internalState = currentInternalState.get();
while (!internalState.isRead) {
// Slow path, the state is first time read. Change the state only if no other changes
// happened between the moment initialState is read and this moment. This ensures that this
// me... | java |
public boolean set(State state) {
while (true) {
InternalState internalState = currentInternalState.get();
checkState(!internalState.isRead, "State was already read, cannot set state.");
if (state == internalState.state) {
return false;
} else {
if (!currentInternalState.comp... | java |
private static int encodeTag(Tag tag, StringBuilder stringBuilder) {
String key = tag.getKey().getName();
String value = tag.getValue().asString();
int charsOfTag = key.length() + value.length();
// This should never happen with our current constraints (<= 255 chars) on tags.
checkArgument(
... | java |
private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) {
String keyWithValue;
int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER);
if (firstPropertyIndex != -1) { // Tag with properties.
keyWithValue = stringTag.substring(0, firstPropertyIndex);
... | java |
private static void emitSpans(PrintWriter out, Formatter formatter, Collection<SpanData> spans) {
out.write("<pre>\n");
formatter.format("%-23s %18s%n", "When", "Elapsed(s)");
out.write("-------------------------------------------\n");
for (SpanData span : spans) {
tracer
.getCurrentSpan... | java |
private void emitSummaryTable(PrintWriter out, Formatter formatter)
throws UnsupportedEncodingException {
if (runningSpanStore == null || sampledSpanStore == null) {
return;
}
RunningSpanStore.Summary runningSpanStoreSummary = runningSpanStore.getSummary();
SampledSpanStore.Summary sampledSp... | java |
public static int getVarInt(byte[] src, int offset, int[] dst) {
int result = 0;
int shift = 0;
int b;
do {
if (shift >= 32) {
// Out of range
throw new IndexOutOfBoundsException("varint too long");
}
// Get 7 bits from next byte
b = src[offset++];
result |=... | java |
public static int getVarInt(ByteBuffer src) {
int tmp;
if ((tmp = src.get()) >= 0) {
return tmp;
}
int result = tmp & 0x7f;
if ((tmp = src.get()) >= 0) {
result |= tmp << 7;
} else {
result |= (tmp & 0x7f) << 7;
if ((tmp = src.get()) >= 0) {
result |= tmp << 14;
... | java |
public static void putVarInt(int v, ByteBuffer sink) {
while (true) {
int bits = v & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | java |
public static int getVarInt(InputStream inputStream) throws IOException {
int result = 0;
int shift = 0;
int b;
do {
if (shift >= 32) {
// Out of range
throw new IndexOutOfBoundsException("varint too long");
}
// Get 7 bits from next byte
b = inputStream.read();
... | java |
public static void putVarInt(int v, OutputStream outputStream) throws IOException {
byte[] bytes = new byte[varIntSize(v)];
putVarInt(v, bytes, 0);
outputStream.write(bytes);
} | java |
public static long getVarLong(ByteBuffer src) {
long tmp;
if ((tmp = src.get()) >= 0) {
return tmp;
}
long result = tmp & 0x7f;
if ((tmp = src.get()) >= 0) {
result |= tmp << 7;
} else {
result |= (tmp & 0x7f) << 7;
if ((tmp = src.get()) >= 0) {
result |= tmp << 1... | java |
public static void putVarLong(long v, ByteBuffer sink) {
while (true) {
int bits = ((int) v) & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span createRootSpan(Data data) {
Span span =
data.tracer
.spanBuilderWithExplicitParent("RootSpan", null)
.setRecordEvents(data.recorded)
.setSampler(data.sampled ? Samplers.alw... | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Link createLink(Data data) {
return Link.fromSpanContext(
SpanContext.create(
TraceId.fromBytes(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0}),
SpanId.fromBytes(new byte... | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public MessageEvent createMessageEvent(Data data) {
return MessageEvent.builder(MessageEvent.Type.SENT, MESSAGE_ID).build();
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span getCurrentSpan(Data data) {
return data.tracer.getCurrentSpan();
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public byte[] encodeSpanBinary(Data data) {
return data.propagation.getBinaryFormat().toByteArray(data.spanToEncode.getContext());
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public SpanContext decodeSpanBinary(Data data) throws SpanContextParseException {
return data.propagation.getBinaryFormat().fromByteArray(data.spanToDecodeBinary);
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public String encodeSpanText(Data data) {
return encodeSpanContextText(
data.propagation.getTraceContextFormat(), data.spanToEncode.getContext());
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public SpanContext decodeSpanText(Data data) throws SpanContextParseException {
return data.propagation.getTraceContextFormat().extract(data.spanToDecodeText, textGetter);
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span setStatus(Data data) {
data.spanToSet.setStatus(STATUS_OK);
return data.spanToSet;
} | java |
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span endSpan(Data data) {
data.spanToEnd.end();
return data.spanToEnd;
} | java |
public static void createAndRegisterWithCredentialsAndProjectId(
Credentials credentials, String projectId) throws IOException {
StackdriverTraceExporter.createAndRegister(
StackdriverTraceConfiguration.builder()
.setCredentials(credentials)
.setProjectId(projectId)
... | java |
public static void createAndRegisterWithProjectId(String projectId) throws IOException {
StackdriverTraceExporter.createAndRegister(
StackdriverTraceConfiguration.builder()
.setCredentials(GoogleCredentials.getApplicationDefault())
.setProjectId(projectId)
.build());
} | java |
static List<DataPoint> adapt(Metric metric) {
MetricDescriptor metricDescriptor = metric.getMetricDescriptor();
MetricType metricType = getType(metricDescriptor.getType());
if (metricType == null) {
return Collections.emptyList();
}
DataPoint.Builder shared = DataPoint.newBuilder();
share... | java |
@SuppressWarnings("unused")
public void setSmtpAuth(String userName, String password) {
setSmtpUsername(userName);
setSmtpPassword(password);
} | java |
private Object readResolve() throws ObjectStreamException {
if (triggerScript != null && secureTriggerScript == null) {
this.secureTriggerScript = new SecureGroovyScript(triggerScript, false, null);
this.secureTriggerScript.configuring(ApprovalContext.create());
triggerSc... | java |
private String renderTemplate(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream templateStream)
throws IOException {
String result;
final Map<String, Object> binding = new HashMap<>();
ExtendedEmailPublisherDescriptor descriptor = Jenkins.getAc... | java |
private String executeScript(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream scriptStream)
throws IOException {
String result = "";
Map binding = new HashMap<>();
ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(Ext... | java |
private void addUpstreamCommittersTriggeringBuild(Run<?, ?> build, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc, EnvVars env, final ExtendedEmailPublisherContext context, RecipientProviderUtilities.IDebug debug) {
debug.send("Adding upstream committer from job %s with build number ... | java |
private void addUserFromChangeSet(ChangeLogSet.Entry change, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc, EnvVars env, final ExtendedEmailPublisherContext context, RecipientProviderUtilities.IDebug debug) {
User user = change.getAuthor();
RecipientProviderUtilities.addUser... | java |
private String fetchStyles(Document doc) {
Elements els = doc.select(STYLE_TAG);
StringBuilder styles = new StringBuilder();
for (Element e : els) {
if (e.attr("data-inline").equals("true")) {
styles.append(e.data());
e.remove();
}
... | java |
public String process(String input) {
Document doc = Jsoup.parse(input);
// check if the user wants to inline the data
Elements elements = doc.getElementsByAttributeValue(DATA_INLINE_ATTR, "true");
if (elements.isEmpty()) {
return input;
}
extractStyles(doc)... | java |
public static String unescapeString(String escapedString) {
StringBuilder sb = new StringBuilder();
for (int i = 1; i < escapedString.length() - 1; ++i) {
char c = escapedString.charAt(i);
if (c == '\\') {
++i;
sb.append(unescapeChar(escapedS... | java |
public static void printf(StringBuffer buf, String formatString, PrintfSpec printfSpec) {
for (int i = 0; i < formatString.length(); ++i) {
char c = formatString.charAt(i);
if ((c == '%') && (i + 1 < formatString.length())) {
++i;
char code = formatSt... | java |
private ClassLoader expandClasspath(ExtendedEmailPublisherContext context, ClassLoader loader) throws IOException {
List<ClasspathEntry> classpathList = new ArrayList<>();
if (classpath != null && !classpath.isEmpty()) {
transformToClasspathEntries(classpath, context, classpathList);
... | java |
protected int getNumFailures(Run<?, ?> build) {
AbstractTestResultAction a = build.getAction(AbstractTestResultAction.class);
if (a instanceof AggregatedTestResultAction) {
int result = 0;
AggregatedTestResultAction action = (AggregatedTestResultAction) a;
for (ChildR... | java |
private Run<?, ?> getPreviousRun(Run<?, ?> build, TaskListener listener) {
Run<?, ?> prevBuild = ExtendedEmailPublisher.getPreviousRun(build, listener);
// Skip ABORTED builds
if (prevBuild != null && prevBuild.getResult() == Result.ABORTED) {
return getPreviousRun(prevBuild, liste... | java |
public static void setDnsCache(long expireMillis, String host, String... ips) {
try {
InetAddressCacheUtil.setInetAddressCache(host, ips, System.currentTimeMillis() + expireMillis);
} catch (Exception e) {
final String message = String.format("Fail to setDnsCache for host %s ip %... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.