├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── build-checker.yml │ ├── build-gradle-examples.yml │ ├── build-maven-examples.yml │ └── build.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── AUTHORS ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── RELEASING.md ├── all └── build.gradle ├── api ├── README.md ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ ├── common │ │ ├── Clock.java │ │ ├── Duration.java │ │ ├── ExperimentalApi.java │ │ ├── Function.java │ │ ├── Functions.java │ │ ├── Internal.java │ │ ├── NonThrowingCloseable.java │ │ ├── OpenCensusLibraryInformation.java │ │ ├── Scope.java │ │ ├── ServerStats.java │ │ ├── ServerStatsDeserializationException.java │ │ ├── ServerStatsEncoding.java │ │ ├── ServerStatsFieldEnums.java │ │ ├── TimeUtils.java │ │ ├── Timestamp.java │ │ ├── ToDoubleFunction.java │ │ ├── ToLongFunction.java │ │ └── package-info.java │ │ ├── internal │ │ ├── DefaultVisibilityForTesting.java │ │ ├── NoopScope.java │ │ ├── Provider.java │ │ ├── StringUtils.java │ │ ├── Utils.java │ │ ├── ZeroTimeClock.java │ │ └── package-info.java │ │ ├── metrics │ │ ├── DerivedDoubleCumulative.java │ │ ├── DerivedDoubleGauge.java │ │ ├── DerivedLongCumulative.java │ │ ├── DerivedLongGauge.java │ │ ├── DoubleCumulative.java │ │ ├── DoubleGauge.java │ │ ├── LabelKey.java │ │ ├── LabelValue.java │ │ ├── LongCumulative.java │ │ ├── LongGauge.java │ │ ├── MetricOptions.java │ │ ├── MetricRegistry.java │ │ ├── Metrics.java │ │ ├── MetricsComponent.java │ │ ├── data │ │ │ ├── AttachmentValue.java │ │ │ ├── Exemplar.java │ │ │ └── package-info.java │ │ ├── export │ │ │ ├── Distribution.java │ │ │ ├── ExportComponent.java │ │ │ ├── Metric.java │ │ │ ├── MetricDescriptor.java │ │ │ ├── MetricProducer.java │ │ │ ├── MetricProducerManager.java │ │ │ ├── Point.java │ │ │ ├── Summary.java │ │ │ ├── TimeSeries.java │ │ │ └── Value.java │ │ └── package-info.java │ │ ├── resource │ │ ├── Resource.java │ │ └── package-info.java │ │ ├── stats │ │ ├── Aggregation.java │ │ ├── AggregationData.java │ │ ├── BucketBoundaries.java │ │ ├── Measure.java │ │ ├── MeasureMap.java │ │ ├── Measurement.java │ │ ├── NoopStats.java │ │ ├── Stats.java │ │ ├── StatsCollectionState.java │ │ ├── StatsComponent.java │ │ ├── StatsRecorder.java │ │ ├── View.java │ │ ├── ViewData.java │ │ ├── ViewManager.java │ │ └── package-info.java │ │ ├── tags │ │ ├── InternalUtils.java │ │ ├── NoopTags.java │ │ ├── Tag.java │ │ ├── TagContext.java │ │ ├── TagContextBuilder.java │ │ ├── TagKey.java │ │ ├── TagMetadata.java │ │ ├── TagValue.java │ │ ├── Tagger.java │ │ ├── TaggingState.java │ │ ├── Tags.java │ │ ├── TagsComponent.java │ │ ├── package-info.java │ │ ├── propagation │ │ │ ├── TagContextBinarySerializer.java │ │ │ ├── TagContextDeserializationException.java │ │ │ ├── TagContextSerializationException.java │ │ │ ├── TagContextTextFormat.java │ │ │ └── TagPropagationComponent.java │ │ └── unsafe │ │ │ └── ContextUtils.java │ │ └── trace │ │ ├── Annotation.java │ │ ├── AttributeValue.java │ │ ├── BaseMessageEvent.java │ │ ├── BigendianEncoding.java │ │ ├── BlankSpan.java │ │ ├── ContextHandle.java │ │ ├── ContextManager.java │ │ ├── CurrentSpanUtils.java │ │ ├── EndSpanOptions.java │ │ ├── Link.java │ │ ├── MessageEvent.java │ │ ├── NetworkEvent.java │ │ ├── Sampler.java │ │ ├── Span.java │ │ ├── SpanBuilder.java │ │ ├── SpanContext.java │ │ ├── SpanId.java │ │ ├── Status.java │ │ ├── TraceComponent.java │ │ ├── TraceId.java │ │ ├── TraceOptions.java │ │ ├── Tracer.java │ │ ├── Tracestate.java │ │ ├── Tracing.java │ │ ├── config │ │ ├── TraceConfig.java │ │ └── TraceParams.java │ │ ├── export │ │ ├── ExportComponent.java │ │ ├── RunningSpanStore.java │ │ ├── SampledSpanStore.java │ │ ├── SpanData.java │ │ └── SpanExporter.java │ │ ├── internal │ │ └── BaseMessageEventUtils.java │ │ ├── package-info.java │ │ ├── propagation │ │ ├── BinaryFormat.java │ │ ├── PropagationComponent.java │ │ ├── SpanContextParseException.java │ │ └── TextFormat.java │ │ ├── samplers │ │ ├── AlwaysSampleSampler.java │ │ ├── NeverSampleSampler.java │ │ ├── ProbabilitySampler.java │ │ └── Samplers.java │ │ └── unsafe │ │ ├── ContextHandleImpl.java │ │ ├── ContextHandleUtils.java │ │ ├── ContextManagerImpl.java │ │ └── ContextUtils.java │ └── test │ └── java │ └── io │ └── opencensus │ ├── common │ ├── DurationTest.java │ ├── FunctionsTest.java │ ├── ServerStatsEncodingTest.java │ ├── ServerStatsFieldEnumsTest.java │ ├── ServerStatsTest.java │ ├── TimeUtilsTest.java │ └── TimestampTest.java │ ├── internal │ ├── ProviderTest.java │ ├── StringUtilsTest.java │ └── UtilsTest.java │ ├── metrics │ ├── DerivedDoubleCumulativeTest.java │ ├── DerivedDoubleGaugeTest.java │ ├── DerivedLongCumulativeTest.java │ ├── DerivedLongGaugeTest.java │ ├── DoubleCumulativeTest.java │ ├── DoubleGaugeTest.java │ ├── LabelKeyTest.java │ ├── LabelValueTest.java │ ├── LongCumulativeTest.java │ ├── LongGaugeTest.java │ ├── MetricOptionsTest.java │ ├── MetricRegistryTest.java │ ├── MetricsComponentTest.java │ ├── MetricsTest.java │ ├── data │ │ ├── AttachmentValueTest.java │ │ └── ExemplarTest.java │ └── export │ │ ├── DistributionTest.java │ │ ├── ExportComponentTest.java │ │ ├── MetricDescriptorTest.java │ │ ├── MetricProducerManagerTest.java │ │ ├── MetricTest.java │ │ ├── PointTest.java │ │ ├── SummaryTest.java │ │ ├── TimeSeriesTest.java │ │ └── ValueTest.java │ ├── resource │ └── ResourceTest.java │ ├── stats │ ├── AggregationDataTest.java │ ├── AggregationTest.java │ ├── BucketBoundariesTest.java │ ├── MeasureTest.java │ ├── NoopStatsTest.java │ ├── NoopViewManagerTest.java │ ├── StatsTest.java │ ├── ViewDataTest.java │ └── ViewTest.java │ ├── tags │ ├── InternalUtilsTest.java │ ├── NoopTagsTest.java │ ├── TagContextTest.java │ ├── TagKeyTest.java │ ├── TagMetadataTest.java │ ├── TagTest.java │ ├── TagValueTest.java │ ├── TagsTest.java │ ├── propagation │ │ ├── TagContextDeserializationExceptionTest.java │ │ └── TagContextSerializationExceptionTest.java │ └── unsafe │ │ └── ContextUtilsTest.java │ └── trace │ ├── AnnotationTest.java │ ├── AttributeValueTest.java │ ├── BigendianEncodingTest.java │ ├── BlankSpanTest.java │ ├── CurrentSpanUtilsTest.java │ ├── EndSpanOptionsTest.java │ ├── LinkTest.java │ ├── MessageEventTest.java │ ├── NetworkEventTest.java │ ├── NoopSpan.java │ ├── SpanBuilderTest.java │ ├── SpanContextTest.java │ ├── SpanIdTest.java │ ├── SpanTest.java │ ├── StatusTest.java │ ├── TraceComponentTest.java │ ├── TraceIdTest.java │ ├── TraceOptionsTest.java │ ├── TracerTest.java │ ├── TracestateTest.java │ ├── TracingTest.java │ ├── config │ ├── TraceConfigTest.java │ └── TraceParamsTest.java │ ├── export │ ├── ExportComponentTest.java │ ├── NoopRunningSpanStoreTest.java │ ├── NoopSampledSpanStoreTest.java │ └── SpanDataTest.java │ ├── internal │ └── BaseMessageEventUtilsTest.java │ ├── propagation │ ├── BinaryFormatTest.java │ ├── PropagationComponentTest.java │ ├── SpanContextParseExceptionTest.java │ └── TextFormatTest.java │ ├── samplers │ └── SamplersTest.java │ └── unsafe │ └── ContextUtilsTest.java ├── appveyor.yml ├── benchmarks ├── README.md ├── build.gradle └── src │ └── jmh │ └── java │ └── io │ └── opencensus │ └── benchmarks │ ├── stats │ ├── RecordBatchedBenchmark.java │ ├── RecordDifferentTagValuesBenchmark.java │ ├── RecordMultipleViewsBenchmark.java │ └── StatsBenchmarksUtil.java │ ├── tags │ ├── NestedTagContextCreationBenchmark.java │ ├── TagContextBenchmark.java │ ├── TagsBenchmark.java │ └── TagsBenchmarksUtil.java │ └── trace │ ├── BasicDataBenchmark.java │ ├── BasicOperationsBenchmark.java │ ├── BenchmarksUtil.java │ ├── RecordTraceEventsBenchmark.java │ ├── SpanOperationsBenchmark.java │ └── StartEndSpanBenchmark.java ├── build.gradle ├── buildscripts ├── check-git-history.py ├── checkstyle.license ├── checkstyle.xml ├── codecov.yml ├── import-control.xml ├── kokoro │ ├── linux.cfg │ ├── linux.sh │ ├── linux_build.cfg │ ├── linux_example_gradle.cfg │ ├── linux_example_maven.cfg │ ├── linux_framework.cfg │ ├── linux_git_history.cfg │ ├── linux_presubmit.sh │ ├── macos.cfg │ ├── windows.bat │ └── windows.cfg └── travis_script ├── checker-framework └── stubs │ ├── google-cloud-java.astub │ ├── grpc.astub │ ├── guava.astub │ ├── log4j.astub │ ├── org-springframework-cloud-sleuth.astub │ └── org-springframework-cloud-sleuth.log.astub ├── contrib ├── agent │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── integration-test │ │ ├── java │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── agent │ │ │ │ └── instrumentation │ │ │ │ ├── ExecutorInstrumentationIT.java │ │ │ │ ├── ThreadInstrumentationIT.java │ │ │ │ └── UrlInstrumentationIT.java │ │ └── resources │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── agent │ │ │ └── instrumentation │ │ │ └── some_resource.txt │ │ ├── jmh │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── agent │ │ │ └── instrumentation │ │ │ ├── ExecutorInstrumentationBenchmark.java │ │ │ └── ThreadInstrumentationBenchmark.java │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── agent │ │ │ │ ├── AgentBuilderListener.java │ │ │ │ ├── AgentMain.java │ │ │ │ ├── Resources.java │ │ │ │ ├── Settings.java │ │ │ │ ├── bootstrap │ │ │ │ ├── ContextStrategy.java │ │ │ │ ├── ContextTrampoline.java │ │ │ │ ├── TraceStrategy.java │ │ │ │ ├── TraceTrampoline.java │ │ │ │ └── package-info.java │ │ │ │ ├── deps │ │ │ │ └── package-info.java │ │ │ │ └── instrumentation │ │ │ │ ├── ContextStrategyImpl.java │ │ │ │ ├── ContextTrampolineInitializer.java │ │ │ │ ├── ExecutorInstrumentation.java │ │ │ │ ├── Instrumenter.java │ │ │ │ ├── ThreadInstrumentation.java │ │ │ │ ├── TraceStrategyImpl.java │ │ │ │ ├── TraceTrampolineInitializer.java │ │ │ │ └── UrlInstrumentation.java │ │ └── resources │ │ │ └── reference.conf │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── agent │ │ │ ├── ResourcesTest.java │ │ │ ├── bootstrap │ │ │ ├── ContextTrampolineTest.java │ │ │ └── TraceTrampolineTest.java │ │ │ └── instrumentation │ │ │ ├── ExecutorInstrumentationTest.java │ │ │ ├── ThreadInstrumentationTest.java │ │ │ └── UrlInstrumentationTest.java │ │ └── resources │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── agent │ │ └── some_resource.txt ├── appengine_standard_util │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── appengine │ │ │ │ └── standard │ │ │ │ └── util │ │ │ │ └── AppEngineCloudTraceContextUtils.java │ │ └── proto │ │ │ └── trace_id.proto │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── appengine │ │ └── standard │ │ └── util │ │ └── AppEngineCloudTraceContextUtilsTest.java ├── dropwizard │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── dropwizard │ │ │ ├── DropWizardMetrics.java │ │ │ └── DropWizardUtils.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── dropwizard │ │ ├── DropWizardMetricsTest.java │ │ └── DropWizardUtilsTest.java ├── dropwizard5 │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── dropwizard5 │ │ │ ├── DropWizardMetrics.java │ │ │ └── DropWizardUtils.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── dropwizard5 │ │ ├── DropWizardMetricsTest.java │ │ └── DropWizardUtilsTest.java ├── exemplar_util │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── exemplar │ │ │ └── util │ │ │ ├── AttachmentValueSpanContext.java │ │ │ └── ExemplarUtils.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── exemplar │ │ └── util │ │ ├── AttachmentValueSpanContextTest.java │ │ └── ExemplarUtilsTest.java ├── grpc_metrics │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── grpc │ │ │ └── metrics │ │ │ ├── RpcMeasureConstants.java │ │ │ ├── RpcViewConstants.java │ │ │ └── RpcViews.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── grpc │ │ └── metrics │ │ ├── RpcMeasureConstantsTest.java │ │ ├── RpcViewConstantsTest.java │ │ └── RpcViewsTest.java ├── grpc_util │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── grpc │ │ │ └── util │ │ │ └── StatusConverter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── grpc │ │ └── util │ │ └── StatusConverterTest.java ├── http_jaxrs │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── http │ │ │ └── jaxrs │ │ │ ├── ExtendedContainerRequest.java │ │ │ ├── JaxrsClientExtractor.java │ │ │ ├── JaxrsClientFilter.java │ │ │ ├── JaxrsContainerExtractor.java │ │ │ ├── JaxrsContainerFilter.java │ │ │ └── Metrics.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── http │ │ └── jaxrs │ │ ├── JaxrsClientExtractorTest.java │ │ ├── JaxrsClientFilterTest.java │ │ ├── JaxrsContainerExtractorTest.java │ │ └── JaxrsContainerFilterTest.java ├── http_jetty_client │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── http │ │ │ └── jetty │ │ │ └── client │ │ │ ├── HttpRequestListener.java │ │ │ ├── OcJettyHttpClient.java │ │ │ └── OcJettyHttpClientExtractor.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── http │ │ └── jetty │ │ └── client │ │ ├── HttpRequestListenerTest.java │ │ ├── OcJettyHttpClientExtractorTest.java │ │ └── OcJettyHttpClientTest.java ├── http_servlet │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── http │ │ │ └── servlet │ │ │ ├── OcHttpServletExtractor.java │ │ │ ├── OcHttpServletFilter.java │ │ │ ├── OcHttpServletListener.java │ │ │ ├── OcHttpServletUtil.java │ │ │ └── WriteListenerWrapper.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── http │ │ └── servlet │ │ ├── OcHttpServletExtractorTest.java │ │ ├── OcHttpServletFilterTest.java │ │ ├── OcHttpServletListenerTest.java │ │ └── WriteListenerWrapperTest.java ├── http_util │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── http │ │ │ ├── AbstractHttpHandler.java │ │ │ ├── HttpClientHandler.java │ │ │ ├── HttpExtractor.java │ │ │ ├── HttpRequestContext.java │ │ │ ├── HttpServerHandler.java │ │ │ └── util │ │ │ ├── CloudTraceFormat.java │ │ │ ├── HttpMeasureConstants.java │ │ │ ├── HttpPropagationUtil.java │ │ │ ├── HttpTraceAttributeConstants.java │ │ │ ├── HttpTraceUtil.java │ │ │ ├── HttpViewConstants.java │ │ │ └── HttpViews.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── http │ │ ├── AbstractHttpHandlerTest.java │ │ ├── HttpClientHandlerTest.java │ │ ├── HttpRequestContextTest.java │ │ ├── HttpServerHandlerTest.java │ │ └── util │ │ ├── CloudTraceFormatTest.java │ │ ├── HttpMeasureConstantsTest.java │ │ ├── HttpPropagationUtilTest.java │ │ ├── HttpTraceUtilTest.java │ │ ├── HttpViewConstantsTest.java │ │ ├── HttpViewsTest.java │ │ └── testing │ │ └── FakeSpan.java ├── log_correlation │ ├── log4j2 │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── logcorrelation │ │ │ │ └── log4j2 │ │ │ │ ├── ContextDataUtils.java │ │ │ │ └── OpenCensusTraceContextDataInjector.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── logcorrelation │ │ │ └── log4j2 │ │ │ ├── OpenCensusLog4jLogCorrelationTest.java │ │ │ ├── OpenCensusTraceContextDataInjectorTest.java │ │ │ └── TestSpan.java │ └── stackdriver │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── logcorrelation │ │ │ └── stackdriver │ │ │ └── OpenCensusTraceLoggingEnhancer.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── logcorrelation │ │ └── stackdriver │ │ └── OpenCensusTraceLoggingEnhancerTest.java ├── observability_ready_util │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── observability │ │ └── ready │ │ └── util │ │ └── BasicSetup.java ├── resource_util │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── resource │ │ │ └── util │ │ │ ├── AwsIdentityDocUtils.java │ │ │ ├── CloudResource.java │ │ │ ├── ContainerResource.java │ │ │ ├── GcpMetadataConfig.java │ │ │ ├── HostResource.java │ │ │ ├── K8sResource.java │ │ │ └── ResourceUtils.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── resource │ │ └── util │ │ ├── AwsIdentityDocUtilsTest.java │ │ ├── CloudResourceTest.java │ │ ├── ContainerResourceTest.java │ │ ├── HostResourceTest.java │ │ ├── K8sResourceTest.java │ │ └── ResourceUtilsTest.java ├── spring │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── spring │ │ │ │ ├── aop │ │ │ │ ├── CensusSpringAspect.java │ │ │ │ ├── CensusSpringSqlAspect.java │ │ │ │ ├── Handler.java │ │ │ │ └── Traced.java │ │ │ │ ├── autoconfig │ │ │ │ ├── OpenCensusAutoConfiguration.java │ │ │ │ ├── OpenCensusProperties.java │ │ │ │ └── TraceWebAsyncClientAutoConfiguration.java │ │ │ │ └── instrument │ │ │ │ └── web │ │ │ │ ├── HttpServletFilter.java │ │ │ │ └── client │ │ │ │ └── TracingAsyncClientHttpRequestInterceptor.java │ │ └── resources │ │ │ └── META-INF │ │ │ ├── additional-spring-configuration-metadata.json │ │ │ └── spring.factories │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── opencensus │ │ │ └── contrib │ │ │ └── spring │ │ │ ├── aop │ │ │ ├── CensusSpringAspectTest.java │ │ │ └── Sample.java │ │ │ └── instrument │ │ │ └── web │ │ │ ├── AbstractMvcIntegrationTest.java │ │ │ ├── HttpServletFilterIntegrationTests.java │ │ │ └── TraceWebAsyncClientAutoConfigurationTest.java │ │ └── resources │ │ ├── META-INF │ │ └── spring.factories │ │ ├── beans │ │ └── HttpServletFilterIntegrationTest-context.xml │ │ └── spring.xml ├── spring_sleuth_v1x │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── contrib │ │ │ │ └── spring │ │ │ │ └── sleuth │ │ │ │ └── v1x │ │ │ │ ├── OpenCensusSleuthAutoConfiguration.java │ │ │ │ ├── OpenCensusSleuthProperties.java │ │ │ │ ├── OpenCensusSleuthSpan.java │ │ │ │ ├── OpenCensusSleuthSpanContextHolder.java │ │ │ │ └── OpenCensusSleuthTracer.java │ │ └── resources │ │ │ └── META-INF │ │ │ ├── additional-spring-configuration-metadata.json │ │ │ └── spring.factories │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── spring │ │ └── sleuth │ │ └── v1x │ │ ├── OpenCensusSleuthSpanContextHolderTest.java │ │ ├── OpenCensusSleuthSpanTest.java │ │ └── OpenCensusSleuthTracerTest.java ├── spring_starter │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── spring.provides └── zpages │ ├── README.md │ ├── build.gradle │ ├── screenshots │ ├── rpcz-example.png │ ├── statsz-example-1.png │ ├── statsz-example-2.png │ ├── traceconfigz-example.png │ └── tracez-example.png │ └── src │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ └── contrib │ │ └── zpages │ │ ├── RpczZPageHandler.java │ │ ├── StatszZPageHandler.java │ │ ├── Style.java │ │ ├── TraceConfigzZPageHandler.java │ │ ├── TracezZPageHandler.java │ │ ├── ZPageHandler.java │ │ ├── ZPageHandlers.java │ │ └── ZPageHttpHandler.java │ └── test │ └── java │ └── io │ └── opencensus │ └── contrib │ └── zpages │ ├── RpczZPageHandlerTest.java │ ├── StatszZPageHandlerTest.java │ ├── TracezZPageHandlerTest.java │ ├── ZPageHandlersTest.java │ └── ZPageHttpHandlerTest.java ├── examples ├── README.md ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── pom.xml ├── settings.gradle ├── spring │ └── servlet │ │ ├── .gitignore │ │ ├── application.properties │ │ ├── build.gradle │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── pom.xml │ │ ├── settings.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── examples │ │ │ └── spring │ │ │ └── servlet │ │ │ ├── Application.java │ │ │ ├── ApplicationAutoConfiguration.java │ │ │ └── HelloController.java │ │ └── resources │ │ ├── META-INF │ │ └── spring.factories │ │ └── application.properties └── src │ └── main │ ├── java │ └── io │ │ └── opencensus │ │ └── examples │ │ ├── gauges │ │ ├── DerivedDoubleGaugeQuickstart.java │ │ ├── DerivedLongGaugeQuickstart.java │ │ ├── DoubleGaugeQuickstart.java │ │ └── LongGaugeQuickstart.java │ │ ├── grpc │ │ └── helloworld │ │ │ ├── HelloWorldClient.java │ │ │ ├── HelloWorldServer.java │ │ │ └── HelloWorldUtils.java │ │ ├── helloworld │ │ └── QuickStart.java │ │ ├── http │ │ └── jetty │ │ │ ├── client │ │ │ └── HelloWorldClient.java │ │ │ └── server │ │ │ └── HelloWorldServer.java │ │ ├── ocagent │ │ └── OcAgentExportersQuickStart.java │ │ ├── quickstart │ │ ├── Repl.java │ │ └── prometheus.yaml │ │ ├── stats │ │ └── StackdriverQuickstart.java │ │ ├── tags │ │ └── TagContextExample.java │ │ ├── trace │ │ ├── MultiSpansContextTracing.java │ │ ├── MultiSpansScopedTracing.java │ │ ├── MultiSpansTracing.java │ │ └── Utils.java │ │ └── zpages │ │ └── ZPagesTester.java │ └── proto │ └── helloworld.proto ├── exporters ├── metrics │ ├── ocagent │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── exporter │ │ │ │ └── metrics │ │ │ │ └── ocagent │ │ │ │ ├── MetricsProtoUtils.java │ │ │ │ ├── OcAgentMetricsExporter.java │ │ │ │ ├── OcAgentMetricsExporterConfiguration.java │ │ │ │ ├── OcAgentMetricsExporterWorker.java │ │ │ │ ├── OcAgentMetricsServiceExportRpcHandler.java │ │ │ │ ├── OcAgentNodeUtils.java │ │ │ │ └── package-info.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── metrics │ │ │ └── ocagent │ │ │ ├── FakeOcAgentMetricsServiceGrpcImpl.java │ │ │ ├── MetricsProtoUtilsTests.java │ │ │ ├── OcAgentMetricsExporterConfigurationTest.java │ │ │ ├── OcAgentMetricsExporterIntegrationTest.java │ │ │ └── OcAgentMetricsServiceExportRpcHandlerTest.java │ └── util │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── metrics │ │ │ └── util │ │ │ ├── IntervalMetricReader.java │ │ │ ├── MetricExporter.java │ │ │ ├── MetricReader.java │ │ │ └── QueueMetricProducer.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── metrics │ │ └── util │ │ ├── FakeMetricExporter.java │ │ ├── IntervalMetricReaderTest.java │ │ ├── MetricReaderTest.java │ │ └── QueueMetricProducerTest.java ├── stats │ ├── prometheus │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── exporter │ │ │ │ └── stats │ │ │ │ └── prometheus │ │ │ │ ├── PrometheusExportUtils.java │ │ │ │ ├── PrometheusStatsCollector.java │ │ │ │ └── PrometheusStatsConfiguration.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── stats │ │ │ └── prometheus │ │ │ ├── PrometheusExportUtilsTest.java │ │ │ └── PrometheusStatsCollectorTest.java │ ├── signalfx │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── opencensus │ │ │ │ └── exporter │ │ │ │ └── stats │ │ │ │ └── signalfx │ │ │ │ ├── SignalFxMetricExporter.java │ │ │ │ ├── SignalFxMetricsSenderFactory.java │ │ │ │ ├── SignalFxSessionAdaptor.java │ │ │ │ ├── SignalFxStatsConfiguration.java │ │ │ │ └── SignalFxStatsExporter.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── stats │ │ │ └── signalfx │ │ │ ├── SignalFxMetricExporterTest.java │ │ │ ├── SignalFxSessionAdaptorTest.java │ │ │ ├── SignalFxStatsConfigurationTest.java │ │ │ └── SignalFxStatsExporterTest.java │ └── stackdriver │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── stats │ │ │ └── stackdriver │ │ │ ├── CreateMetricDescriptorExporter.java │ │ │ ├── CreateTimeSeriesExporter.java │ │ │ ├── StackdriverExportUtils.java │ │ │ ├── StackdriverStatsConfiguration.java │ │ │ └── StackdriverStatsExporter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── stats │ │ └── stackdriver │ │ ├── CreateMetricDescriptorExporterTest.java │ │ ├── CreateTimeSeriesExporterTest.java │ │ ├── FakeMetricServiceClient.java │ │ ├── StackdriverExportUtilsTest.java │ │ ├── StackdriverStatsConfigurationTest.java │ │ └── StackdriverStatsExporterTest.java └── trace │ ├── datadog │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── datadog │ │ │ ├── DatadogExporterHandler.java │ │ │ ├── DatadogSpan.java │ │ │ ├── DatadogTraceConfiguration.java │ │ │ └── DatadogTraceExporter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── datadog │ │ └── DatadogExporterHandlerTest.java │ ├── elasticsearch │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── elasticsearch │ │ │ ├── ElasticsearchTraceConfiguration.java │ │ │ ├── ElasticsearchTraceExporter.java │ │ │ ├── ElasticsearchTraceHandler.java │ │ │ └── JsonConversionUtils.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── elasticsearch │ │ ├── ElasticsearchTraceExporterTest.java │ │ └── JsonConversionUtilsTest.java │ ├── instana │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── instana │ │ │ ├── InstanaExporterConfiguration.java │ │ │ ├── InstanaExporterHandler.java │ │ │ └── InstanaTraceExporter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── instana │ │ ├── InstanaExporterHandlerTest.java │ │ └── InstanaTraceExporterTest.java │ ├── jaeger │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── jaeger │ │ │ ├── JaegerExporterConfiguration.java │ │ │ ├── JaegerExporterHandler.java │ │ │ └── JaegerTraceExporter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── jaeger │ │ ├── JaegerExporterConfigurationTest.java │ │ ├── JaegerExporterHandlerIntegrationTest.java │ │ ├── JaegerExporterHandlerTest.java │ │ └── JaegerTraceExporterTest.java │ ├── logging │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── logging │ │ │ ├── LoggingExporter.java │ │ │ └── LoggingTraceExporter.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── logging │ │ └── LoggingTraceExporterTest.java │ ├── ocagent │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── ocagent │ │ │ ├── OcAgentNodeUtils.java │ │ │ ├── OcAgentTraceExporter.java │ │ │ ├── OcAgentTraceExporterConfiguration.java │ │ │ ├── OcAgentTraceExporterHandler.java │ │ │ ├── OcAgentTraceServiceConfigRpcHandler.java │ │ │ ├── OcAgentTraceServiceConnectionWorker.java │ │ │ ├── OcAgentTraceServiceExportRpcHandler.java │ │ │ ├── TraceProtoUtils.java │ │ │ └── package-info.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── ocagent │ │ ├── FakeOcAgentTraceServiceGrpcImpl.java │ │ ├── FakeOcAgentTraceServiceGrpcImplTest.java │ │ ├── OcAgentNodeUtilsTest.java │ │ ├── OcAgentTraceExporterConfigurationTest.java │ │ ├── OcAgentTraceExporterIntegrationTest.java │ │ ├── OcAgentTraceExporterTest.java │ │ ├── OcAgentTraceServiceRpcHandlersTest.java │ │ └── TraceProtoUtilsTest.java │ ├── stackdriver │ ├── README.md │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opencensus │ │ │ └── exporter │ │ │ └── trace │ │ │ └── stackdriver │ │ │ ├── StackdriverExporter.java │ │ │ ├── StackdriverTraceConfiguration.java │ │ │ ├── StackdriverTraceExporter.java │ │ │ └── StackdriverV2ExporterHandler.java │ │ └── test │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── stackdriver │ │ ├── StackdriverTraceConfigurationTest.java │ │ ├── StackdriverTraceExporterTest.java │ │ ├── StackdriverV2ExporterHandlerExportTest.java │ │ └── StackdriverV2ExporterHandlerProtoTest.java │ ├── util │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── util │ │ └── TimeLimitedHandler.java │ └── zipkin │ ├── README.md │ ├── build.gradle │ └── src │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ └── exporter │ │ └── trace │ │ └── zipkin │ │ ├── ZipkinExporter.java │ │ ├── ZipkinExporterConfiguration.java │ │ ├── ZipkinExporterHandler.java │ │ └── ZipkinTraceExporter.java │ └── test │ └── java │ └── io │ └── opencensus │ └── exporter │ └── trace │ └── zipkin │ ├── ZipkinExporterConfigurationTest.java │ ├── ZipkinExporterHandlerTest.java │ └── ZipkinTraceExporterTest.java ├── findbugs-exclude.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── impl ├── README.md ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ ├── impl │ │ ├── internal │ │ │ └── DisruptorEventQueue.java │ │ ├── metrics │ │ │ └── MetricsComponentImpl.java │ │ ├── stats │ │ │ └── StatsComponentImpl.java │ │ ├── tags │ │ │ └── TagsComponentImpl.java │ │ └── trace │ │ │ ├── TraceComponentImpl.java │ │ │ └── internal │ │ │ └── ThreadLocalRandomHandler.java │ │ └── trace │ │ └── TraceComponentImpl.java │ └── test │ └── java │ └── io │ └── opencensus │ └── impl │ ├── internal │ └── DisruptorEventQueueTest.java │ ├── metrics │ └── MetricsTest.java │ ├── stats │ └── StatsTest.java │ ├── tags │ └── TagsTest.java │ └── trace │ └── TracingTest.java ├── impl_core ├── README.md ├── build.gradle └── src │ ├── jmh │ └── java │ │ └── io │ │ └── opencensus │ │ └── implcore │ │ └── trace │ │ └── propagation │ │ ├── B3FormatImplBenchmark.java │ │ ├── BinaryFormatImplBenchmark.java │ │ ├── TextFormatBenchmarkBase.java │ │ └── TraceContextImplBenchmark.java │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ └── implcore │ │ ├── common │ │ └── MillisClock.java │ │ ├── internal │ │ ├── CheckerFrameworkUtils.java │ │ ├── CurrentState.java │ │ ├── DaemonThreadFactory.java │ │ ├── EventQueue.java │ │ ├── NoopScope.java │ │ ├── SimpleEventQueue.java │ │ ├── TimestampConverter.java │ │ ├── Utils.java │ │ └── VarInt.java │ │ ├── metrics │ │ ├── DerivedDoubleCumulativeImpl.java │ │ ├── DerivedDoubleGaugeImpl.java │ │ ├── DerivedLongCumulativeImpl.java │ │ ├── DerivedLongGaugeImpl.java │ │ ├── DoubleCumulativeImpl.java │ │ ├── DoubleGaugeImpl.java │ │ ├── LongCumulativeImpl.java │ │ ├── LongGaugeImpl.java │ │ ├── Meter.java │ │ ├── MetricRegistryImpl.java │ │ ├── MetricsComponentImplBase.java │ │ └── export │ │ │ ├── ExportComponentImpl.java │ │ │ └── MetricProducerManagerImpl.java │ │ ├── stats │ │ ├── IntervalBucket.java │ │ ├── MeasureMapImpl.java │ │ ├── MeasureMapInternal.java │ │ ├── MeasureToViewMap.java │ │ ├── MetricProducerImpl.java │ │ ├── MetricUtils.java │ │ ├── MutableAggregation.java │ │ ├── MutableViewData.java │ │ ├── RecordUtils.java │ │ ├── StatsComponentImplBase.java │ │ ├── StatsManager.java │ │ ├── StatsRecorderImpl.java │ │ └── ViewManagerImpl.java │ │ ├── tags │ │ ├── CurrentTagMapUtils.java │ │ ├── NoopTagMapBuilder.java │ │ ├── TagContextUtils.java │ │ ├── TagMapBuilderImpl.java │ │ ├── TagMapImpl.java │ │ ├── TagValueWithMetadata.java │ │ ├── TaggerImpl.java │ │ ├── TagsComponentImplBase.java │ │ └── propagation │ │ │ ├── BinarySerializationUtils.java │ │ │ ├── CorrelationContextFormat.java │ │ │ ├── TagContextBinarySerializerImpl.java │ │ │ └── TagPropagationComponentImpl.java │ │ └── trace │ │ ├── NoRecordEventsSpanImpl.java │ │ ├── RecordEventsSpanImpl.java │ │ ├── SpanBuilderImpl.java │ │ ├── StartEndHandlerImpl.java │ │ ├── TraceComponentImplBase.java │ │ ├── TracerImpl.java │ │ ├── config │ │ └── TraceConfigImpl.java │ │ ├── export │ │ ├── ExportComponentImpl.java │ │ ├── InProcessRunningSpanStore.java │ │ ├── InProcessSampledSpanStoreImpl.java │ │ ├── SampledSpanStoreImpl.java │ │ └── SpanExporterImpl.java │ │ ├── internal │ │ ├── ConcurrentIntrusiveList.java │ │ └── RandomHandler.java │ │ └── propagation │ │ ├── B3Format.java │ │ ├── BinaryFormatImpl.java │ │ ├── PropagationComponentImpl.java │ │ └── TraceContextFormat.java │ └── test │ └── java │ └── io │ └── opencensus │ └── implcore │ ├── internal │ ├── CurrentStateTest.java │ ├── TimestampConverterTest.java │ └── UtilsTest.java │ ├── metrics │ ├── DerivedDoubleCumulativeImplTest.java │ ├── DerivedDoubleGaugeImplTest.java │ ├── DerivedLongCumulativeImplTest.java │ ├── DerivedLongGaugeImplTest.java │ ├── DoubleCumulativeImplTest.java │ ├── DoubleGaugeImplTest.java │ ├── LongCumulativeImplTest.java │ ├── LongGaugeImplTest.java │ ├── MetricRegistryImplTest.java │ ├── MetricsComponentImplBaseTest.java │ └── export │ │ ├── ExportComponentImplTest.java │ │ └── MetricProducerManagerImplTest.java │ ├── stats │ ├── IntervalBucketTest.java │ ├── MeasureMapInternalTest.java │ ├── MeasureToViewMapTest.java │ ├── MetricUtilsTest.java │ ├── MutableAggregationTest.java │ ├── MutableViewDataTest.java │ ├── RecordUtilsTest.java │ ├── StatsComponentImplBaseTest.java │ ├── StatsRecorderImplTest.java │ ├── StatsTestUtil.java │ └── ViewManagerImplTest.java │ ├── tags │ ├── CurrentTagMapUtilsTest.java │ ├── ScopedTagMapTest.java │ ├── TagMapImplTest.java │ ├── TaggerImplTest.java │ ├── TagsComponentImplBaseTest.java │ ├── TagsTestUtil.java │ └── propagation │ │ ├── CorrelationContextFormatTest.java │ │ ├── TagContextBinarySerializerImplTest.java │ │ ├── TagContextDeserializationTest.java │ │ ├── TagContextRoundtripTest.java │ │ └── TagContextSerializationTest.java │ └── trace │ ├── NoRecordEventsSpanImplTest.java │ ├── RecordEventsSpanImplTest.java │ ├── SpanBuilderImplTest.java │ ├── TraceComponentImplBaseTest.java │ ├── TracerImplTest.java │ ├── config │ └── TraceConfigImplTest.java │ ├── export │ ├── ExportComponentImplTest.java │ ├── InProcessRunningSpanStoreImplTest.java │ ├── InProcessSampledSpanStoreImplTest.java │ ├── NoopInProcessRunningSpanStoreTest.java │ ├── NoopSampledSpanStoreImplTest.java │ └── SpanExporterImplTest.java │ ├── internal │ └── ConcurrentIntrusiveListTest.java │ └── propagation │ ├── B3FormatTest.java │ ├── BinaryFormatImplTest.java │ ├── PropagationComponentImplTest.java │ └── TraceContextFormatTest.java ├── impl_lite ├── README.md ├── build.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── opencensus │ │ ├── impllite │ │ ├── metrics │ │ │ └── MetricsComponentImplLite.java │ │ ├── stats │ │ │ └── StatsComponentImplLite.java │ │ ├── tags │ │ │ └── TagsComponentImplLite.java │ │ └── trace │ │ │ └── TraceComponentImplLite.java │ │ └── trace │ │ └── TraceComponentImplLite.java │ └── test │ └── java │ └── io │ └── opencensus │ └── impllite │ ├── metrics │ └── MetricsTest.java │ ├── stats │ └── StatsTest.java │ ├── tags │ └── TagsTest.java │ └── trace │ └── TraceComponentImplLiteTest.java ├── settings.gradle └── testing ├── README.md ├── build.gradle └── src ├── main └── java │ └── io │ └── opencensus │ └── testing │ ├── common │ └── TestClock.java │ └── export │ └── TestHandler.java └── test └── java └── io └── opencensus └── testing └── common └── TestClockTest.java /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | 4 | # For anything not explicitly taken by someone else: 5 | * @census-instrumentation/global-owners @dinooliva @rghetia @songy23 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve. 4 | labels: bug 5 | --- 6 | 7 | Please answer these questions before submitting a bug report. 8 | 9 | ### What version of OpenCensus are you using? 10 | 11 | 12 | ### What JVM are you using (`java -version`)? 13 | 14 | 15 | ### What did you do? 16 | If possible, provide a recipe for reproducing the error. 17 | 18 | 19 | ### What did you expect to see? 20 | 21 | 22 | ### What did you see instead? 23 | 24 | 25 | ### Additional context 26 | Add any other context about the problem here. 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project. 4 | labels: feature-request 5 | --- 6 | 7 | **NB:** Before opening a feature request against this repo, consider whether the feature should be available across all languages in the OpenCensus libraries. If so, please [open an issue on opencensus-specs](https://github.com/census-instrumentation/opencensus-specs/issues/new) first. 8 | 9 | ### Is your feature request related to a problem? If so, please describe it. 10 | A clear and concise description of what the problem is, e.g. I need to be able to ... 11 | 12 | 13 | ### Describe the solution you'd like. 14 | A clear and concise description of what you want to happen. 15 | 16 | 17 | ### Describe alternatives you've considered. 18 | A clear and concise description of any alternative solutions or features you've considered. 19 | 20 | 21 | ### Additional context. 22 | Add any other context or screenshots about the feature request here. 23 | -------------------------------------------------------------------------------- /.github/workflows/build-checker.yml: -------------------------------------------------------------------------------- 1 | name: Build Checker 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - v0.* 8 | 9 | jobs: 10 | build: 11 | name: Build Checker 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2.3.4 15 | with: 16 | fetch-depth: 0 17 | - id: setup-java 18 | name: Setup Java 8 19 | uses: actions/setup-java@v2 20 | with: 21 | distribution: adopt 22 | java-version: 8 23 | - uses: burrunan/gradle-cache-action@v1.10 24 | with: 25 | remote-build-cache-proxy-enabled: false 26 | arguments: clean assemble -PcheckerFramework=true -------------------------------------------------------------------------------- /.github/workflows/build-gradle-examples.yml: -------------------------------------------------------------------------------- 1 | name: Build Gradle Examples 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - v0.* 8 | 9 | jobs: 10 | build: 11 | name: Build Gradle Examples Ubuntu 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2.3.4 15 | with: 16 | fetch-depth: 0 17 | - id: setup-java 18 | name: Setup Java 8 19 | uses: actions/setup-java@v2 20 | with: 21 | distribution: adopt 22 | java-version: 8 23 | - uses: burrunan/gradle-cache-action@v1.10 24 | with: 25 | remote-build-cache-proxy-enabled: false 26 | - name: Build Examples 27 | working-directory: ./examples 28 | run: ./gradlew clean assemble --stacktrace && ./gradlew check && ./gradlew verGJF 29 | - name: Build Spring Servlet example 30 | working-directory: ./examples/spring/servlet 31 | run: ./gradlew clean assemble --stacktrace && ./gradlew check && ./gradlew verGJF -------------------------------------------------------------------------------- /.github/workflows/build-maven-examples.yml: -------------------------------------------------------------------------------- 1 | name: Build Maven Examples 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - v0.* 8 | 9 | jobs: 10 | build: 11 | name: Build Maven Examples Ubuntu 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2.3.4 15 | with: 16 | fetch-depth: 0 17 | - id: setup-java 18 | name: Setup Java 8 19 | uses: actions/setup-java@v2 20 | with: 21 | distribution: adopt 22 | java-version: 8 23 | - name: Build Examples 24 | working-directory: ./examples 25 | run: mvn --batch-mode --update-snapshots clean package appassembler:assemble -e 26 | - name: Build Spring Servlet example 27 | working-directory: ./examples/spring/servlet 28 | run: mvn --batch-mode --update-snapshots clean package appassembler:assemble -e -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - v0.* 8 | 9 | jobs: 10 | build: 11 | name: Build 12 | runs-on: ${{ matrix.os }} 13 | strategy: 14 | matrix: 15 | os: 16 | - macos-latest 17 | - ubuntu-latest 18 | java: 19 | - 8 20 | # TODO: Java 11 build doesn't work due to Java7 target. 21 | include: 22 | - os: ubuntu-latest 23 | java: 8 24 | coverage: true 25 | steps: 26 | - uses: actions/checkout@v2.3.4 27 | with: 28 | fetch-depth: 0 29 | - id: setup-java 30 | name: Setup Java ${{ matrix.java }} 31 | uses: actions/setup-java@v2 32 | with: 33 | distribution: adopt 34 | java-version: ${{ matrix.java }} 35 | - run: ./gradlew clean assemble check --stacktrace 36 | # TODO: Run jacocoTestReport 37 | # TODO: Run verGJF -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | build 3 | gradle.properties 4 | .gradle 5 | local.properties 6 | out/ 7 | 8 | # Protobuf 9 | gen_gradle 10 | 11 | # Bazel 12 | bazel-* 13 | 14 | # Maven (proto) 15 | target 16 | 17 | # IntelliJ IDEA 18 | .idea 19 | *.iml 20 | .editorconfig 21 | 22 | # Eclipse 23 | .classpath 24 | .project 25 | .settings 26 | bin 27 | 28 | # NetBeans 29 | /.nb-gradle 30 | /.nb-gradle-properties 31 | 32 | # VS Code 33 | .vscode 34 | 35 | # OS X 36 | .DS_Store 37 | 38 | # Emacs 39 | *~ 40 | \#*\# 41 | 42 | # Vim 43 | .swp 44 | 45 | # Other 46 | TAGS 47 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/census-instrumentation/opencensus-java/baa68680b19040ff7739e314a2422a25cf41e27a/.gitmodules -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. -------------------------------------------------------------------------------- /api/README.md: -------------------------------------------------------------------------------- 1 | OpenCensus API 2 | ====================================================== 3 | 4 | * Java 6 and Android compatible. 5 | * The abstract classes in this directory can be subclassed to create alternative 6 | implementations of the OpenCensus library. 7 | -------------------------------------------------------------------------------- /api/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'OpenCensus API' 2 | 3 | dependencies { 4 | compile libraries.grpc_context 5 | 6 | compileOnly libraries.auto_value 7 | 8 | signature "org.codehaus.mojo.signature:java17:1.0@signature" 9 | signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature" 10 | } 11 | 12 | javadoc { 13 | exclude 'io/opencensus/internal/**' 14 | exclude 'io/opencensus/trace/internal/**' 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/io/opencensus/common/Clock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, OpenCensus Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.opencensus.common; 18 | 19 | /** 20 | * Interface for getting the current time. 21 | * 22 | * @since 0.5 23 | */ 24 | public abstract class Clock { 25 | 26 | /** 27 | * Obtains the current instant from this clock. 28 | * 29 | * @return the current instant. 30 | * @since 0.5 31 | */ 32 | public abstract Timestamp now(); 33 | 34 | /** 35 | * Returns a time measurement with nanosecond precision that can only be used to calculate elapsed 36 | * time. 37 | * 38 | * @return a time measurement with nanosecond precision that can only be used to calculate elapsed 39 | * time. 40 | * @since 0.5 41 | */ 42 | public abstract long nowNanos(); 43 | } 44 | -------------------------------------------------------------------------------- /api/src/main/java/io/opencensus/common/Function.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-17, OpenCensus Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.opencensus.common; 18 | 19 | /** 20 | * Used to specify matching functions for use encoding tagged unions (i.e. sum types) in Java. See 21 | * {@link io.opencensus.trace.AttributeValue#match} for an example of its use. 22 | * 23 | *
Note: This class is based on the java.util.Function class added in Java 1.8. We cannot use the
24 | * Function from Java 1.8 because this library is Java 1.6 compatible.
25 | *
26 | * @since 0.5
27 | */
28 | public interface Function {
29 |
30 | /**
31 | * Applies the function to the given argument.
32 | *
33 | * @param arg the argument to the function.
34 | * @return the result of the function.
35 | * @since 0.5
36 | */
37 | B apply(A arg);
38 | }
39 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/Internal.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Annotates a program element (class, method, package etc) which is internal to OpenCensus, not
27 | * part of the public API, and should not be used by users of the OpenCensus library.
28 | *
29 | * @since 0.5
30 | */
31 | @Internal
32 | @Retention(RetentionPolicy.SOURCE)
33 | @Target({
34 | ElementType.ANNOTATION_TYPE,
35 | ElementType.CONSTRUCTOR,
36 | ElementType.FIELD,
37 | ElementType.METHOD,
38 | ElementType.PACKAGE,
39 | ElementType.TYPE
40 | })
41 | @Documented
42 | public @interface Internal {}
43 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/NonThrowingCloseable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | import java.io.Closeable;
20 |
21 | /**
22 | * An {@link Closeable} which cannot throw a checked exception.
23 | *
24 | * This is useful because such a reversion otherwise requires the caller to catch the
25 | * (impossible) Exception in the try-with-resources.
26 | *
27 | * Example of usage:
28 | *
29 | * Example of usage:
24 | *
25 | * Note: This class is based on the java.util.ToDoubleFunction class added in Java 1.8. We cannot
28 | * use the Function from Java 1.8 because this library is Java 1.6 compatible.
29 | *
30 | * @since 0.16
31 | */
32 | public interface ToDoubleFunction*@Nullable*/ T> {
33 |
34 | /**
35 | * Applies this function to the given argument.
36 | *
37 | * @param value the function argument.
38 | * @return the function result.
39 | */
40 | double applyAsDouble(/*@Nullable*/ T value);
41 | }
42 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/ToLongFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | /*>>>
20 | import org.checkerframework.checker.nullness.qual.Nullable;
21 | */
22 |
23 | /**
24 | * Represents a function that produces a long-valued result. See {@link
25 | * io.opencensus.metrics.MetricRegistry} for an example of its use.
26 | *
27 | * Note: This class is based on the java.util.ToLongFunction class added in Java 1.8. We cannot
28 | * use the Function from Java 1.8 because this library is Java 1.6 compatible.
29 | *
30 | * @since 0.16
31 | */
32 | public interface ToLongFunction*@Nullable*/ T> {
33 | /**
34 | * Applies this function to the given argument.
35 | *
36 | * @param value the function argument.
37 | * @return the function result.
38 | */
39 | long applyAsLong(/*@Nullable*/ T value);
40 | }
41 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /** Common API between different packages in this artifact. */
18 | package io.opencensus.common;
19 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/internal/DefaultVisibilityForTesting.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.internal;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Indicates that an element is package-private instead of private only for the purpose of testing.
26 | * This annotation is only meant to be used as documentation in the source code.
27 | */
28 | @Retention(RetentionPolicy.SOURCE)
29 | @Target({
30 | ElementType.ANNOTATION_TYPE,
31 | ElementType.CONSTRUCTOR,
32 | ElementType.FIELD,
33 | ElementType.METHOD,
34 | ElementType.PACKAGE,
35 | ElementType.TYPE
36 | })
37 | public @interface DefaultVisibilityForTesting {}
38 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/internal/NoopScope.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.internal;
18 |
19 | import io.opencensus.common.Scope;
20 |
21 | /** A {@link Scope} that does nothing when it is created or closed. */
22 | public final class NoopScope implements Scope {
23 | private static final Scope INSTANCE = new NoopScope();
24 |
25 | private NoopScope() {}
26 |
27 | /**
28 | * Returns a {@code NoopScope}.
29 | *
30 | * @return a {@code NoopScope}.
31 | */
32 | public static Scope getInstance() {
33 | return INSTANCE;
34 | }
35 |
36 | @Override
37 | public void close() {}
38 | }
39 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/internal/StringUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.internal;
18 |
19 | /** Internal utility methods for working with tag keys, tag values, and metric names. */
20 | public final class StringUtils {
21 |
22 | /**
23 | * Determines whether the {@code String} contains only printable characters.
24 | *
25 | * @param str the {@code String} to be validated.
26 | * @return whether the {@code String} contains only printable characters.
27 | */
28 | public static boolean isPrintableString(String str) {
29 | for (int i = 0; i < str.length(); i++) {
30 | if (!isPrintableChar(str.charAt(i))) {
31 | return false;
32 | }
33 | }
34 | return true;
35 | }
36 |
37 | private static boolean isPrintableChar(char ch) {
38 | return ch >= ' ' && ch <= '~';
39 | }
40 |
41 | private StringUtils() {}
42 | }
43 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/internal/ZeroTimeClock.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.internal;
18 |
19 | import io.opencensus.common.Clock;
20 | import io.opencensus.common.Timestamp;
21 | import javax.annotation.concurrent.Immutable;
22 |
23 | /** A {@link Clock} that always returns 0. */
24 | @Immutable
25 | public final class ZeroTimeClock extends Clock {
26 | private static final ZeroTimeClock INSTANCE = new ZeroTimeClock();
27 | private static final Timestamp ZERO_TIMESTAMP = Timestamp.create(0, 0);
28 |
29 | private ZeroTimeClock() {}
30 |
31 | /**
32 | * Returns a {@code ZeroTimeClock}.
33 | *
34 | * @return a {@code ZeroTimeClock}.
35 | */
36 | public static ZeroTimeClock getInstance() {
37 | return INSTANCE;
38 | }
39 |
40 | @Override
41 | public Timestamp now() {
42 | return ZERO_TIMESTAMP;
43 | }
44 |
45 | @Override
46 | public long nowNanos() {
47 | return 0;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/internal/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Interfaces and implementations that are internal to OpenCensus.
19 | *
20 | * All the content under this package and its subpackages are considered annotated with {@link
21 | * io.opencensus.common.Internal}.
22 | */
23 | @io.opencensus.common.Internal
24 | package io.opencensus.internal;
25 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/metrics/data/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * This package describes common data models in Metrics that are shared across multiple packages.
19 | *
20 | * WARNING: Currently all the public classes under this package are marked as {@link
21 | * io.opencensus.common.ExperimentalApi}. The classes and APIs under {@link io.opencensus.metrics}
22 | * are likely to get backwards-incompatible updates in the future. DO NOT USE except for
23 | * experimental purposes.
24 | */
25 | @io.opencensus.common.ExperimentalApi
26 | package io.opencensus.metrics.data;
27 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/metrics/export/MetricProducer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.metrics.export;
18 |
19 | import io.opencensus.common.ExperimentalApi;
20 | import java.util.Collection;
21 |
22 | /**
23 | * A {@link Metric} producer that can be registered for exporting using {@link
24 | * MetricProducerManager}.
25 | *
26 | * All implementation MUST be thread-safe.
27 | *
28 | * @since 0.17
29 | */
30 | @ExperimentalApi
31 | public abstract class MetricProducer {
32 |
33 | /**
34 | * Returns a collection of produced {@link Metric}s to be exported.
35 | *
36 | * @return a collection of produced {@link Metric}s to be exported.
37 | * @since 0.17
38 | */
39 | public abstract Collection WARNING: Currently all the public classes under this package are marked as {@link
22 | * io.opencensus.common.ExperimentalApi}. The classes and APIs under {@link io.opencensus.metrics}
23 | * are likely to get backwards-incompatible updates in the future. DO NOT USE except for
24 | * experimental purposes.
25 | *
26 | * Please see
27 | * https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/Metrics.md and
28 | * https://github.com/census-instrumentation/opencensus-proto/blob/master/opencensus/proto/stats/metrics/metrics.proto
29 | * for more details.
30 | */
31 | @io.opencensus.common.ExperimentalApi
32 | package io.opencensus.metrics;
33 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/stats/StatsCollectionState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.stats;
18 |
19 | /**
20 | * State of the {@link StatsComponent}.
21 | *
22 | * @since 0.8
23 | */
24 | public enum StatsCollectionState {
25 |
26 | /**
27 | * State that fully enables stats collection.
28 | *
29 | * The {@link StatsComponent} collects stats for registered views.
30 | *
31 | * @since 0.8
32 | */
33 | ENABLED,
34 |
35 | /**
36 | * State that disables stats collection.
37 | *
38 | * The {@link StatsComponent} does not need to collect stats for registered views and may
39 | * return empty {@link ViewData}s from {@link ViewManager#getView(View.Name)}.
40 | *
41 | * @since 0.8
42 | */
43 | DISABLED
44 | }
45 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/stats/StatsRecorder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.stats;
18 |
19 | /**
20 | * Provides methods to record stats against tags.
21 | *
22 | * @since 0.8
23 | */
24 | public abstract class StatsRecorder {
25 | // TODO(sebright): Should we provide convenience methods for only recording one measure?
26 |
27 | /**
28 | * Returns an object for recording multiple measurements.
29 | *
30 | * @return an object for recording multiple measurements.
31 | * @since 0.8
32 | */
33 | public abstract MeasureMap newMeasureMap();
34 | }
35 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/stats/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /** API for stats recording. */
18 | // TODO: Add more details.
19 | // TODO: Add code examples.
20 | package io.opencensus.stats;
21 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/tags/InternalUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.tags;
18 |
19 | import java.util.Iterator;
20 |
21 | /**
22 | * Internal tagging utilities.
23 | *
24 | * @since 0.8
25 | */
26 | @io.opencensus.common.Internal
27 | public final class InternalUtils {
28 | private InternalUtils() {}
29 |
30 | /**
31 | * Internal tag accessor.
32 | *
33 | * @since 0.8
34 | */
35 | public static Iterator The {@link TagsComponent} can add tags to {@link TagContext}s, propagate {@code TagContext}s
32 | * in the current context, and serialize {@code TagContext}s.
33 | *
34 | * @since 0.8
35 | */
36 | ENABLED,
37 |
38 | /**
39 | * State that disables tagging.
40 | *
41 | * The {@link TagsComponent} may not add tags to {@link TagContext}s, propagate {@code
42 | * TagContext}s in the current context, or serialize {@code TagContext}s.
43 | *
44 | * @since 0.8
45 | */
46 | // TODO(sebright): Document how this interacts with stats collection.
47 | DISABLED
48 | }
49 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/tags/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * API for associating tags with scoped operations.
19 | *
20 | * This package manages a set of tags in the {@code io.grpc.Context}. The tags can be used to
21 | * label anything that is associated with a specific operation. For example, the {@code
22 | * io.opencensus.stats} package labels all stats with the current tags.
23 | *
24 | * {@link io.opencensus.tags.Tag Tags} are key-value pairs. The {@link io.opencensus.tags.TagKey
25 | * keys} and {@link io.opencensus.tags.TagValue values} are wrapped {@code String}s. They are stored
26 | * as a map in a {@link io.opencensus.tags.TagContext}.
27 | *
28 | * Note that tags are independent of the tracing data that is propagated in the {@code
29 | * io.grpc.Context}, such as trace ID.
30 | */
31 | // TODO(sebright): Add code examples.
32 | package io.opencensus.tags;
33 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/tags/propagation/TagContextDeserializationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.tags.propagation;
18 |
19 | import io.opencensus.tags.TagContext;
20 |
21 | /**
22 | * Exception thrown when a {@link TagContext} cannot be parsed.
23 | *
24 | * @since 0.8
25 | */
26 | public final class TagContextDeserializationException extends Exception {
27 | private static final long serialVersionUID = 0L;
28 |
29 | /**
30 | * Constructs a new {@code TagContextParseException} with the given message.
31 | *
32 | * @param message a message describing the error.
33 | * @since 0.8
34 | */
35 | public TagContextDeserializationException(String message) {
36 | super(message);
37 | }
38 |
39 | /**
40 | * Constructs a new {@code TagContextParseException} with the given message and cause.
41 | *
42 | * @param message a message describing the error.
43 | * @param cause the cause of the error.
44 | * @since 0.8
45 | */
46 | public TagContextDeserializationException(String message, Throwable cause) {
47 | super(message, cause);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/tags/propagation/TagContextSerializationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.tags.propagation;
18 |
19 | import io.opencensus.tags.TagContext;
20 |
21 | /**
22 | * Exception thrown when a {@link TagContext} cannot be serialized.
23 | *
24 | * @since 0.8
25 | */
26 | public final class TagContextSerializationException extends Exception {
27 | private static final long serialVersionUID = 0L;
28 |
29 | /**
30 | * Constructs a new {@code TagContextSerializationException} with the given message.
31 | *
32 | * @param message a message describing the error.
33 | * @since 0.8
34 | */
35 | public TagContextSerializationException(String message) {
36 | super(message);
37 | }
38 |
39 | /**
40 | * Constructs a new {@code TagContextSerializationException} with the given message and cause.
41 | *
42 | * @param message a message describing the error.
43 | * @param cause the cause of the error.
44 | * @since 0.8
45 | */
46 | public TagContextSerializationException(String message, Throwable cause) {
47 | super(message, cause);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/tags/propagation/TagPropagationComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.tags.propagation;
18 |
19 | import io.opencensus.tags.TagContext;
20 |
21 | /**
22 | * Object containing all supported {@link TagContext} propagation formats.
23 | *
24 | * @since 0.8
25 | */
26 | public abstract class TagPropagationComponent {
27 |
28 | /**
29 | * Returns the {@link TagContextBinarySerializer} for this implementation.
30 | *
31 | * @return the {@code TagContextBinarySerializer} for this implementation.
32 | * @since 0.8
33 | */
34 | public abstract TagContextBinarySerializer getBinarySerializer();
35 |
36 | /**
37 | * Returns the {@link TagContextTextFormat} for this implementation.
38 | *
39 | * OpenCensus uses W3C Correlation Context as the HTTP text format. For more details, see correlation-context.
41 | *
42 | * @return the {@code TagContextTextFormat} for this implementation.
43 | * @since 0.21
44 | */
45 | public abstract TagContextTextFormat getCorrelationContextFormat();
46 | }
47 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/BaseMessageEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.trace;
18 |
19 | /**
20 | * Superclass for {@link MessageEvent} and {@link NetworkEvent} to resolve API backward
21 | * compatibility issue.
22 | *
23 | * {@code SpanData.create} can't be overloaded with parameter types that differ only in the type
24 | * of the TimedEvent, because the signatures are the same after generic type erasure. {@code
25 | * BaseMessageEvent} allows the same method to accept both {@code TimedEvents This class should only be extended by {@code NetworkEvent} and {@code MessageEvent}.
29 | *
30 | * @deprecated This class is for internal use only.
31 | * @since 0.12
32 | */
33 | @Deprecated
34 | public abstract class BaseMessageEvent {
35 | // package protected to avoid users to extend it.
36 | BaseMessageEvent() {}
37 | }
38 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/ContextHandle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.trace;
18 |
19 | public interface ContextHandle {
20 |
21 | ContextHandle attach();
22 |
23 | void detach(ContextHandle contextHandle);
24 | }
25 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/ContextManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.trace;
18 |
19 | public interface ContextManager {
20 |
21 | ContextHandle currentContext();
22 |
23 | ContextHandle withValue(ContextHandle contextHandle, @javax.annotation.Nullable Span span);
24 |
25 | Span getValue(ContextHandle contextHandle);
26 | }
27 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * API for distributed tracing.
19 | *
20 | * Distributed tracing, also called distributed request tracing, is a technique that helps
21 | * debugging distributed applications.
22 | *
23 | * Trace represents a tree of spans. A trace has a root span that encapsulates all the spans from
24 | * start to end, and the children spans being the distinct calls invoked in between.
25 | *
26 | * {@link io.opencensus.trace.Span} represents a single operation within a trace.
27 | *
28 | * {@link io.opencensus.trace.Span Spans} are propagated in-process in the {@code
29 | * io.grpc.Context} and between process using one of the wire propagation formats supported in the
30 | * {@code io.opencensus.trace.propagation} package.
31 | */
32 | // TODO: Add code examples.
33 | package io.opencensus.trace;
34 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/propagation/SpanContextParseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.trace.propagation;
18 |
19 | /**
20 | * Exception thrown when a {@link io.opencensus.trace.SpanContext} cannot be parsed.
21 | *
22 | * @since 0.7
23 | */
24 | public final class SpanContextParseException extends Exception {
25 | private static final long serialVersionUID = 0L;
26 |
27 | /**
28 | * Constructs a new {@code SpanContextParseException} with the given message.
29 | *
30 | * @param message a message describing the parse error.
31 | * @since 0.7
32 | */
33 | public SpanContextParseException(String message) {
34 | super(message);
35 | }
36 |
37 | /**
38 | * Constructs a new {@code SpanContextParseException} with the given message and cause.
39 | *
40 | * @param message a message describing the parse error.
41 | * @param cause the cause of the parse error.
42 | * @since 0.7
43 | */
44 | public SpanContextParseException(String message, Throwable cause) {
45 | super(message, cause);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/trace/unsafe/ContextHandleImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.trace.unsafe;
18 |
19 | import io.grpc.Context;
20 | import io.opencensus.trace.ContextHandle;
21 |
22 | /** {@code ContextHandle} implementation using {@see io.grpc.Context}. */
23 | class ContextHandleImpl implements ContextHandle {
24 |
25 | private final Context context;
26 |
27 | public ContextHandleImpl(Context context) {
28 | this.context = context;
29 | }
30 |
31 | Context getContext() {
32 | return context;
33 | }
34 |
35 | @Override
36 | public ContextHandle attach() {
37 | return new ContextHandleImpl(context.attach());
38 | }
39 |
40 | @Override
41 | public void detach(ContextHandle contextHandle) {
42 | ContextHandleImpl impl = (ContextHandleImpl) contextHandle;
43 | context.detach(impl.context);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/api/src/test/java/io/opencensus/internal/StringUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.internal;
18 |
19 | import static org.junit.Assert.assertFalse;
20 | import static org.junit.Assert.assertTrue;
21 |
22 | import org.junit.Test;
23 | import org.junit.runner.RunWith;
24 | import org.junit.runners.JUnit4;
25 |
26 | /** Tests for {@link StringUtils}. */
27 | @RunWith(JUnit4.class)
28 | public final class StringUtilsTest {
29 |
30 | @Test
31 | public void isPrintableString() {
32 | assertTrue(StringUtils.isPrintableString("abcd"));
33 | assertFalse(StringUtils.isPrintableString("\2ab\3cd"));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/api/src/test/java/io/opencensus/metrics/MetricsComponentTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.metrics;
18 |
19 | import static com.google.common.truth.Truth.assertThat;
20 |
21 | import io.opencensus.metrics.export.ExportComponent;
22 | import org.junit.Test;
23 | import org.junit.runner.RunWith;
24 | import org.junit.runners.JUnit4;
25 |
26 | /** Unit tests for {@link MetricsComponent}. */
27 | @RunWith(JUnit4.class)
28 | public class MetricsComponentTest {
29 | @Test
30 | public void defaultExportComponent() {
31 | assertThat(MetricsComponent.newNoopMetricsComponent().getExportComponent())
32 | .isInstanceOf(ExportComponent.newNoopExportComponent().getClass());
33 | }
34 |
35 | @Test
36 | public void defaultMetricRegistry() {
37 | assertThat(MetricsComponent.newNoopMetricsComponent().getMetricRegistry())
38 | .isInstanceOf(MetricRegistry.newNoopMetricRegistry().getClass());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/api/src/test/java/io/opencensus/metrics/data/AttachmentValueTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.metrics.data;
18 |
19 | import static com.google.common.truth.Truth.assertThat;
20 |
21 | import io.opencensus.metrics.data.AttachmentValue.AttachmentValueString;
22 | import org.junit.Rule;
23 | import org.junit.Test;
24 | import org.junit.rules.ExpectedException;
25 | import org.junit.runner.RunWith;
26 | import org.junit.runners.JUnit4;
27 |
28 | /** Unit tests for {@link io.opencensus.metrics.data.AttachmentValue}. */
29 | @RunWith(JUnit4.class)
30 | public class AttachmentValueTest {
31 |
32 | @Rule public final ExpectedException thrown = ExpectedException.none();
33 |
34 | @Test
35 | public void getValue() {
36 | AttachmentValueString attachmentValue = AttachmentValueString.create("value");
37 | assertThat(attachmentValue.getValue()).isEqualTo("value");
38 | }
39 |
40 | @Test
41 | public void preventNullString() {
42 | thrown.expect(NullPointerException.class);
43 | AttachmentValueString.create(null);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/api/src/test/java/io/opencensus/metrics/export/ExportComponentTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.metrics.export;
18 |
19 | import static com.google.common.truth.Truth.assertThat;
20 |
21 | import org.junit.Test;
22 | import org.junit.runner.RunWith;
23 | import org.junit.runners.JUnit4;
24 |
25 | /** Unit tests for {@link ExportComponent}. */
26 | @RunWith(JUnit4.class)
27 | public class ExportComponentTest {
28 | @Test
29 | public void defaultMetricExporter() {
30 | assertThat(ExportComponent.newNoopExportComponent().getMetricProducerManager())
31 | .isInstanceOf(MetricProducerManager.class);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/api/src/test/java/io/opencensus/tags/InternalUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.tags;
18 |
19 | import static com.google.common.truth.Truth.assertThat;
20 |
21 | import com.google.common.collect.Lists;
22 | import java.util.Iterator;
23 | import org.junit.Test;
24 | import org.junit.runner.RunWith;
25 | import org.junit.runners.JUnit4;
26 |
27 | /** Unit tests for {@link InternalUtils}. */
28 | @RunWith(JUnit4.class)
29 | public final class InternalUtilsTest {
30 |
31 | @Test
32 | public void getTags() {
33 | final Iterator NB: Do not add direct dependencies on classes that are not loaded by the bootstrap
24 | * classloader. Keep this package small.
25 | */
26 |
--------------------------------------------------------------------------------
/contrib/agent/src/main/java/io/opencensus/contrib/agent/deps/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.contrib.agent.deps;
18 |
19 | /**
20 | * Contains third party packages, such as Byte Buddy, Guava, etc., relocated here by the build
21 | * process to avoid any conflicts of the agent's classes with the app's classes, which are loaded by
22 | * the same classloader (the system classloader).
23 | */
24 |
--------------------------------------------------------------------------------
/contrib/agent/src/main/java/io/opencensus/contrib/agent/instrumentation/ContextTrampolineInitializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.contrib.agent.instrumentation;
18 |
19 | import com.google.auto.service.AutoService;
20 | import io.opencensus.contrib.agent.Settings;
21 | import io.opencensus.contrib.agent.bootstrap.ContextStrategy;
22 | import io.opencensus.contrib.agent.bootstrap.ContextTrampoline;
23 | import net.bytebuddy.agent.builder.AgentBuilder;
24 |
25 | /**
26 | * Initializes the {@link ContextTrampoline} with a concrete {@link ContextStrategy}.
27 | *
28 | * @since 0.9
29 | */
30 | @AutoService(Instrumenter.class)
31 | public final class ContextTrampolineInitializer implements Instrumenter {
32 |
33 | @Override
34 | public AgentBuilder instrument(AgentBuilder agentBuilder, Settings settings) {
35 | // TODO(stschmidt): Gracefully handle the case of missing io.grpc.Context at runtime,
36 | // maybe load the missing classes from a JAR that comes with the agent JAR.
37 | ContextTrampoline.setContextStrategy(new ContextStrategyImpl());
38 |
39 | return agentBuilder;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/contrib/agent/src/main/java/io/opencensus/contrib/agent/instrumentation/Instrumenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.contrib.agent.instrumentation;
18 |
19 | import io.opencensus.contrib.agent.Settings;
20 | import net.bytebuddy.agent.builder.AgentBuilder;
21 |
22 | /**
23 | * Interface for plug-ins that add bytecode instrumentation.
24 | *
25 | * @since 0.6
26 | */
27 | public interface Instrumenter {
28 |
29 | /**
30 | * Adds bytecode instrumentation to the given {@link AgentBuilder}.
31 | *
32 | * @param agentBuilder an {@link AgentBuilder} object to which the additional instrumentation is
33 | * added
34 | * @param settings the configuration settings
35 | * @return an {@link AgentBuilder} object having the additional instrumentation
36 | * @since 0.10
37 | */
38 | AgentBuilder instrument(AgentBuilder agentBuilder, Settings settings);
39 | }
40 |
--------------------------------------------------------------------------------
/contrib/agent/src/main/java/io/opencensus/contrib/agent/instrumentation/TraceTrampolineInitializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.contrib.agent.instrumentation;
18 |
19 | import com.google.auto.service.AutoService;
20 | import io.opencensus.contrib.agent.Settings;
21 | import io.opencensus.contrib.agent.bootstrap.TraceStrategy;
22 | import io.opencensus.contrib.agent.bootstrap.TraceTrampoline;
23 | import net.bytebuddy.agent.builder.AgentBuilder;
24 |
25 | /**
26 | * Initializes the {@link TraceTrampoline} with a concrete {@link TraceStrategy}.
27 | *
28 | * @since 0.9
29 | */
30 | @AutoService(Instrumenter.class)
31 | public final class TraceTrampolineInitializer implements Instrumenter {
32 |
33 | @Override
34 | public AgentBuilder instrument(AgentBuilder agentBuilder, Settings settings) {
35 | // TODO(stschmidt): Gracefully handle the case of missing trace API at runtime,
36 | // maybe load the missing classes from a JAR that comes with the agent JAR.
37 | TraceTrampoline.setTraceStrategy(new TraceStrategyImpl());
38 |
39 | return agentBuilder;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/contrib/agent/src/main/resources/reference.conf:
--------------------------------------------------------------------------------
1 | # Reference configuration for the OpenCensus Agent for Java.
2 |
3 | opencensus.contrib.agent {
4 |
5 | # Configuration settings related to automatic context propagation.
6 | context-propagation {
7 |
8 | # Enable/disable automatic context propagation for Executors.
9 | executor.enabled = true
10 |
11 | # Enable/disable automatic context propagation for Threads.
12 | thread.enabled = true
13 | }
14 |
15 | # The "trace" section configures which Java methods the agent instruments for
16 | # tracing.
17 | trace {
18 |
19 | java.net.URL.getContent {
20 | enabled = true
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/contrib/agent/src/test/resources/io/opencensus/contrib/agent/some_resource.txt:
--------------------------------------------------------------------------------
1 | A resource!
--------------------------------------------------------------------------------
/contrib/appengine_standard_util/README.md:
--------------------------------------------------------------------------------
1 | # OpenCensus AppEngine Standard Util
2 | [![Build Status][travis-image]][travis-url]
3 | [![Windows Build Status][appveyor-image]][appveyor-url]
4 | [![Maven Central][maven-image]][maven-url]
5 |
6 | The *OpenCensus AppEngine Standard Util for Java* is a collection of utilities for trace
7 | instrumentation when working with [AppEngine][appengine-url].
8 |
9 | ## Quickstart
10 |
11 | ### Add the dependencies to your project
12 |
13 | For Maven add to your `pom.xml`:
14 | ```xml
15 | By default, the name of the method will be used for the span name. However, the span name can
28 | * be explicitly set via the name interface.
29 | *
30 | * @since 0.16.0
31 | */
32 | @Target(ElementType.METHOD)
33 | @Retention(RetentionPolicy.RUNTIME)
34 | public @interface Traced {
35 |
36 | /**
37 | * The optional custom span name.
38 | *
39 | * @return the optional custom span name; if not specified the method name will be used as the
40 | * span name
41 | */
42 | String name() default "";
43 | }
44 |
--------------------------------------------------------------------------------
/contrib/spring/src/main/resources/META-INF/additional-spring-configuration-metadata.json:
--------------------------------------------------------------------------------
1 | {"properties": [
2 | {
3 | "name": "opencensus.spring.enabled",
4 | "type": "java.lang.Boolean",
5 | "description": "Enable Spring Integration Opencensus Instrumentation.",
6 | "defaultValue": true
7 | }
8 | ]}
--------------------------------------------------------------------------------
/contrib/spring/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | # Auto Configuration
2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
3 | io.opencensus.contrib.spring.autoconfig.OpenCensusAutoConfiguration,\
4 | io.opencensus.contrib.spring.autoconfig.TraceWebAsyncClientAutoConfiguration
5 |
--------------------------------------------------------------------------------
/contrib/spring/src/test/java/io/opencensus/contrib/spring/aop/Sample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.contrib.spring.aop;
18 |
19 | import java.sql.SQLException;
20 |
21 | public class Sample {
22 | @Traced()
23 | void example1() {
24 | // do work
25 | }
26 |
27 | @Traced(name = "custom-span-name")
28 | void example2() {
29 | // do moar work
30 | }
31 |
32 | @Traced()
33 | void call(long delay) throws Exception {
34 | Thread.sleep(delay);
35 | }
36 |
37 | @Traced(name = "blah")
38 | void custom(long delay) throws Exception {
39 | Thread.sleep(delay);
40 | }
41 |
42 | @Traced()
43 | void boom() throws Exception {
44 | throw new Exception("boom");
45 | }
46 |
47 | public void execute(String sql) throws SQLException {}
48 |
49 | public void executeQuery(String sql) throws SQLException {}
50 |
51 | public void executeUpdate(String sql) throws SQLException {}
52 |
53 | public void executeLargeUpdate(String sql) throws SQLException {}
54 | }
55 |
--------------------------------------------------------------------------------
/contrib/spring/src/test/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | # Auto Configuration
2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
3 | io.opencensus.contrib.spring.autoconfig.OpenCensusAutoConfiguration,\
4 | io.opencensus.contrib.spring.autoconfig.TraceWebAsyncClientAutoConfiguration
--------------------------------------------------------------------------------
/contrib/spring/src/test/resources/beans/HttpServletFilterIntegrationTest-context.xml:
--------------------------------------------------------------------------------
1 | WARNING: Currently all the public classes under this package are marked as {@link
22 | * io.opencensus.common.ExperimentalApi}. The classes and APIs under {@link
23 | * io.opencensus.exporter.metrics.ocagent} are likely to get backwards-incompatible updates in the
24 | * future. DO NOT USE except for experimental purposes.
25 | *
26 | * See more details on
27 | * https://github.com/census-instrumentation/opencensus-proto/tree/master/src/opencensus/proto/agent.
28 | */
29 | @io.opencensus.common.ExperimentalApi
30 | package io.opencensus.exporter.metrics.ocagent;
31 |
--------------------------------------------------------------------------------
/exporters/metrics/util/README.md:
--------------------------------------------------------------------------------
1 | # OpenCensus Java Metrics Exporter Util
2 |
3 | The *OpenCensus Metrics Exporter Util* is the Java helper package for all metrics exporters.
4 |
5 | ## Quickstart
6 |
7 | ### Add the dependencies to your project
8 |
9 | For Maven add to your `pom.xml`:
10 | ```xml
11 | WARNING: Currently all the public classes under this package are marked as {@link
21 | * io.opencensus.common.ExperimentalApi}. The classes and APIs under {@link
22 | * io.opencensus.exporter.trace.ocagent} are likely to get backwards-incompatible updates in the
23 | * future. DO NOT USE except for experimental purposes.
24 | *
25 | * See more details on
26 | * https://github.com/census-instrumentation/opencensus-proto/tree/master/src/opencensus/proto/agent.
27 | */
28 | @io.opencensus.common.ExperimentalApi
29 | package io.opencensus.exporter.trace.ocagent;
30 |
--------------------------------------------------------------------------------
/exporters/trace/stackdriver/build.gradle:
--------------------------------------------------------------------------------
1 | description = 'OpenCensus Trace Stackdriver Exporter'
2 |
3 | [compileJava, compileTestJava].each() {
4 | it.sourceCompatibility = 1.7
5 | it.targetCompatibility = 1.7
6 | }
7 |
8 | dependencies {
9 | compileOnly libraries.auto_value
10 |
11 | compile project(':opencensus-api'),
12 | project(':opencensus-contrib-resource-util'),
13 | libraries.google_auth,
14 | libraries.grpc_auth,
15 | libraries.grpc_core,
16 | libraries.grpc_netty_shaded,
17 | libraries.grpc_stub,
18 | libraries.guava
19 |
20 | compile (libraries.google_cloud_trace) {
21 | // Prefer library version.
22 | exclude group: 'com.google.guava', module: 'guava'
23 |
24 | // Prefer library version.
25 | exclude group: 'com.google.code.findbugs', module: 'jsr305'
26 |
27 | // Prefer library version.
28 | exclude group: 'io.grpc', module: 'grpc-auth'
29 | exclude group: 'io.grpc', module: 'grpc-core'
30 | exclude group: 'io.grpc', module: 'grpc-netty-shaded'
31 | exclude group: 'io.grpc', module: 'grpc-stub'
32 |
33 | // We will always be more up to date.
34 | exclude group: 'io.opencensus', module: 'opencensus-api'
35 | }
36 |
37 | signature "org.codehaus.mojo.signature:java17:1.0@signature"
38 | signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
39 | }
40 |
--------------------------------------------------------------------------------
/exporters/trace/util/README.md:
--------------------------------------------------------------------------------
1 | # OpenCensus Java Trace Exporter Util
2 |
3 | The *OpenCensus Trace Exporter Util* is the Java helper package for all trace exporters.
4 |
5 | ## Quickstart
6 |
7 | ### Add the dependencies to your project
8 |
9 | For Maven add to your `pom.xml`:
10 | ```xml
11 | Implementation can have a per thread instance or a single global instance.
27 | */
28 | @ThreadSafe
29 | public abstract class RandomHandler {
30 | /**
31 | * Returns the current {@link Random}.
32 | *
33 | * @return the current {@code Random}.
34 | */
35 | public abstract Random current();
36 |
37 | /** Implementation of the {@link RandomHandler} using {@link SecureRandom}. */
38 | @ThreadSafe
39 | public static final class SecureRandomHandler extends RandomHandler {
40 | private final Random random = new SecureRandom();
41 |
42 | /** Constructs a new {@link SecureRandomHandler}. */
43 | public SecureRandomHandler() {}
44 |
45 | @Override
46 | public Random current() {
47 | return random;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/impl_core/src/main/java/io/opencensus/implcore/trace/propagation/PropagationComponentImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.implcore.trace.propagation;
18 |
19 | import io.opencensus.trace.propagation.BinaryFormat;
20 | import io.opencensus.trace.propagation.PropagationComponent;
21 | import io.opencensus.trace.propagation.TextFormat;
22 |
23 | /** Implementation of the {@link PropagationComponent}. */
24 | public class PropagationComponentImpl extends PropagationComponent {
25 | private final BinaryFormat binaryFormat = new BinaryFormatImpl();
26 | private final TextFormat b3Format = new B3Format();
27 | private final TextFormat traceContextFormat = new TraceContextFormat();
28 |
29 | @Override
30 | public BinaryFormat getBinaryFormat() {
31 | return binaryFormat;
32 | }
33 |
34 | @Override
35 | public TextFormat getB3Format() {
36 | return b3Format;
37 | }
38 |
39 | @Override
40 | public TextFormat getTraceContextFormat() {
41 | return traceContextFormat;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/impl_core/src/test/java/io/opencensus/implcore/internal/UtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.implcore.internal;
18 |
19 | import java.util.Arrays;
20 | import java.util.List;
21 | import org.junit.Rule;
22 | import org.junit.Test;
23 | import org.junit.rules.ExpectedException;
24 | import org.junit.runner.RunWith;
25 | import org.junit.runners.JUnit4;
26 |
27 | /** Unit tests for {@link Utils}. */
28 | @RunWith(JUnit4.class)
29 | public class UtilsTest {
30 | @Rule public ExpectedException thrown = ExpectedException.none();
31 |
32 | @Test
33 | public void checkListElementNull() {
34 | List
30 | * try (NonThrowingAutoCloseable ctx = tryEnter()) {
31 | * ...
32 | * }
33 | *
34 | *
35 | * @deprecated {@link Scope} is a better match for operations involving the current context.
36 | * @since 0.5
37 | */
38 | @Deprecated
39 | public interface NonThrowingCloseable extends Closeable {
40 | @Override
41 | void close();
42 | }
43 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-17, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | /**
20 | * Class holder for all common constants (such as the version) for the OpenCensus Java library.
21 | *
22 | * @since 0.8
23 | */
24 | @ExperimentalApi
25 | public final class OpenCensusLibraryInformation {
26 |
27 | /**
28 | * The current version of the OpenCensus Java library.
29 | *
30 | * @since 0.8
31 | */
32 | public static final String VERSION = "0.32.0-SNAPSHOT"; // CURRENT_OPENCENSUS_VERSION
33 |
34 | private OpenCensusLibraryInformation() {}
35 | }
36 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/Scope.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | /**
20 | * A {@link java.io.Closeable} that represents a change to the current context over a scope of code.
21 | * {@link Scope#close} cannot throw a checked exception.
22 | *
23 | *
26 | * try (Scope ctx = tryEnter()) {
27 | * ...
28 | * }
29 | *
30 | *
31 | * @since 0.6
32 | */
33 | @SuppressWarnings("deprecation")
34 | public interface Scope extends NonThrowingCloseable {
35 | @Override
36 | void close();
37 | }
38 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/ServerStatsDeserializationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | /**
20 | * Exception thrown when a {@link ServerStats} cannot be parsed.
21 | *
22 | * @since 0.16
23 | */
24 | public final class ServerStatsDeserializationException extends Exception {
25 | private static final long serialVersionUID = 0L;
26 |
27 | /**
28 | * Constructs a new {@code ServerStatsDeserializationException} with the given message.
29 | *
30 | * @param message a message describing the error.
31 | * @since 0.16
32 | */
33 | public ServerStatsDeserializationException(String message) {
34 | super(message);
35 | }
36 |
37 | /**
38 | * Constructs a new {@code ServerStatsDeserializationException} with the given message and cause.
39 | *
40 | * @param message a message describing the error.
41 | * @param cause the cause of the error.
42 | * @since 0.16
43 | */
44 | public ServerStatsDeserializationException(String message, Throwable cause) {
45 | super(message, cause);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/api/src/main/java/io/opencensus/common/ToDoubleFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018, OpenCensus Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package io.opencensus.common;
18 |
19 | /*>>>
20 | import org.checkerframework.checker.nullness.qual.Nullable;
21 | */
22 |
23 | /**
24 | * Represents a function that produces a double-valued result. See {@link
25 | * io.opencensus.metrics.MetricRegistry} for an example of its use.
26 | *
27 | *