idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
159,000
private static ViewData createInternal ( View view , Map < List < TagValue > , AggregationData > aggregationMap , AggregationWindowData window , Timestamp start , Timestamp end ) { @ SuppressWarnings ( "nullness" ) Map < List < TagValue > , AggregationData > map = aggregationMap ; return new AutoValue_ViewData ( view ,...
constructor does not have the
159,001
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 . hasMoreElem...
Logic borrowed from brave . internal . Platform . produceLocalEndpoint
159,002
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public AttributeValue [ ] createAttributeValues ( Data data ) { return getAttributeValues ( data . size , data . attributeType ) ; }
Create attribute values .
159,003
@ 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 . attribute...
Create an AttributeMap .
159,004
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Annotation createAnnotation ( Data data ) { return Annotation . fromDescriptionAndAttributes ( ANNOTATION_DESCRIPTION , data . attributeMap ) ; }
Create an Annotation .
159,005
static MetricFamilySamples createMetricFamilySamples ( Metric metric , String namespace ) { MetricDescriptor metricDescriptor = metric . getMetricDescriptor ( ) ; String name = getNamespacedName ( metricDescriptor . getName ( ) , namespace ) ; Type type = getType ( metricDescriptor . getType ( ) ) ; List < String > lab...
Converts a Metric to a Prometheus MetricFamilySamples .
159,006
static MetricFamilySamples createDescribableMetricFamilySamples ( MetricDescriptor metricDescriptor , String namespace ) { String name = getNamespacedName ( metricDescriptor . getName ( ) , namespace ) ; Type type = getType ( metricDescriptor . getType ( ) ) ; List < String > labelNames = convertToLabelNames ( metricDe...
Used only for Prometheus metric registry should not contain any actual samples .
159,007
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 ; }
Converts the list of label keys to a list of string label names . Also sanitizes the label keys .
159,008
static TraceConfig getCurrentTraceConfig ( io . opencensus . trace . config . TraceConfig traceConfig ) { TraceParams traceParams = traceConfig . getActiveTraceParams ( ) ; return toTraceConfigProto ( traceParams ) ; }
Creates a TraceConfig proto message with current TraceParams .
159,009
static TraceParams getUpdatedTraceParams ( UpdatedLibraryConfig config , io . opencensus . trace . config . TraceConfig traceConfig ) { TraceParams currentParams = traceConfig . getActiveTraceParams ( ) ; TraceConfig traceConfigProto = config . getConfig ( ) ; return fromTraceConfigProto ( traceConfigProto , currentPar...
TraceParams then applies the updated TraceParams .
159,010
@ SuppressWarnings ( "nullness" ) public static void createAndRegister ( ElasticsearchTraceConfiguration elasticsearchTraceConfiguration ) throws MalformedURLException { synchronized ( monitor ) { Preconditions . checkState ( handler == null , "Elasticsearch exporter already registered." ) ; Preconditions . checkArgume...
Creates and registers the ElasticsearchTraceExporter to the OpenCensus .
159,011
public boolean isEnabled ( String featurePath ) { checkArgument ( ! Strings . isNullOrEmpty ( featurePath ) ) ; return config . getConfig ( featurePath ) . getBoolean ( "enabled" ) ; }
Checks whether a feature is enabled in the effective configuration .
159,012
synchronized void sendInitialMessage ( Node node ) { io . opencensus . proto . trace . v1 . TraceConfig currentTraceConfigProto = TraceProtoUtils . getCurrentTraceConfig ( traceConfig ) ; CurrentLibraryConfig firstConfig = CurrentLibraryConfig . newBuilder ( ) . setNode ( node ) . setConfig ( currentTraceConfigProto ) ...
subsequent updated library configs unless the stream is interrupted .
159,013
private synchronized void sendCurrentConfig ( ) { io . opencensus . proto . trace . v1 . TraceConfig currentTraceConfigProto = TraceProtoUtils . getCurrentTraceConfig ( traceConfig ) ; CurrentLibraryConfig currentLibraryConfig = CurrentLibraryConfig . newBuilder ( ) . setConfig ( currentTraceConfigProto ) . build ( ) ;...
Follow up after applying the updated library config .
159,014
private synchronized void sendCurrentConfig ( CurrentLibraryConfig currentLibraryConfig ) { if ( isCompleted ( ) || currentConfigObserver == null ) { return ; } try { currentConfigObserver . onNext ( currentLibraryConfig ) ; } catch ( Exception e ) { onComplete ( e ) ; } }
Sends current config to Agent if the stream is still connected otherwise do nothing .
159,015
public static void main ( String [ ] args ) throws IOException , InterruptedException { View view = View . create ( Name . create ( "task_latency_distribution" ) , "The distribution of the task latencies." , LATENCY_MS , Aggregation . Distribution . create ( LATENCY_BOUNDARIES ) , Collections . < TagKey > emptyList ( )...
Main launcher for the Stackdriver example .
159,016
synchronized void onExport ( ExportTraceServiceRequest request ) { if ( isCompleted ( ) || exportRequestObserver == null ) { return ; } try { exportRequestObserver . onNext ( request ) ; } catch ( Exception e ) { onComplete ( e ) ; } }
Sends the export request to Agent if the stream is still connected otherwise do nothing .
159,017
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 greater than maximum (" + MAX_SE...
Creates a new time duration from given seconds and nanoseconds .
159,018
static Node getNodeInfo ( String serviceName ) { String jvmName = ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; Timestamp censusTimestamp = Timestamp . fromMillis ( System . currentTimeMillis ( ) ) ; return Node . newBuilder ( ) . setIdentifier ( getProcessIdentifier ( jvmName , censusTimestamp ) ) . setLibr...
Creates a Node with information from the OpenCensus library and environment variables .
159,019
static LibraryInfo getLibraryInfo ( String currentOcJavaVersion ) { return LibraryInfo . newBuilder ( ) . setLanguage ( Language . JAVA ) . setCoreLibraryVersion ( currentOcJavaVersion ) . setExporterVersion ( OC_AGENT_EXPORTER_VERSION ) . build ( ) ; }
Creates library info with the given OpenCensus Java version .
159,020
static ServiceInfo getServiceInfo ( String serviceName ) { return ServiceInfo . newBuilder ( ) . setName ( serviceName ) . build ( ) ; }
Creates service info with the given service name .
159,021
public HttpRequestContext handleStart ( C carrier , Q request ) { checkNotNull ( carrier , "carrier" ) ; checkNotNull ( request , "request" ) ; SpanBuilder spanBuilder = null ; String spanName = getSpanName ( request , extractor ) ; SpanContext spanContext = null ; try { spanContext = textFormat . extract ( carrier , g...
Instrument an incoming request before it is handled .
159,022
private Map < String , StatsSnapshot > getStatsSnapshots ( boolean isReceived ) { SortedMap < String , StatsSnapshot > map = Maps . newTreeMap ( ) ; if ( isReceived ) { getStatsSnapshots ( map , SERVER_RPC_CUMULATIVE_VIEWS ) ; getStatsSnapshots ( map , SERVER_RPC_MINUTE_VIEWS ) ; getStatsSnapshots ( map , SERVER_RPC_HO...
Gets stats snapshot for each method .
159,023
private static double getDurationInSecs ( ViewData . AggregationWindowData . CumulativeData cumulativeData ) { return toDoubleSeconds ( cumulativeData . getEnd ( ) . subtractTimestamp ( cumulativeData . getStart ( ) ) ) ; }
Calculates the duration of the given CumulativeData in seconds .
159,024
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 ( true ) . setSampler ...
Main launcher for the QuickStart example .
159,025
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 ; }
Creates an array of TagKeys of size with name prefix .
159,026
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 ; }
Creates an array of TagValues of size with name prefix .
159,027
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 ( ) ; }
Adds numTags tags to tagsBuilder and returns the associated tag context .
159,028
private static DisruptorEventQueue create ( ) { Disruptor < DisruptorEvent > disruptor = new Disruptor < > ( DisruptorEventFactory . INSTANCE , DISRUPTOR_BUFFER_SIZE , new DaemonThreadFactory ( "OpenCensus.Disruptor" ) , ProducerType . MULTI , new SleepingWaitStrategy ( 0 , 1000 * 1000 ) ) ; disruptor . handleEventsWit...
Creates a new EventQueue . Private to prevent creation of non - singleton instance .
159,029
public void shutdown ( ) { enqueuer = new DisruptorEnqueuer ( ) { final AtomicBoolean logged = new AtomicBoolean ( false ) ; public void enqueue ( Entry entry ) { if ( ! logged . getAndSet ( true ) ) { logger . log ( Level . INFO , "Attempted to enqueue entry after Disruptor shutdown." ) ; } } } ; disruptor . shutdown ...
Shuts down the underlying disruptor .
159,030
public final Span getCurrentSpan ( ) { Span currentSpan = CurrentSpanUtils . getCurrentSpan ( ) ; return currentSpan != null ? currentSpan : BlankSpan . INSTANCE ; }
Gets the current Span from the current Context .
159,031
public static void unregister ( ) { synchronized ( monitor ) { checkState ( handler != null , "Zipkin exporter is not registered." ) ; unregister ( Tracing . getExportComponent ( ) . getSpanExporter ( ) ) ; handler = null ; } }
Unregisters the Zipkin Trace exporter from the OpenCensus library .
159,032
static Span getCurrentSpan ( ) { SpanContext currentSpanContext = CURRENT_SPAN . get ( ) ; return currentSpanContext != null ? currentSpanContext . span : null ; }
Get the current span out of the thread context .
159,033
static void setCurrentSpan ( Span span ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Setting current span " + span ) ; } push ( span , false ) ; }
Set the current span in the thread context
159,034
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 ; } } }
will be applied on the closed Span .
159,035
static void push ( Span span , boolean autoClose ) { if ( isCurrent ( span ) ) { return ; } setSpanContextInternal ( new SpanContext ( span , autoClose ) ) ; }
Push a span into the thread context with the option to have it auto close if any child spans are themselves closed . Use autoClose = true if you start a new span with a parent that wasn t already in thread context .
159,036
public static void main ( String ... args ) { try { setupOpenCensusAndPrometheusExporter ( ) ; } catch ( IOException e ) { System . err . println ( "Failed to create and register OpenCensus Prometheus Stats exporter " + e ) ; return ; } BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) )...
Main launcher for the Repl example .
159,037
public String get ( String key ) { for ( Entry entry : getEntries ( ) ) { if ( entry . getKey ( ) . equals ( key ) ) { return entry . getValue ( ) ; } } return null ; }
Returns the value to which the specified key is mapped or null if this map contains no mapping for the key .
159,038
private static boolean validateValue ( String value ) { if ( value . length ( ) > VALUE_MAX_SIZE || value . charAt ( value . length ( ) - 1 ) == ' ' ) { return false ; } for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; if ( c == ',' || c == '=' || c < ' ' || c > '~' ) { return false ;...
0x20 to 0x7E ) except comma and = .
159,039
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public TagContext timeNestedTagContext ( Data data ) { return TagsBenchmarksUtil . createTagContext ( data . tagger . toBuilder ( data . baseTagContext ) , data . numTags ) ; }
Build nested tag context .
159,040
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 =...
Creates and registers the Jaeger Trace exporter to the OpenCensus library . Only one Jaeger exporter can be registered at any point .
159,041
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 = ...
Creates and registers the Jaeger Trace exporter to the OpenCensus library using the provided HttpSender . Only one Jaeger exporter can be registered at any point .
159,042
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 = tracer . getCurrentSpan ( ) ; sp...
A helper function that performs some work in its own Span .
159,043
@ 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\">Name</td>\n" + " <td class=\"col_hea...
Prints a table to a PrintWriter that shows existing trace parameters .
159,044
@ BenchmarkMode ( Mode . SampleTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span putAttribute ( Data data ) { data . span . putAttribute ( ATTRIBUTE_KEY , AttributeValue . stringAttributeValue ( ATTRIBUTE_VALUE ) ) ; return data . span ; }
This benchmark attempts to measure performance of adding an attribute to the span .
159,045
@ BenchmarkMode ( Mode . SampleTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span addAnnotation ( Data data ) { data . span . addAnnotation ( ANNOTATION_DESCRIPTION ) ; return data . span ; }
This benchmark attempts to measure performance of adding an annotation to the span .
159,046
@ 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 ; }
This benchmark attempts to measure performance of adding a network event to the span .
159,047
@ 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 ; }
This benchmark attempts to measure performance of adding a link to the span .
159,048
static OcAgentMetricsServiceExportRpcHandler create ( MetricsServiceStub stub ) { OcAgentMetricsServiceExportRpcHandler exportRpcHandler = new OcAgentMetricsServiceExportRpcHandler ( ) ; ExportResponseObserver exportResponseObserver = new ExportResponseObserver ( exportRpcHandler ) ; try { StreamObserver < ExportMetric...
given MetricsServiceStub .
159,049
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 greater than maximum (" + MAX_S...
Creates a new timestamp from given seconds and nanoseconds .
159,050
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 ) ) ; }
Creates a new timestamp from the given milliseconds .
159,051
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_SEC...
Returns a Timestamp with the specified duration added .
159,052
private static long floorDiv ( long x , long y ) { return BigDecimal . valueOf ( x ) . divide ( BigDecimal . valueOf ( y ) , 0 , RoundingMode . FLOOR ) . longValue ( ) ; }
Returns the result of dividing x by y rounded using floor .
159,053
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...
This method should only be called once .
159,054
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 ) ; }
Returns the subset of the given views that should be exported
159,055
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 ( ) ; Measur...
Records stats with a set of tags .
159,056
synchronized void clearStats ( ) { for ( Entry < String , Collection < MutableViewData > > entry : mutableMap . asMap ( ) . entrySet ( ) ) { for ( MutableViewData mutableViewData : entry . getValue ( ) ) { mutableViewData . clearStats ( ) ; } } }
Clear stats for all the current MutableViewData
159,057
synchronized void resumeStatsCollection ( Timestamp now ) { for ( Entry < String , Collection < MutableViewData > > entry : mutableMap . asMap ( ) . entrySet ( ) ) { for ( MutableViewData mutableViewData : entry . getValue ( ) ) { mutableViewData . resumeStatsCollection ( now ) ; } } }
Resume stats collection for all MutableViewData .
159,058
static ProcessIdentifier getProcessIdentifier ( String jvmName , Timestamp censusTimestamp ) { String hostname ; int pid ; int delimiterIndex = jvmName . indexOf ( '@' ) ; if ( delimiterIndex < 1 ) { try { hostname = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( UnknownHostException e ) { hostname = "loc...
Creates process identifier with the given JVM name and start time .
159,059
public static void main ( String [ ] args ) throws InterruptedException { configureAlwaysSample ( ) ; registerAllViews ( ) ; LongGauge gauge = registerGauge ( ) ; String endPoint = getStringOrDefaultFromArgs ( args , 0 , DEFAULT_ENDPOINT ) ; registerAgentExporters ( endPoint ) ; try ( Scope scope = tracer . spanBuilder...
Main launcher of the example .
159,060
public State get ( ) { InternalState internalState = currentInternalState . get ( ) ; while ( ! internalState . isRead ) { currentInternalState . compareAndSet ( internalState , internalState . state == State . ENABLED ? InternalState . ENABLED_READ : InternalState . DISABLED_READ ) ; internalState = currentInternalSta...
Returns the current state and updates the status as being read .
159,061
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 . compareAndSet ( inter...
Sets current state to the given state . Returns true if the current state is changed false otherwise .
159,062
private static int encodeTag ( Tag tag , StringBuilder stringBuilder ) { String key = tag . getKey ( ) . getName ( ) ; String value = tag . getValue ( ) . asString ( ) ; int charsOfTag = key . length ( ) + value . length ( ) ; checkArgument ( charsOfTag <= TAG_SERIALIZED_SIZE_LIMIT , "Serialized size of tag " + tag + "...
Encodes the tag to the given string builder and returns the length of encoded key - value pair .
159,063
private static void decodeTag ( String stringTag , Map < TagKey , TagValueWithMetadata > tags ) { String keyWithValue ; int firstPropertyIndex = stringTag . indexOf ( TAG_PROPERTIES_DELIMITER ) ; if ( firstPropertyIndex != - 1 ) { keyWithValue = stringTag . substring ( 0 , firstPropertyIndex ) ; } else { keyWithValue =...
The format of encoded string tag is name1 = value1 ; properties1 = p1 ; properties2 = p2 .
159,064
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 ...
Emits the list of SampledRequets with a header .
159,065
private void emitSummaryTable ( PrintWriter out , Formatter formatter ) throws UnsupportedEncodingException { if ( runningSpanStore == null || sampledSpanStore == null ) { return ; } RunningSpanStore . Summary runningSpanStoreSummary = runningSpanStore . getSummary ( ) ; SampledSpanStore . Summary sampledSpanStoreSumma...
Emits the summary table with links to all samples .
159,066
public static int getVarInt ( byte [ ] src , int offset , int [ ] dst ) { int result = 0 ; int shift = 0 ; int b ; do { if ( shift >= 32 ) { throw new IndexOutOfBoundsException ( "varint too long" ) ; } b = src [ offset ++ ] ; result |= ( b & 0x7F ) << shift ; shift += 7 ; } while ( ( b & 0x80 ) != 0 ) ; dst [ 0 ] = re...
Reads a varint from src places its values into the first element of dst and returns the offset in to src of the first byte after the varint .
159,067
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 ; } else { result |= ( t...
Reads a varint from the current position of the given ByteBuffer and returns the decoded value as 32 bit integer .
159,068
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 ) ) ; } }
Encodes an integer in a variable - length encoding 7 bits per byte to a ByteBuffer sink .
159,069
public static int getVarInt ( InputStream inputStream ) throws IOException { int result = 0 ; int shift = 0 ; int b ; do { if ( shift >= 32 ) { throw new IndexOutOfBoundsException ( "varint too long" ) ; } b = inputStream . read ( ) ; result |= ( b & 0x7F ) << shift ; shift += 7 ; } while ( ( b & 0x80 ) != 0 ) ; return...
Reads a varint from the given InputStream and returns the decoded value as an int .
159,070
public static void putVarInt ( int v , OutputStream outputStream ) throws IOException { byte [ ] bytes = new byte [ varIntSize ( v ) ] ; putVarInt ( v , bytes , 0 ) ; outputStream . write ( bytes ) ; }
Encodes an integer in a variable - length encoding 7 bits per byte and writes it to the given OutputStream .
159,071
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 << 14 ; } else { result |=...
Reads an up to 64 bit long varint from the current position of the given ByteBuffer and returns the decoded value as long .
159,072
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 ) ) ; } }
Encodes a long integer in a variable - length encoding 7 bits per byte to a ByteBuffer sink .
159,073
@ 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 . alwaysSample ( ) : Samplers . nev...
Create a root span .
159,074
@ 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 [ ...
Create a link .
159,075
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public MessageEvent createMessageEvent ( Data data ) { return MessageEvent . builder ( MessageEvent . Type . SENT , MESSAGE_ID ) . build ( ) ; }
Create a message event .
159,076
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span getCurrentSpan ( Data data ) { return data . tracer . getCurrentSpan ( ) ; }
Get current trace span .
159,077
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public byte [ ] encodeSpanBinary ( Data data ) { return data . propagation . getBinaryFormat ( ) . toByteArray ( data . spanToEncode . getContext ( ) ) ; }
Encode a span using binary format .
159,078
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public SpanContext decodeSpanBinary ( Data data ) throws SpanContextParseException { return data . propagation . getBinaryFormat ( ) . fromByteArray ( data . spanToDecodeBinary ) ; }
Decode a span using binary format .
159,079
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public String encodeSpanText ( Data data ) { return encodeSpanContextText ( data . propagation . getTraceContextFormat ( ) , data . spanToEncode . getContext ( ) ) ; }
Encode a span using text format .
159,080
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public SpanContext decodeSpanText ( Data data ) throws SpanContextParseException { return data . propagation . getTraceContextFormat ( ) . extract ( data . spanToDecodeText , textGetter ) ; }
Decode a span using text format .
159,081
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span setStatus ( Data data ) { data . spanToSet . setStatus ( STATUS_OK ) ; return data . spanToSet ; }
Set status on a span .
159,082
@ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span endSpan ( Data data ) { data . spanToEnd . end ( ) ; return data . spanToEnd ; }
End a span .
159,083
public static void createAndRegisterWithCredentialsAndProjectId ( Credentials credentials , String projectId ) throws IOException { StackdriverTraceExporter . createAndRegister ( StackdriverTraceConfiguration . builder ( ) . setCredentials ( credentials ) . setProjectId ( projectId ) . build ( ) ) ; }
Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit project ID and using explicit credentials . Only one Stackdriver exporter can be registered at any point .
159,084
public static void createAndRegisterWithProjectId ( String projectId ) throws IOException { StackdriverTraceExporter . createAndRegister ( StackdriverTraceConfiguration . builder ( ) . setCredentials ( GoogleCredentials . getApplicationDefault ( ) ) . setProjectId ( projectId ) . build ( ) ) ; }
Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit project ID . Only one Stackdriver exporter can be registered at any point .
159,085
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 ( ) ; sha...
Converts the given Metric into datapoints that can be sent to SignalFx .
159,086
@ SuppressWarnings ( "unused" ) public void setSmtpAuth ( String userName , String password ) { setSmtpUsername ( userName ) ; setSmtpPassword ( password ) ; }
Make API match Mailer plugin
159,087
private Object readResolve ( ) throws ObjectStreamException { if ( triggerScript != null && secureTriggerScript == null ) { this . secureTriggerScript = new SecureGroovyScript ( triggerScript , false , null ) ; this . secureTriggerScript . configuring ( ApprovalContext . create ( ) ) ; triggerScript = null ; } return t...
Called when object has been deserialized from a stream .
159,088
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 . getActiveInstance ( ) . getDescriptor...
Renders the template using a SimpleTemplateEngine
159,089
private String executeScript ( Run < ? , ? > build , FilePath workspace , TaskListener listener , InputStream scriptStream ) throws IOException { String result = "" ; Map binding = new HashMap < > ( ) ; ExtendedEmailPublisherDescriptor descriptor = Jenkins . getActiveInstance ( ) . getDescriptorByType ( ExtendedEmailPu...
Executes a script and returns the last value as a String
159,090
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 %...
Adds for the given upstream build the committers to the recipient list for each commit in the upstream build .
159,091
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 ( ) ; RecipientProviderUtilit...
Adds a user to the recipients list based on a specific SCM change set
159,092
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 ( ) ; } } return styles . toString ( ) ; }
Generates a stylesheet from an html document
159,093
public String process ( String input ) { Document doc = Jsoup . parse ( input ) ; Elements elements = doc . getElementsByAttributeValue ( DATA_INLINE_ATTR , "true" ) ; if ( elements . isEmpty ( ) ) { return input ; } extractStyles ( doc ) ; applyStyles ( doc ) ; inlineImages ( doc ) ; doc . outputSettings ( doc . outpu...
Takes an input string representing an html document and processes it with the Css Inliner .
159,094
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 ( escapedString . charAt ( i ) ) ) ; } else { sb . append...
Replaces all the printf - style escape sequences in a string with the appropriate characters .
159,095
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 = formatString . charAt ( i ) ; if ( code == '%...
Formats a string and puts the result into a StringBuffer . Allows for standard Java backslash escapes and a customized behavior for % escapes in the form of a PrintfSpec .
159,096
private ClassLoader expandClasspath ( ExtendedEmailPublisherContext context , ClassLoader loader ) throws IOException { List < ClasspathEntry > classpathList = new ArrayList < > ( ) ; if ( classpath != null && ! classpath . isEmpty ( ) ) { transformToClasspathEntries ( classpath , context , classpathList ) ; } List < G...
Expand the plugin class loader with URL taken from the project descriptor and the global configuration .
159,097
protected int getNumFailures ( Run < ? , ? > build ) { AbstractTestResultAction a = build . getAction ( AbstractTestResultAction . class ) ; if ( a instanceof AggregatedTestResultAction ) { int result = 0 ; AggregatedTestResultAction action = ( AggregatedTestResultAction ) a ; for ( ChildReport cr : action . getChildRe...
Determine the number of direct failures in the given build . If it aggregates downstream results ignore contributed failures . This is because at the time this trigger runs the current build s aggregated results aren t available yet but those of the previous build may be .
159,098
private Run < ? , ? > getPreviousRun ( Run < ? , ? > build , TaskListener listener ) { Run < ? , ? > prevBuild = ExtendedEmailPublisher . getPreviousRun ( build , listener ) ; if ( prevBuild != null && prevBuild . getResult ( ) == Result . ABORTED ) { return getPreviousRun ( prevBuild , listener ) ; } return prevBuild ...
Find most recent previous build matching certain criteria .
159,099
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 %s expireMillis %...
Set a dns cache entry .