├── aws-xray ├── gradle.properties ├── src │ ├── test │ │ └── resources │ │ │ ├── mockito-extensions │ │ │ └── org.mockito.plugins.MockMaker │ │ │ ├── test-sampling-targets-response.json │ │ │ ├── sampling-rule-sample-all.json │ │ │ ├── get-sampling-targets-request.json │ │ │ ├── sampling-rule-awslambda.json │ │ │ ├── sampling-rule-wildcards.json │ │ │ ├── sampling-rule-exactmatch.json │ │ │ ├── sampling-rule-reservoir.json │ │ │ ├── get-sampling-targets-response.json │ │ │ └── sampling-rule-boost.json │ ├── awsTest │ │ └── resources │ │ │ └── otel-collector.yml │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── awsxray │ │ ├── package-info.java │ │ └── GetSamplingRulesRequest.java └── README.md ├── jmx-metrics └── src │ ├── test │ └── resources │ │ ├── jmxremote.password │ │ └── all.properties │ ├── integrationTest │ └── resources │ │ ├── cassandra │ │ └── jmxremote.password │ │ ├── target-systems │ │ ├── wildfly.properties │ │ ├── kafka-producer.sh │ │ ├── solr.properties │ │ ├── hbase.properties │ │ ├── jetty.properties │ │ ├── hadoop.properties │ │ ├── activemq.properties │ │ ├── jvm.properties │ │ ├── kafka.properties │ │ ├── tomcat.properties │ │ ├── cassandra.properties │ │ ├── jvm-and-kafka.properties │ │ ├── kafka-consumer.properties │ │ └── kafka-producer.properties │ │ ├── otlp_config.properties │ │ ├── activemq │ │ └── Dockerfile │ │ ├── wildfly │ │ └── start.sh │ │ ├── hadoop │ │ └── yarn-site.xml │ │ ├── hbase │ │ └── hbase-env.sh │ │ └── script.groovy │ └── main │ ├── groovy │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jmxmetrics │ │ └── ConfigurationException.java │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── jmxmetrics │ └── InstrumentDescriptor.java ├── .gitattributes ├── aws-resources ├── src │ ├── test │ │ └── resources │ │ │ ├── mockito-extensions │ │ │ └── org.mockito.plugins.MockMaker │ │ │ └── declarative-config.yaml │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── aws │ │ └── resource │ │ ├── package-info.java │ │ ├── Ec2ResourceProvider.java │ │ ├── EcsResourceProvider.java │ │ ├── EksResourceProvider.java │ │ ├── LambdaResourceProvider.java │ │ ├── BeanstalkResourceProvider.java │ │ └── CloudResourceProvider.java ├── gradle.properties └── README.md ├── cel-sampler ├── src │ ├── test │ │ └── resources │ │ │ ├── invalid │ │ │ ├── missing-expressions.yaml │ │ │ ├── empty-expressions.yaml │ │ │ ├── missing-expression.yaml │ │ │ ├── missing-fallback-sampler.yaml │ │ │ ├── missing-action.yaml │ │ │ ├── empty-expression-value.yaml │ │ │ ├── invalid-action.yaml │ │ │ ├── invalid-fallback-sampler.yaml │ │ │ └── invalid-cel-expression.yaml │ │ │ ├── valid │ │ │ ├── drop-client-spans.yaml │ │ │ ├── record-specific-path.yaml │ │ │ └── multiple-drop-expressions.yaml │ │ │ └── cel-sampler-config.yaml │ └── main │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider └── build.gradle.kts ├── maven-extension ├── src │ ├── test │ │ ├── resources │ │ │ ├── projects │ │ │ │ ├── springboot_1 │ │ │ │ │ └── src │ │ │ │ │ │ ├── main │ │ │ │ │ │ ├── resources │ │ │ │ │ │ │ └── application.properties │ │ │ │ │ │ └── java │ │ │ │ │ │ │ └── io │ │ │ │ │ │ │ └── opentelemetry │ │ │ │ │ │ │ └── contrib │ │ │ │ │ │ │ └── maven │ │ │ │ │ │ │ └── test │ │ │ │ │ │ │ └── springboot │ │ │ │ │ │ │ └── SpringbootTestApplication.java │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── io │ │ │ │ │ │ └── opentelemetry │ │ │ │ │ │ └── contrib │ │ │ │ │ │ └── maven │ │ │ │ │ │ └── test │ │ │ │ │ │ └── springboot │ │ │ │ │ │ └── SpringbootTestApplicationTests.java │ │ │ │ ├── springboot_2 │ │ │ │ │ └── src │ │ │ │ │ │ ├── main │ │ │ │ │ │ ├── resources │ │ │ │ │ │ │ └── application.properties │ │ │ │ │ │ └── java │ │ │ │ │ │ │ └── io │ │ │ │ │ │ │ └── opentelemetry │ │ │ │ │ │ │ └── contrib │ │ │ │ │ │ │ └── maven │ │ │ │ │ │ │ └── test │ │ │ │ │ │ │ └── springboot │ │ │ │ │ │ │ └── SpringbootTestApplication.java │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── io │ │ │ │ │ │ └── opentelemetry │ │ │ │ │ │ └── contrib │ │ │ │ │ │ └── maven │ │ │ │ │ │ └── test │ │ │ │ │ │ └── springboot │ │ │ │ │ │ └── SpringbootTestApplicationTests.java │ │ │ │ ├── jar │ │ │ │ │ └── pom.xml │ │ │ │ └── snyk_1 │ │ │ │ │ └── pom.xml │ │ │ └── declarative-config.yaml │ │ └── java │ │ │ └── io │ │ │ └── opentelemetry │ │ │ └── maven │ │ │ ├── resources │ │ │ └── MavenResourceProviderTest.java │ │ │ ├── AutoConfigureUtil2Test.java │ │ │ ├── handler │ │ │ └── MojoGoalExecutionHandlerConfigurationTest.java │ │ │ └── MavenUtilsTests.java │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ ├── services │ │ │ ├── io.opentelemetry.maven.handler.MojoGoalExecutionHandler │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ │ ├── sisu │ │ │ └── javax.inject.Named │ │ │ └── maven │ │ │ └── extension.xml │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── maven │ │ ├── handler │ │ ├── package-info.java │ │ └── MojoGoalExecutionHandler.java │ │ ├── package-info.java │ │ ├── resources │ │ ├── package-info.java │ │ └── MavenResourceDetector.java │ │ ├── ToUpperCaseTextMapGetter.java │ │ ├── MavenGoal.java │ │ └── StringUtils.java └── docs │ └── images │ ├── maven-execution-trace-jaeger.png │ └── jenkins-maven-execution-trace-jaeger.png ├── gcp-auth-extension ├── src │ └── test │ │ ├── resources │ │ ├── mockito-extensions │ │ │ └── org.mockito.plugins.MockMaker │ │ └── fake_user_creds.json │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── gcp │ │ └── auth │ │ └── springapp │ │ ├── Application.java │ │ └── Controller.java └── gradle.properties ├── gcp-resources ├── gradle.properties └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── gcp │ │ └── resource │ │ └── internal │ │ └── GcpResourceDetector.java │ └── test │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── gcp │ └── resource │ └── ResourceComponentProviderTest.java ├── aws-xray-propagator ├── gradle.properties ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── awsxray │ │ └── propagator │ │ ├── package-info.java │ │ └── internal │ │ ├── AwsXrayComponentProvider.java │ │ ├── AwsXrayLambdaComponentProvider.java │ │ ├── AwsConfigurablePropagator.java │ │ └── AwsXrayLambdaConfigurablePropagator.java ├── README.md └── build.gradle.kts ├── baggage-processor └── gradle.properties ├── config └── license │ └── spotless.license.java ├── .github ├── scripts │ ├── get-version.sh │ ├── use-cla-approved-bot.sh │ ├── package.json │ └── update-version.sh ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── config.yml ├── workflows │ ├── fossa.yml │ ├── gradle-wrapper-validation.yml │ ├── build.yml │ ├── reusable-markdown-lint.yml │ ├── assign-reviewers.yml │ ├── issue-management-feedback-label.yml │ ├── build-pull-request.yml │ └── reusable-link-check.yml ├── config │ ├── lychee.toml │ └── .markdownlint-cli2.yaml └── pull_request_template.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── disk-buffering ├── assets │ ├── reading-flow.png │ └── writing-flow.png └── src │ ├── main │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── disk │ │ └── buffering │ │ ├── exporters │ │ ├── package-info.java │ │ └── callback │ │ │ ├── NoopExporterCallback.java │ │ │ └── ExporterCallback.java │ │ ├── internal │ │ ├── storage │ │ │ ├── responses │ │ │ │ ├── WritableResult.java │ │ │ │ └── ReadableResult.java │ │ │ ├── files │ │ │ │ ├── FileOperations.java │ │ │ │ └── reader │ │ │ │ │ └── StreamReader.java │ │ │ └── util │ │ │ │ └── ClockBuddy.java │ │ └── serialization │ │ │ ├── deserializers │ │ │ ├── DeserializationException.java │ │ │ └── SignalDeserializer.java │ │ │ ├── mapping │ │ │ └── common │ │ │ │ └── ByteStringMapper.java │ │ │ └── serializers │ │ │ └── SignalSerializer.java │ │ └── storage │ │ └── result │ │ ├── DefaultWriteResult.java │ │ └── WriteResult.java │ └── test │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── disk │ └── buffering │ └── internal │ └── serialization │ └── serializers │ └── ByteArraySerializer.java ├── noop-api ├── src │ └── main │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── io.opentelemetry.context.ContextStorageProvider ├── build.gradle.kts └── README.md ├── inferred-spans └── src │ ├── test │ ├── resources │ │ ├── recording.jfr │ │ └── logging.properties │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── inferredspans │ │ └── internal │ │ ├── util │ │ ├── DisabledOnOpenJ9.java │ │ └── AutoConfigTestProperties.java │ │ └── FixedClock.java │ └── main │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── inferredspans │ └── internal │ ├── pooling │ ├── Recyclable.java │ ├── Allocator.java │ └── Resetter.java │ └── semconv │ └── Attributes.java ├── docs └── apidiffs │ ├── 1.50.0_vs_1.49.0 │ └── opentelemetry-aws-xray.txt │ └── current_vs_latest │ └── opentelemetry-aws-xray.txt ├── ibm-mq-metrics ├── templates │ └── registry │ │ ├── yaml │ │ └── weaver.yaml │ │ ├── markdown │ │ ├── weaver.yaml │ │ ├── metric_macros.j2 │ │ ├── metrics.md.j2 │ │ ├── requirement.j2 │ │ ├── event_macros.j2 │ │ ├── metric_table.j2 │ │ ├── resource_macros.j2 │ │ ├── sampling_macros.j2 │ │ ├── notes.j2 │ │ ├── stability.j2 │ │ └── examples_macros.j2 │ │ └── java │ │ ├── weaver.yaml │ │ └── IbmMqAttributes.java.j2 ├── model │ └── registry_manifest.yaml ├── src │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── ibm │ │ └── mq │ │ ├── metricscollector │ │ ├── FilterType.java │ │ ├── QueueCollectorSharedState.java │ │ └── TopicMetricsCollector.java │ │ └── config │ │ └── ResourceFilters.java └── weaver.Dockerfile ├── azure-resources └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── azure │ │ └── resource │ │ └── CloudResourceProvider.java │ └── test │ └── resources │ └── declarative-config.yaml ├── samplers ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── sampler │ │ └── LinksParentAlwaysOnSamplerProvider.java └── build.gradle.kts ├── cloudfoundry-resources └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── cloudfoundry │ │ └── resources │ │ ├── CloudFoundryResourceProvider.java │ │ └── CloudFoundryResourceDetector.java │ └── test │ └── resources │ ├── declarative-config.yaml │ └── vcap_application.json ├── compressors └── compressor-zstd │ ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── io.opentelemetry.exporter.internal.compression.CompressorProvider │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── compressor │ │ └── zstd │ │ ├── ZstdCompressorProvider.java │ │ └── ZstdCompressor.java │ └── build.gradle.kts ├── processors ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ ├── interceptor │ │ └── common │ │ │ └── ComposableInterceptor.java │ │ └── filter │ │ └── FilteringLogRecordProcessor.java └── build.gradle.kts ├── consistent-sampling ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider │ │ └── java │ │ │ └── io │ │ │ └── opentelemetry │ │ │ └── contrib │ │ │ └── sampler │ │ │ ├── consistent │ │ │ ├── RValueGenerators.java │ │ │ ├── ConsistentAlwaysOnSampler.java │ │ │ ├── ConsistentAlwaysOffSampler.java │ │ │ └── ParentBasedConsistentProbabilitySamplerProvider.java │ │ │ └── consistent56 │ │ │ ├── RandomValueGenerator.java │ │ │ ├── RandomValueGenerators.java │ │ │ ├── PredicatedSampler.java │ │ │ └── ConsistentFixedThresholdSampler.java │ └── test │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── sampler │ │ └── consistent56 │ │ ├── RandomValueGeneratorsTest.java │ │ ├── TestUtil.java │ │ ├── ConsistentAlwaysOnSamplerTest.java │ │ └── ConsistentAlwaysOffSamplerTest.java └── build.gradle.kts ├── jmx-scraper ├── test-app │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jmxscraper │ │ └── testapp │ │ └── TestAppMxBean.java ├── test-webapp │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ └── main │ │ ├── webapp │ │ └── WEB-INF │ │ │ └── web.xml │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jmxscraper │ │ └── testwebapp │ │ └── SimpleServlet.java └── src │ ├── integrationTest │ ├── resources │ │ └── custom-metrics.yaml │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jmxscraper │ │ └── assertions │ │ └── Assertions.java │ ├── test │ ├── resources │ │ ├── fake-test-system-both.yaml │ │ ├── jmx │ │ │ └── rules │ │ │ │ ├── fake-test-system-both.yaml │ │ │ │ └── fake-test-system-instrumentation-only.yaml │ │ ├── fake-test-system-legacy-only.yaml │ │ └── validConfig.properties │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jmxscraper │ │ └── config │ │ ├── TestUtil.java │ │ └── PropertiesSupplierTest.java │ └── main │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── jmxscraper │ ├── InvalidArgumentException.java │ └── config │ └── PropertiesSupplier.java ├── .fossa.yml ├── micrometer-meter-provider └── src │ ├── main │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── metrics │ │ └── micrometer │ │ ├── internal │ │ ├── state │ │ │ └── package-info.java │ │ ├── instruments │ │ │ └── package-info.java │ │ └── Constants.java │ │ ├── package-info.java │ │ └── CallbackRegistrar.java │ └── test │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── metrics │ └── micrometer │ ├── TestCallbackRegistrar.java │ └── internal │ └── instruments │ └── RandomUtils.java ├── version.gradle.kts ├── .clomonitor.yml ├── jfr-connection ├── src │ ├── test │ │ └── resources │ │ │ ├── brokenJfcFile.jfc │ │ │ └── sampleJfcFile.jfc │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jfr │ │ └── connection │ │ └── package-info.java └── build.gradle.kts ├── opamp-client └── src │ ├── main │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── opamp │ │ └── client │ │ └── internal │ │ ├── package-info.java │ │ ├── connectivity │ │ └── http │ │ │ ├── package-info.java │ │ │ ├── HttpErrorException.java │ │ │ └── HttpSender.java │ │ ├── request │ │ ├── delay │ │ │ ├── PeriodicDelay.java │ │ │ ├── FixedPeriodicDelay.java │ │ │ └── AcceptsDelaySuggestion.java │ │ ├── Request.java │ │ ├── Field.java │ │ └── service │ │ │ └── DaemonThreadFactory.java │ │ ├── response │ │ ├── Response.java │ │ ├── OpampServerResponseException.java │ │ └── MessageData.java │ │ ├── tools │ │ └── SystemTime.java │ │ ├── impl │ │ └── recipe │ │ │ ├── RequestRecipe.java │ │ │ └── appenders │ │ │ ├── AgentToServerAppender.java │ │ │ ├── AgentDisconnectAppender.java │ │ │ ├── FlagsAppender.java │ │ │ ├── CapabilitiesAppender.java │ │ │ ├── SequenceNumberAppender.java │ │ │ ├── InstanceUidAppender.java │ │ │ ├── AgentDescriptionAppender.java │ │ │ └── EffectiveConfigAppender.java │ │ └── state │ │ └── InMemoryState.java │ └── test │ └── java │ └── io │ └── opentelemetry │ └── opamp │ └── client │ └── internal │ └── request │ ├── service │ └── PeriodicDelayWithSuggestion.java │ └── delay │ └── ExponentialBackoffPeriodicDelayTest.java ├── .mise └── tasks │ └── lint │ ├── links.sh │ ├── local-links.sh │ └── markdown.sh ├── runtime-attach ├── runtime-attach-core │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── attach │ │ └── core │ │ └── RuntimeAttachException.java └── runtime-attach │ └── src │ ├── test │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── attach │ │ ├── AbstractAttachmentTest.java │ │ ├── RunTimeAttachBasicTest.java │ │ ├── AgentDisabledBySystemPropertyTest.java │ │ └── AgentDisabledByEnvironmentVariableTest.java │ └── main │ └── java │ └── io │ └── opentelemetry │ └── contrib │ └── attach │ └── RuntimeAttach.java ├── gradle.properties ├── mise.toml ├── .markdownlint.yaml ├── jfr-events ├── src │ └── main │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── jfrevent │ │ ├── package-info.java │ │ ├── ScopeEvent.java │ │ └── JfrContextStorageWrapper.java ├── build.gradle.kts └── README.md ├── resource-providers ├── src │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── opentelemetry │ │ │ └── contrib │ │ │ └── resourceproviders │ │ │ ├── ResourceLocator.java │ │ │ ├── ServiceNameDetector.java │ │ │ ├── AppServerResourceDetector.java │ │ │ └── WebSphereAppServer.java │ └── test │ │ └── java │ │ └── io │ │ └── opentelemetry │ │ └── contrib │ │ └── resourceproviders │ │ └── ResourceComponentProviderTest.java └── build.gradle.kts ├── prometheus-client-bridge ├── build.gradle.kts └── README.md ├── dynamic-control └── README.md ├── .gitignore └── kafka-exporter ├── README.md └── src ├── main └── java │ └── io │ └── opentelemetry │ └── contrib │ └── kafka │ └── SpanDataDeserializer.java └── test └── java └── io └── opentelemetry └── contrib └── kafka └── TestUtil.java /aws-xray/gradle.properties: -------------------------------------------------------------------------------- 1 | otel.stable=true 2 | -------------------------------------------------------------------------------- /jmx-metrics/src/test/resources/jmxremote.password: -------------------------------------------------------------------------------- 1 | correctUsername correctPassword 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.bat text eol=crlf 4 | *.cmd text eol=crlf 5 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/cassandra/jmxremote.password: -------------------------------------------------------------------------------- 1 | cassandra cassandra -------------------------------------------------------------------------------- /aws-xray/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline 2 | -------------------------------------------------------------------------------- /aws-resources/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline 2 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/missing-expressions.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /aws-resources/gradle.properties: -------------------------------------------------------------------------------- 1 | # TODO: uncomment when ready to mark as stable 2 | # otel.stable=true 3 | -------------------------------------------------------------------------------- /gcp-auth-extension/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline 2 | -------------------------------------------------------------------------------- /gcp-resources/gradle.properties: -------------------------------------------------------------------------------- 1 | # TODO: uncomment when ready to mark as stable 2 | # otel.stable=true 3 | -------------------------------------------------------------------------------- /aws-xray-propagator/gradle.properties: -------------------------------------------------------------------------------- 1 | # TODO: uncomment when ready to mark as stable 2 | # otel.stable=true 3 | -------------------------------------------------------------------------------- /baggage-processor/gradle.properties: -------------------------------------------------------------------------------- 1 | # TODO: uncomment when ready to mark as stable 2 | # otel.stable=true 3 | -------------------------------------------------------------------------------- /gcp-auth-extension/gradle.properties: -------------------------------------------------------------------------------- 1 | # TODO: uncomment when ready to mark as stable 2 | # otel.stable=true 3 | -------------------------------------------------------------------------------- /maven-extension/src/main/resources/META-INF/services/io.opentelemetry.maven.handler.MojoGoalExecutionHandler: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/empty-expressions.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: [ ] 4 | -------------------------------------------------------------------------------- /config/license/spotless.license.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | -------------------------------------------------------------------------------- /.github/scripts/get-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | grep "val stableVersion = " version.gradle.kts | grep -Eo "[0-9]+.[0-9]+.[0-9]+" 4 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/missing-expression.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - action: DROP 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/missing-fallback-sampler.yaml: -------------------------------------------------------------------------------- 1 | expressions: 2 | - action: DROP 3 | expression: 'spanKind == "CLIENT"' 4 | -------------------------------------------------------------------------------- /disk-buffering/assets/reading-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/disk-buffering/assets/reading-flow.png -------------------------------------------------------------------------------- /disk-buffering/assets/writing-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/disk-buffering/assets/writing-flow.png -------------------------------------------------------------------------------- /noop-api/src/main/resources/META-INF/services/io.opentelemetry.context.ContextStorageProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.noopapi.NoopContextStorageProvider 2 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/missing-action.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - expression: 'spanKind == \"CLIENT\"' 5 | -------------------------------------------------------------------------------- /.github/scripts/use-cla-approved-bot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | git config user.name otelbot 4 | git config user.email 197425009+otelbot@users.noreply.github.com 5 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/empty-expression-value.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - action: DROP 5 | expression: '' 6 | -------------------------------------------------------------------------------- /gcp-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.gcp.resource.GCPResourceProvider 2 | -------------------------------------------------------------------------------- /maven-extension/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.maven.resources.MavenResourceProvider 2 | -------------------------------------------------------------------------------- /inferred-spans/src/test/resources/recording.jfr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/inferred-spans/src/test/resources/recording.jfr -------------------------------------------------------------------------------- /maven-extension/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.maven.resources.MavenResourceDetector 2 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/invalid-action.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - action: INVALID 5 | expression: 'spanKind == "CLIENT"' 6 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/invalid-fallback-sampler.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | foo: 3 | expressions: 4 | - action: DROP 5 | expression: 'spanKind == "CLIENT"' 6 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/valid/drop-client-spans.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - action: DROP 5 | expression: 'spanKind == "CLIENT"' 6 | -------------------------------------------------------------------------------- /docs/apidiffs/1.50.0_vs_1.49.0/opentelemetry-aws-xray.txt: -------------------------------------------------------------------------------- 1 | Comparing source compatibility of opentelemetry-aws-xray-1.50.0.jar against opentelemetry-aws-xray-1.49.0.jar 2 | No changes. -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/yaml/weaver.yaml: -------------------------------------------------------------------------------- 1 | templates: 2 | - pattern: config.yml.j2 3 | filter: '.groups | map(select(.type == "metric"))' 4 | application_mode: single -------------------------------------------------------------------------------- /aws-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.aws.resource.internal.AwsResourceDetector 2 | -------------------------------------------------------------------------------- /azure-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.azure.resource.AzureResourceDetector 2 | -------------------------------------------------------------------------------- /gcp-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.gcp.resource.internal.GcpResourceDetector 2 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/weaver.yaml: -------------------------------------------------------------------------------- 1 | templates: 2 | - pattern: metrics.md.j2 3 | filter: '.groups | map(select(.type == "metric"))' 4 | application_mode: single -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/invalid/invalid-cel-expression.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_on: 3 | expressions: 4 | - action: DROP 5 | expression: 'invalid cel expression!' 6 | -------------------------------------------------------------------------------- /docs/apidiffs/current_vs_latest/opentelemetry-aws-xray.txt: -------------------------------------------------------------------------------- 1 | Comparing source compatibility of opentelemetry-aws-xray-1.53.0-SNAPSHOT.jar against opentelemetry-aws-xray-1.52.0.jar 2 | No changes. -------------------------------------------------------------------------------- /samplers/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.sampler.LinksParentAlwaysOnSamplerProvider 2 | -------------------------------------------------------------------------------- /cel-sampler/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.sampler.cel.internal.CelBasedSamplerComponentProvider 2 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.cloudfoundry.resources.CloudFoundryResourceProvider 2 | -------------------------------------------------------------------------------- /compressors/compressor-zstd/src/main/resources/META-INF/services/io.opentelemetry.exporter.internal.compression.CompressorProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.compressor.zstd.ZstdCompressorProvider 2 | -------------------------------------------------------------------------------- /maven-extension/docs/images/maven-execution-trace-jaeger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/maven-extension/docs/images/maven-execution-trace-jaeger.png -------------------------------------------------------------------------------- /samplers/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.sampler.internal.RuleBasedRoutingSamplerComponentProvider 2 | -------------------------------------------------------------------------------- /ibm-mq-metrics/model/registry_manifest.yaml: -------------------------------------------------------------------------------- 1 | name: IBM MQ Monitoring 2 | semconv_version: v1.34.0 3 | schema_base_url: https://www.github.com/open-telemetry/opentelemetry-java-contrib/ibm-mq-metrics 4 | -------------------------------------------------------------------------------- /processors/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.eventbridge.internal.EventToSpanEventBridgeComponentProvider 2 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.cloudfoundry.resources.CloudFoundryResourceDetector 2 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/valid/record-specific-path.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_off: 3 | expressions: 4 | - action: RECORD_AND_SAMPLE 5 | expression: 'attribute["url.path"] == "/v1/user"' 6 | -------------------------------------------------------------------------------- /maven-extension/docs/images/jenkins-maven-execution-trace-jaeger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/HEAD/maven-extension/docs/images/jenkins-maven-execution-trace-jaeger.png -------------------------------------------------------------------------------- /maven-extension/src/main/resources/META-INF/sisu/javax.inject.Named: -------------------------------------------------------------------------------- 1 | io.opentelemetry.maven.OpenTelemetrySdkService 2 | io.opentelemetry.maven.OtelLifecycleParticipant 3 | io.opentelemetry.maven.SpanRegistry 4 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/handler/package-info.java: -------------------------------------------------------------------------------- 1 | @ParametersAreNonnullByDefault 2 | package io.opentelemetry.maven.handler; 3 | 4 | import javax.annotation.ParametersAreNonnullByDefault; 5 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.sampler.consistent.ParentBasedConsistentProbabilitySamplerProvider 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # 2 | # Learn about membership in OpenTelemetry community: 3 | # https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md 4 | # 5 | 6 | * @open-telemetry/java-contrib-approvers 7 | -------------------------------------------------------------------------------- /jmx-scraper/test-app/README.md: -------------------------------------------------------------------------------- 1 | # test-app 2 | 3 | This is a test CLI application that is only used for integration tests. 4 | The goal of this application is to publish custom MBeans in JMX and then allow end-to-end testing. 5 | -------------------------------------------------------------------------------- /inferred-spans/src/test/resources/logging.properties: -------------------------------------------------------------------------------- 1 | handlers=java.util.logging.ConsoleHandler 2 | .level=ALL 3 | java.util.logging.ConsoleHandler.level=ALL 4 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 5 | -------------------------------------------------------------------------------- /.fossa.yml: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | targets: 4 | only: 5 | - type: gradle 6 | 7 | experimental: 8 | gradle: 9 | configurations-only: 10 | # consumer will only be exposed to these dependencies 11 | - runtimeClasspath 12 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/wildfly.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:remote+http://wildfly:9990 4 | otel.jmx.target.system = wildfly 5 | -------------------------------------------------------------------------------- /jmx-scraper/test-webapp/README.md: -------------------------------------------------------------------------------- 1 | # test-webapp 2 | 3 | This is a test web application that is only used for integration tests when metrics are published 4 | only when an application is deployed to the container, for example with Wildfly session metrics. 5 | -------------------------------------------------------------------------------- /aws-resources/src/test/resources/declarative-config.yaml: -------------------------------------------------------------------------------- 1 | file_format: "1.0-rc.1" 2 | resource: 3 | detection/development: 4 | detectors: 5 | - aws: 6 | tracer_provider: 7 | processors: 8 | - simple: 9 | exporter: 10 | console: 11 | -------------------------------------------------------------------------------- /gcp-auth-extension/src/test/resources/fake_user_creds.json: -------------------------------------------------------------------------------- 1 | { 2 | "client_id": "....apps.googleusercontent.com", 3 | "client_secret": "...", 4 | "refresh_token": "1//...", 5 | "quota_project_id": "your-configured-quota-project", 6 | "type": "authorized_user" 7 | } 8 | -------------------------------------------------------------------------------- /azure-resources/src/test/resources/declarative-config.yaml: -------------------------------------------------------------------------------- 1 | file_format: "1.0-rc.1" 2 | resource: 3 | detection/development: 4 | detectors: 5 | - azure: 6 | tracer_provider: 7 | processors: 8 | - simple: 9 | exporter: 10 | console: 11 | -------------------------------------------------------------------------------- /jmx-scraper/test-webapp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | 4 | war 5 | } 6 | 7 | description = "JMX metrics scraper - test web application" 8 | 9 | dependencies { 10 | compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0") 11 | } 12 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/declarative-config.yaml: -------------------------------------------------------------------------------- 1 | file_format: "1.0-rc.1" 2 | resource: 3 | detection/development: 4 | detectors: 5 | - maven: 6 | tracer_provider: 7 | processors: 8 | - simple: 9 | exporter: 10 | console: 11 | -------------------------------------------------------------------------------- /.github/scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "workflows", 3 | "version": "1.0.0", 4 | "description": "Dependencies for GitHub Action workflows", 5 | "private": true, 6 | "dependencies": { 7 | "@octokit/rest": "^22.0.0", 8 | "yaml": "2.8.2" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/valid/multiple-drop-expressions.yaml: -------------------------------------------------------------------------------- 1 | fallback_sampler: 2 | always_off: 3 | expressions: 4 | - action: DROP 5 | expression: 'attribute["http.request.method"] == "GET"' 6 | - action: DROP 7 | expression: 'attribute["url.path"] == "/foo/bar"' 8 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.awsxray.propagator.internal.AwsXrayComponentProvider 2 | io.opentelemetry.contrib.awsxray.propagator.internal.AwsXrayLambdaComponentProvider 3 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/test/resources/declarative-config.yaml: -------------------------------------------------------------------------------- 1 | file_format: "1.0-rc.1" 2 | resource: 3 | detection/development: 4 | detectors: 5 | - cloud_foundry: 6 | tracer_provider: 7 | processors: 8 | - simple: 9 | exporter: 10 | console: 11 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.awsxray.propagator.internal.AwsConfigurablePropagator 2 | io.opentelemetry.contrib.awsxray.propagator.internal.AwsXrayLambdaConfigurablePropagator 3 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/package-info.java: -------------------------------------------------------------------------------- 1 | /** OpenTelemetry AWS X-Ray propagator extension. */ 2 | @ParametersAreNonnullByDefault 3 | package io.opentelemetry.contrib.awsxray.propagator; 4 | 5 | import javax.annotation.ParametersAreNonnullByDefault; 6 | -------------------------------------------------------------------------------- /jmx-scraper/src/integrationTest/resources/custom-metrics.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | rules: 4 | 5 | - bean: java.lang:type=Runtime 6 | mapping: 7 | Uptime: 8 | metric: custom.jvm.uptime 9 | type: counter 10 | unit: ms 11 | desc: JVM uptime in milliseconds 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: StackOverflow 3 | url: https://stackoverflow.com/questions/ask?tags=open-telemetry+java 4 | about: Please ask questions here. 5 | - name: Slack 6 | url: https://cloud-native.slack.com/archives/C014L2KCTE3 7 | about: Or here. 8 | -------------------------------------------------------------------------------- /aws-xray/src/awsTest/resources/otel-collector.yml: -------------------------------------------------------------------------------- 1 | receivers: 2 | awsxray: 3 | 4 | extensions: 5 | health_check: 6 | 7 | exporters: 8 | debug: 9 | 10 | service: 11 | extensions: [health_check] 12 | pipelines: 13 | traces: 14 | receivers: [awsxray] 15 | exporters: [debug] 16 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/kafka-producer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function msg() { 4 | while true; do 5 | echo 'some message' 6 | sleep .25 7 | done 8 | } 9 | 10 | msg | kafka-console-producer.sh --bootstrap-server kafka:9092 --topic test-topic-1 11 | -------------------------------------------------------------------------------- /noop-api/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "OpenTelemetry Noop API" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.noopapi") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-api") 11 | } 12 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.maven; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /azure-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.azure.resource.AzureAppServiceResourceProvider 2 | io.opentelemetry.contrib.azure.resource.AzureFunctionsResourceProvider 3 | io.opentelemetry.contrib.azure.resource.AzureVmResourceProvider 4 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/metric_macros.j2: -------------------------------------------------------------------------------- 1 | {% macro instrument(type) -%} 2 | {%- if type == "gauge" %}Gauge 3 | {% elif type == "counter" %}Counter 4 | {% elif type == "updowncounter" %}UpDownCounter 5 | {% elif type == "histogram" %}Histogram 6 | {% else %}{{ type }} 7 | {%- endif %} 8 | {% endmacro %} 9 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/main/java/io/opentelemetry/contrib/metrics/micrometer/internal/state/package-info.java: -------------------------------------------------------------------------------- 1 | /** Internal state for metrics. */ 2 | @ParametersAreNonnullByDefault 3 | package io.opentelemetry.contrib.metrics.micrometer.internal.state; 4 | 5 | import javax.annotation.ParametersAreNonnullByDefault; 6 | -------------------------------------------------------------------------------- /version.gradle.kts: -------------------------------------------------------------------------------- 1 | val stableVersion = "1.53.0-SNAPSHOT" 2 | val alphaVersion = "1.53.0-alpha-SNAPSHOT" 3 | val tagVersion by extra { "v$stableVersion" } 4 | 5 | allprojects { 6 | if (findProperty("otel.stable") != "true") { 7 | version = alphaVersion 8 | } else { 9 | version = stableVersion 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.clomonitor.yml: -------------------------------------------------------------------------------- 1 | # see https://github.com/cncf/clomonitor/blob/main/docs/checks.md#exemptions 2 | exemptions: 3 | - check: artifacthub_badge 4 | reason: "Artifact Hub doesn't support Java packages" 5 | - check: openssf_badge 6 | reason: "ETOOMANYBADGES, but the work has been done: https://www.bestpractices.dev/projects/9992" 7 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/resources/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.maven.resources; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /jfr-connection/src/test/resources/brokenJfcFile.jfc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | everyChunk 6 | 7 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.opamp.client.internal; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /.mise/tasks/lint/links.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #MISE description="Lint links in all files" 3 | 4 | set -e 5 | 6 | #USAGE arg "" var=#true help="files to check" default="." 7 | 8 | for f in $usage_file; do 9 | echo "Checking links in file: $f" 10 | done 11 | 12 | lychee --verbose --config .github/config/lychee.toml $usage_file 13 | -------------------------------------------------------------------------------- /jmx-scraper/test-app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | 4 | application 5 | } 6 | 7 | description = "JMX metrics scraper - test application" 8 | 9 | tasks { 10 | jar { 11 | manifest { 12 | attributes["Main-Class"] = "io.opentelemetry.contrib.jmxscraper.testapp.TestApp" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/resources/fake-test-system-both.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # test system 1 that is in the same location as legacy yaml files 3 | rules: 4 | 5 | - bean: java.lang:type=Runtime 6 | mapping: 7 | Uptime: 8 | metric: custom.jvm.uptime 9 | type: counter 10 | unit: ms 11 | desc: JVM uptime in milliseconds 12 | -------------------------------------------------------------------------------- /jfr-connection/src/test/resources/sampleJfcFile.jfc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | everyChunk 6 | 7 | 8 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/solr.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://solr:9990/jmxrmi 4 | otel.jmx.target.system = solr 5 | 6 | # these will be overridden by cmd line 7 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 8 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach-core/README.md: -------------------------------------------------------------------------------- 1 | # Runtime attachment core 2 | 3 | This core attachment component exists as a separate library here for distributions of the 4 | [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation), 5 | to help them to build their own runtime attach component that attaches their distribution. 6 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/exporters/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.contrib.disk.buffering.exporters; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/FilterType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.ibm.mq.metricscollector; 7 | 8 | public enum FilterType { 9 | STARTSWITH, 10 | EQUALS, 11 | ENDSWITH, 12 | CONTAINS, 13 | NONE 14 | } 15 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/hbase.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://hbase:9900/jmxrmi 4 | otel.jmx.target.system = hbase 5 | 6 | # these will be overridden by cmd line 7 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 8 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/jetty.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://jetty:1099/jmxrmi 4 | otel.jmx.target.system = jetty 5 | 6 | # these will be overridden by cmd line 7 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 8 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/hadoop.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://hadoop:8004/jmxrmi 4 | otel.jmx.target.system = hadoop 5 | 6 | # these will be overridden by cmd line 7 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 8 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/responses/WritableResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.storage.responses; 7 | 8 | public enum WritableResult { 9 | SUCCEEDED, 10 | FAILED 11 | } 12 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/activemq.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://activemq:10991/jmxrmi 4 | otel.jmx.target.system = activemq 5 | 6 | # these will be overridden by cmd line 7 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 8 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/resources/jmx/rules/fake-test-system-both.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # test system 1 that is in the same location as instrumentation yaml files 3 | rules: 4 | 5 | - bean: java.lang:type=Runtime 6 | mapping: 7 | Uptime: 8 | metric: custom.jvm.uptime 9 | type: counter 10 | unit: ms 11 | desc: JVM uptime in milliseconds 12 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/main/java/io/opentelemetry/contrib/metrics/micrometer/internal/instruments/package-info.java: -------------------------------------------------------------------------------- 1 | /** Implementations of OpenTelemetry instruments delegating to Micrometer meters. */ 2 | @ParametersAreNonnullByDefault 3 | package io.opentelemetry.contrib.metrics.micrometer.internal.instruments; 4 | 5 | import javax.annotation.ParametersAreNonnullByDefault; 6 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.opamp.client.internal.connectivity.http; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /aws-xray/README.md: -------------------------------------------------------------------------------- 1 | # AWS X-Ray Support 2 | 3 | This module contains a custom `IdGenerator` and `Sampler` for use with AWS X-Ray. 4 | 5 | ## Component owners 6 | 7 | - [Lei Wang](https://github.com/wangzlei), AWS 8 | - [Prashant Srivastava](https://github.com/srprash), AWS 9 | 10 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 11 | -------------------------------------------------------------------------------- /.mise/tasks/lint/local-links.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #MISE description="Lint links in local files" 3 | 4 | set -e 5 | 6 | #USAGE arg "" var=#true help="files to check" default="." 7 | 8 | for f in $usage_file; do 9 | echo "Checking links in file: $f" 10 | done 11 | 12 | lychee --verbose --scheme file --include-fragments --config .github/config/lychee.toml $usage_file 13 | -------------------------------------------------------------------------------- /aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | /** Provides implementations of SDK interfaces for AWS X-Ray users. */ 7 | @ParametersAreNonnullByDefault 8 | package io.opentelemetry.contrib.awsxray; 9 | 10 | import javax.annotation.ParametersAreNonnullByDefault; 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/resources/fake-test-system-legacy-only.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # test system 2 that is in the same location as legacy yaml files and is not suppored in instrumentation 3 | rules: 4 | 5 | - bean: java.lang:type=Runtime 6 | mapping: 7 | Uptime: 8 | metric: custom.jvm.uptime 9 | type: counter 10 | unit: ms 11 | desc: JVM uptime in milliseconds 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | org.gradle.caching=true 3 | org.gradle.configuration-cache=true 4 | org.gradle.configuration-cache.parallel=true 5 | 6 | org.gradle.priority=low 7 | 8 | # Gradle default is 256m which causes issues with our build - https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory 9 | org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m 10 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/main/java/io/opentelemetry/contrib/metrics/micrometer/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * A Micrometer implementation of metrics. 3 | * 4 | * @see io.opentelemetry.contrib.metrics.micrometer.MicrometerMeterProvider 5 | */ 6 | @ParametersAreNonnullByDefault 7 | package io.opentelemetry.contrib.metrics.micrometer; 8 | 9 | import javax.annotation.ParametersAreNonnullByDefault; 10 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/test-sampling-targets-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "SamplingTargetDocuments": [ 3 | { 4 | "RuleName": "Test", 5 | "FixedRate": 1.0 6 | } 7 | ], 8 | "LastRuleModification": 1530920505.0, 9 | "UnprocessedStatistics": [ 10 | { 11 | "RuleName": "cats-rule", 12 | "ErrorCode": "400", 13 | "Message": "Unknown rule" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/internal/pooling/Recyclable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.pooling; 7 | 8 | public interface Recyclable { 9 | 10 | /** resets pooled object state so it can be reused */ 11 | void resetState(); 12 | } 13 | -------------------------------------------------------------------------------- /aws-resources/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry AWS Resource Support 2 | 3 | This module contains AWS resource detectors including Beanstalk, EC2, ECS, EKS, and Lambda. 4 | 5 | ## Component owners 6 | 7 | - [Lei Wang](https://github.com/wangzlei), AWS 8 | - [Prashant Srivastava](https://github.com/srprash), AWS 9 | 10 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 11 | -------------------------------------------------------------------------------- /aws-resources/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider: -------------------------------------------------------------------------------- 1 | io.opentelemetry.contrib.aws.resource.BeanstalkResourceProvider 2 | io.opentelemetry.contrib.aws.resource.Ec2ResourceProvider 3 | io.opentelemetry.contrib.aws.resource.EcsResourceProvider 4 | io.opentelemetry.contrib.aws.resource.EksResourceProvider 5 | io.opentelemetry.contrib.aws.resource.LambdaResourceProvider 6 | -------------------------------------------------------------------------------- /ibm-mq-metrics/weaver.Dockerfile: -------------------------------------------------------------------------------- 1 | # DO NOT BUILD 2 | # This file is just for tracking dependencies of the semantic convention build. 3 | # Dependabot can keep this file up to date with latest containers. 4 | 5 | # Weaver is used to generate markdown docs, and enforce policies on the model and run integration tests. 6 | FROM otel/weaver:v0.20.0@sha256:fa4f1c6954ecea78ab1a4e865bd6f5b4aaba80c1896f9f4a11e2c361d04e197e AS weaver -------------------------------------------------------------------------------- /jmx-scraper/src/test/resources/jmx/rules/fake-test-system-instrumentation-only.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # test system 3 that is in the same location as instrumentation yaml files and is NOT defined in legacy 3 | rules: 4 | 5 | - bean: java.lang:type=Runtime 6 | mapping: 7 | Uptime: 8 | metric: custom.jvm.uptime 9 | type: counter 10 | unit: ms 11 | desc: JVM uptime in milliseconds 12 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/metrics.md.j2: -------------------------------------------------------------------------------- 1 | {%- import 'attribute_table.j2' as at -%} 2 | {%- import 'metric_table.j2' as mt -%} 3 | 4 | # Produced Metrics 5 | 6 | {% for metric in ctx %} 7 | ## Metric `{{metric.metric_name}}` 8 | 9 | {{ mt.generate(metric) }} 10 | 11 | ### `{{metric.metric_name}}` Attributes 12 | 13 | {{ at.generate(metric.attributes, "", "", metric.lineage.attributes) }} 14 | {% endfor %} -------------------------------------------------------------------------------- /micrometer-meter-provider/src/main/java/io/opentelemetry/contrib/metrics/micrometer/CallbackRegistrar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.metrics.micrometer; 7 | 8 | public interface CallbackRegistrar extends AutoCloseable { 9 | CallbackRegistration registerCallback(Runnable runnable); 10 | 11 | @Override 12 | void close(); 13 | } 14 | -------------------------------------------------------------------------------- /jfr-connection/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "OpenTelemetry JFR Connection" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.jfr.connection") 8 | 9 | dependencies { 10 | testImplementation("org.openjdk.jmc:common:8.3.1") 11 | testImplementation("org.openjdk.jmc:flightrecorder:8.3.1") 12 | testImplementation("org.mockito:mockito-inline") 13 | } 14 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/jvm.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://cassandra:7199/jmxrmi 4 | otel.jmx.target.system = jvm 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/kafka.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://kafka:7199/jmxrmi 4 | otel.jmx.target.system = kafka 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/tomcat.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://tomcat:9010/jmxrmi 4 | otel.jmx.target.system = tomcat 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-scraper/test-app/src/main/java/io/opentelemetry/contrib/jmxscraper/testapp/TestAppMxBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.testapp; 7 | 8 | import javax.management.MXBean; 9 | 10 | @MXBean 11 | @SuppressWarnings("unused") 12 | public interface TestAppMxBean { 13 | 14 | int getIntValue(); 15 | 16 | void stopApp(); 17 | } 18 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/otlp_config.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://cassandra:7199/jmxrmi 4 | otel.jmx.groovy.script = /app/script.groovy 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/cassandra.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://cassandra:7199/jmxrmi 4 | otel.jmx.target.system = cassandra 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/jvm-and-kafka.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://kafka:7199/jmxrmi 4 | otel.jmx.target.system = jvm,kafka 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /mise.toml: -------------------------------------------------------------------------------- 1 | [tools] 2 | lychee = "0.22.0" 3 | markdownlint-cli2 = "0.20.0" 4 | 5 | [settings] 6 | # Only install tools explicitly defined in the [tools] section above 7 | idiomatic_version_file_enable_tools = [] 8 | 9 | # Windows configuration for file-based tasks 10 | # Based on: https://github.com/jdx/mise/discussions/4461 11 | windows_executable_extensions = ["sh"] 12 | windows_default_file_shell_args = "bash" 13 | use_file_shell_for_executable_tasks = true 14 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | # See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md 2 | # and https://github.com/DavidAnson/markdownlint-cli2 3 | 4 | ul-style: false 5 | line-length: false 6 | no-duplicate-heading: 7 | siblings_only: true 8 | ol-prefix: 9 | style: ordered 10 | no-inline-html: false 11 | fenced-code-language: false 12 | no-trailing-punctuation: 13 | punctuation: ".,;:" # allowing exclamation points and question marks at end of sentences 14 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-sample-all.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:xray:us-east-1:595986152929:my-service", 5 | "Priority": 1, 6 | "FixedRate": 1.0, 7 | "ReservoirSize": 0, 8 | "ServiceName": "*", 9 | "ServiceType": "*", 10 | "Host": "*", 11 | "HTTPMethod": "*", 12 | "URLPath": "*", 13 | "Version": 1, 14 | "Attributes": {} 15 | } 16 | -------------------------------------------------------------------------------- /jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | /** 7 | * Capture Spans and Scopes as events in JFR recordings. 8 | * 9 | * @see io.opentelemetry.contrib.jfrevent.JfrSpanProcessor 10 | */ 11 | @ParametersAreNonnullByDefault 12 | package io.opentelemetry.contrib.jfrevent; 13 | 14 | import javax.annotation.ParametersAreNonnullByDefault; 15 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/kafka-consumer.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://kafka-consumer:7199/jmxrmi 4 | otel.jmx.target.system = kafka-consumer 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/target-systems/kafka-producer.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.interval.milliseconds = 3000 2 | otel.metrics.exporter = otlp 3 | otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://kafka-producer:7199/jmxrmi 4 | otel.jmx.target.system = kafka-producer 5 | 6 | # these will be overridden by cmd line 7 | otel.jmx.username = wrong_username 8 | otel.jmx.password = wrong_password 9 | otel.exporter.otlp.endpoint = http://host.testcontainers.internal 10 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/java/weaver.yaml: -------------------------------------------------------------------------------- 1 | templates: 2 | - template: Metrics.java.j2 3 | filter: '.groups | map(select(.type == "metric"))' 4 | application_mode: single 5 | - template: MetricsConfig.java.j2 6 | filter: '.groups | map(select(.type == "metric"))' 7 | application_mode: single 8 | - template: IbmMqAttributes.java.j2 9 | filter: '.groups | map(select(.type == "attribute_group")) | map(.attributes[])' 10 | application_mode: single 11 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/activemq/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rmohr/activemq:5.15.9@sha256:b5669f141ac5c455b1010b90d348fe78289bba7e2db5659484d99736b696593c 2 | 3 | 4 | COPY --chown=activemq config/env /opt/activemq/bin/env 5 | ENV ACTIVEMQ_JMX=10991 6 | EXPOSE $ACTIVEMQ_JMX 7 | 8 | ENV ACTIVEMQ_JMX_OPTS="-Dcom.sun.management.jmxremote.port=10991 -Dcom.sun.management.jmxremote.rmi.port=10991 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 9 | -------------------------------------------------------------------------------- /resource-providers/src/main/java/io/opentelemetry/contrib/resourceproviders/ResourceLocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.resourceproviders; 7 | 8 | import java.net.URL; 9 | import javax.annotation.Nullable; 10 | 11 | interface ResourceLocator { 12 | 13 | @Nullable 14 | Class findClass(String className); 15 | 16 | URL getClassLocation(Class clazz); 17 | } 18 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | /** 7 | * {@link io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider} implementations for inferring 8 | * resource information for AWS services. 9 | */ 10 | @ParametersAreNonnullByDefault 11 | package io.opentelemetry.contrib.aws.resource; 12 | 13 | import javax.annotation.ParametersAreNonnullByDefault; 14 | -------------------------------------------------------------------------------- /.github/workflows/fossa.yml: -------------------------------------------------------------------------------- 1 | name: FOSSA 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | fossa: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 16 | 17 | - uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 18 | with: 19 | api-key: ${{secrets.FOSSA_API_KEY}} 20 | team: OpenTelemetry 21 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/files/FileOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.storage.files; 7 | 8 | import java.io.Closeable; 9 | import java.io.File; 10 | 11 | public interface FileOperations extends Closeable { 12 | boolean hasExpired(); 13 | 14 | boolean isClosed(); 15 | 16 | File getFile(); 17 | } 18 | -------------------------------------------------------------------------------- /inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/internal/pooling/Allocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.pooling; 7 | 8 | /** 9 | * Defines a pooled object factory 10 | * 11 | * @param pooled object type 12 | */ 13 | public interface Allocator { 14 | 15 | /** Creates a new instance of pooled object type. */ 16 | T createInstance(); 17 | } 18 | -------------------------------------------------------------------------------- /prometheus-client-bridge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Prometheus client bridge" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.metrics.prometheus.clientbridge") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-sdk-metrics") 11 | implementation("io.prometheus:simpleclient") 12 | 13 | testImplementation("com.google.guava:guava") 14 | testImplementation("io.prometheus:simpleclient_httpserver") 15 | } 16 | -------------------------------------------------------------------------------- /.mise/tasks/lint/markdown.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #MISE description="Lint markdown files" 3 | #USAGE flag "--fix" help="Automatically fix issues" 4 | 5 | set -e 6 | 7 | if [ "${usage_fix:-false}" = "true" ]; then 8 | markdownlint-cli2 --fix "**/*.md" "#**/build" "#**/node_modules" "#CHANGELOG.md" "#ibm-mq-metrics/docs/metrics.md" "#.github/pull_request_template.md" 9 | else 10 | markdownlint-cli2 "**/*.md" "#**/build" "#**/node_modules" "#CHANGELOG.md" "#ibm-mq-metrics/docs/metrics.md" "#.github/pull_request_template.md" 11 | fi 12 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/wildfly/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 & \ 4 | 5 | /opt/jboss/wildfly/bin/add-user.sh user password --silent & \ 6 | 7 | java -cp /app/OpenTelemetryJMXMetrics.jar:/opt/jboss/wildfly/bin/client/jboss-client.jar \ 8 | -Dotel.jmx.username=user -Dotel.jmx.password=password \ 9 | -Dotel.exporter.otlp.endpoint="$OTLP_ENDPOINT" \ 10 | io.opentelemetry.contrib.jmxmetrics.JmxMetrics -config /app/target-systems/wildfly.properties 11 | -------------------------------------------------------------------------------- /noop-api/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry Noop API 2 | 3 | An implementation of `OpenTelemetry` that is completely no-op. Unlike `OpenTelemetry#noop()`, this 4 | implementation does not support in-process context propagation at all. This means that no objects 5 | are allocated nor {@link ThreadLocal}s used in an application using this implementation. 6 | 7 | ## Component owners 8 | 9 | - [Jack Berg](https://github.com/jack-berg), New Relic 10 | 11 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 12 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/delay/PeriodicDelay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.delay; 7 | 8 | import java.time.Duration; 9 | 10 | public interface PeriodicDelay { 11 | static PeriodicDelay ofFixedDuration(Duration duration) { 12 | return new FixedPeriodicDelay(duration); 13 | } 14 | 15 | Duration getNextDelay(); 16 | 17 | void reset(); 18 | } 19 | -------------------------------------------------------------------------------- /aws-xray-propagator/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry AWS X-Ray Propagator 2 | 3 | This module contains a `TextMapPropagator` implementation compatible with 4 | the [AWS X-Ray Trace Header propagation protocol](https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader). 5 | 6 | ## Component owners 7 | 8 | - [Lei Wang](https://github.com/wangzlei), AWS 9 | - [Prashant Srivastava](https://github.com/srprash), AWS 10 | 11 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 12 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_1/src/test/java/io/opentelemetry/contrib/maven/test/springboot/SpringbootTestApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.maven.test.springboot; 7 | 8 | import org.junit.jupiter.api.Test; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | 11 | @SpringBootTest 12 | class SpringbootTestApplicationTests { 13 | 14 | @Test 15 | void contextLoads() {} 16 | } 17 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_2/src/test/java/io/opentelemetry/contrib/maven/test/springboot/SpringbootTestApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.maven.test.springboot; 7 | 8 | import org.junit.jupiter.api.Test; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | 11 | @SpringBootTest 12 | class SpringbootTestApplicationTests { 13 | 14 | @Test 15 | void contextLoads() {} 16 | } 17 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/serialization/deserializers/DeserializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; 7 | 8 | import java.io.IOException; 9 | 10 | @SuppressWarnings("serial") 11 | public class DeserializationException extends IOException { 12 | public DeserializationException(Throwable cause) { 13 | super(cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /resource-providers/src/main/java/io/opentelemetry/contrib/resourceproviders/ServiceNameDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.resourceproviders; 7 | 8 | import javax.annotation.Nullable; 9 | 10 | /** 11 | * Functional interface for implementations that know how to detect a service name for a specific 12 | * application server type. 13 | */ 14 | interface ServiceNameDetector { 15 | @Nullable 16 | String detect() throws Exception; 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/gradle-wrapper-validation.yml: -------------------------------------------------------------------------------- 1 | name: Gradle wrapper validation 2 | 3 | on: 4 | push: 5 | pull_request: 6 | merge_group: 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | gradle-wrapper-validation: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 16 | 17 | # this needs to be in its own workflow in order to make OSSF scorecard happy 18 | - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 19 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach-core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "To help in create an OpenTelemetry distro able to runtime attach an OpenTelemetry Java Instrumentation agent" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.attach.core") 8 | 9 | dependencies { 10 | implementation("net.bytebuddy:byte-buddy-agent:1.18.2") 11 | 12 | // Used by byte-buddy but not brought in as a transitive dependency. 13 | compileOnly("com.google.code.findbugs:annotations") 14 | } 15 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/get-sampling-targets-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "SamplingStatisticsDocuments":[ 3 | { 4 | "RuleName":"Test", 5 | "ClientID":"ABCDEF1234567890ABCDEF10", 6 | "Timestamp":1624257967000, 7 | "RequestCount":110, 8 | "SampledCount":30, 9 | "BorrowCount":20 10 | }, 11 | { 12 | "RuleName":"polling-scorekeep", 13 | "ClientID":"ABCDEF1234567890ABCDEF11", 14 | "Timestamp":1530922806000, 15 | "RequestCount":10500, 16 | "SampledCount":31, 17 | "BorrowCount":0 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-awslambda.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:xray:us-east-1:595986152929:my-service", 5 | "Priority": 1, 6 | "FixedRate": 1.0, 7 | "ReservoirSize": 1000, 8 | "ServiceName": "*", 9 | "ServiceType": "AWS::Lambda::Function", 10 | "Host": "opentelemetry.io", 11 | "HTTPMethod": "GET", 12 | "URLPath": "/instrument-me", 13 | "Version": 1, 14 | "Attributes": { 15 | "animal": "cat", 16 | "speed": "10" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-wildcards.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:*:us-east-?:*:my-service", 5 | "Priority": 1, 6 | "FixedRate": 0.0, 7 | "ReservoirSize": 0, 8 | "ServiceName": "test-service-foo-*", 9 | "ServiceType": "*", 10 | "Host": "*op*t?lem*r?.io*", 11 | "HTTPMethod": "**GET**", 12 | "URLPath": "/instrument-me?foo=bar&cat=*", 13 | "Version": 1, 14 | "Attributes": { 15 | "animal": "cat*", 16 | "speed": "?0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jmx-metrics/src/main/groovy/io/opentelemetry/contrib/jmxmetrics/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxmetrics; 7 | 8 | public class ConfigurationException extends RuntimeException { 9 | private static final long serialVersionUID = 0L; 10 | 11 | public ConfigurationException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | 15 | public ConfigurationException(String message) { 16 | super(message); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-exactmatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:xray:us-east-1:595986152929:my-service", 5 | "Priority": 1, 6 | "FixedRate": 1.0, 7 | "ReservoirSize": 0, 8 | "ServiceName": "test-service-foo-bar", 9 | "ServiceType": "AWS::EKS::Container", 10 | "Host": "opentelemetry.io", 11 | "HTTPMethod": "GET", 12 | "URLPath": "/instrument-me", 13 | "Version": 1, 14 | "Attributes": { 15 | "animal": "cat", 16 | "speed": "10" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/requirement.j2: -------------------------------------------------------------------------------- 1 | {% macro render(attr, notes) -%} 2 | {%- if attr.level == "recommended" %}`Recommended` 3 | {% elif attr.level == "required" %}`Required` 4 | {% elif attr.level == "opt_in" %}`Opt-In` 5 | {% elif attr.level.conditionally_required %}`Conditionally Required`{{ notes.add_with_limit({"note": attr.level.conditionally_required, "name": attr.name}) }} 6 | {% elif attr.level.recommended %}`Recommended`{{ notes.add_with_limit({"note": attr.level.recommended, "name": attr.name}) }} 7 | {% else %}{{ level }} 8 | {%- endif %} 9 | {% endmacro %} 10 | -------------------------------------------------------------------------------- /.github/scripts/update-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | version=$1 4 | 5 | if [[ $version == *-SNAPSHOT ]]; then 6 | alpha_version=${version//-SNAPSHOT/-alpha-SNAPSHOT} 7 | else 8 | alpha_version=${version}-alpha 9 | fi 10 | 11 | sed -Ei "s/val stableVersion = \"[^\"]*\"/val stableVersion = \"$version\"/" version.gradle.kts 12 | sed -Ei "s/val alphaVersion = \"[^\"]*\"/val alphaVersion = \"$alpha_version\"/" version.gradle.kts 13 | 14 | sed -Ei "1 s/(Comparing source compatibility of [a-z-]+)-[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?.jar/\1-$version.jar/" docs/apidiffs/current_vs_latest/*.txt 15 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-reservoir.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:xray:us-east-1:595986152929:my-service", 5 | "Priority": 1, 6 | "FixedRate": 0.0, 7 | "ReservoirSize": 1000, 8 | "ServiceName": "test-service-foo-bar", 9 | "ServiceType": "AWS::EKS::Container", 10 | "Host": "opentelemetry.io", 11 | "HTTPMethod": "GET", 12 | "URLPath": "/instrument-me", 13 | "Version": 1, 14 | "Attributes": { 15 | "animal": "cat", 16 | "speed": "10" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /maven-extension/src/test/java/io/opentelemetry/maven/resources/MavenResourceProviderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven.resources; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import org.junit.jupiter.api.Test; 11 | 12 | class MavenResourceProviderTest { 13 | 14 | @Test 15 | void testGetMavenVersion() { 16 | String mavenVersion = MavenResourceProvider.getMavenRuntimeVersion(); 17 | assertThat(mavenVersion).isEqualTo("3.5.0"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/response/Response.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.response; 7 | 8 | import com.google.auto.value.AutoValue; 9 | import opamp.proto.ServerToAgent; 10 | 11 | @AutoValue 12 | public abstract class Response { 13 | public abstract ServerToAgent getServerToAgent(); 14 | 15 | public static Response create(ServerToAgent serverToAgent) { 16 | return new AutoValue_Response(serverToAgent); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/get-sampling-targets-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "SamplingTargetDocuments": [ 3 | { 4 | "RuleName": "base-scorekeep", 5 | "FixedRate": 0.1, 6 | "ReservoirQuota": 2, 7 | "ReservoirQuotaTTL": 1530923107.0, 8 | "Interval": 10 9 | }, 10 | { 11 | "RuleName": "polling-scorekeep", 12 | "FixedRate": 0.003 13 | } 14 | ], 15 | "LastRuleModification": 1530920505.0, 16 | "UnprocessedStatistics": [ 17 | { 18 | "RuleName": "cats-rule", 19 | "ErrorCode": "400", 20 | "Message": "Unknown rule" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/Assertions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.assertions; 7 | 8 | import io.opentelemetry.proto.metrics.v1.Metric; 9 | 10 | /** Dedicated Assertj extension to provide convenient fluent API for metrics testing */ 11 | public class Assertions extends org.assertj.core.api.Assertions { 12 | 13 | public static MetricAssert assertThat(Metric metric) { 14 | return new MetricAssert(metric); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - release/* 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | common: 15 | uses: ./.github/workflows/build-common.yml 16 | secrets: 17 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} 18 | 19 | # Link check is disabled for push events to avoid unnecessary CI failures 20 | # (these failures will instead be captured by the daily scheduled run) 21 | # and for release branches to avoid unnecessary maintenance if external links break 22 | -------------------------------------------------------------------------------- /compressors/compressor-zstd/src/main/java/io/opentelemetry/contrib/compressor/zstd/ZstdCompressorProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.compressor.zstd; 7 | 8 | import io.opentelemetry.exporter.internal.compression.Compressor; 9 | import io.opentelemetry.exporter.internal.compression.CompressorProvider; 10 | 11 | public final class ZstdCompressorProvider implements CompressorProvider { 12 | @Override 13 | public Compressor getInstance() { 14 | return ZstdCompressor.getInstance(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /aws-xray/src/test/resources/sampling-rule-boost.json: -------------------------------------------------------------------------------- 1 | { 2 | "RuleName": "Test", 3 | "RuleARN": "arn:aws:xray:us-east-1:595986152929:sampling-rule/Test", 4 | "ResourceARN": "arn:aws:xray:us-east-1:595986152929:my-service", 5 | "Priority": 1, 6 | "FixedRate": 0.0, 7 | "ReservoirSize": 0, 8 | "ServiceName": "*", 9 | "ServiceType": "*", 10 | "Host": "*", 11 | "HTTPMethod": "*", 12 | "URLPath": "*", 13 | "Version": 1, 14 | "SamplingRateBoost": { 15 | "MaxRate": 0.2, 16 | "CooldownWindowMinutes": 300 17 | }, 18 | "Attributes": { 19 | "animal": "cat", 20 | "speed": "0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/handler/MojoGoalExecutionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven.handler; 7 | 8 | import io.opentelemetry.api.trace.SpanBuilder; 9 | import io.opentelemetry.maven.MavenGoal; 10 | import java.util.List; 11 | import org.apache.maven.execution.ExecutionEvent; 12 | 13 | public interface MojoGoalExecutionHandler { 14 | 15 | default void enrichSpan(SpanBuilder spanBuilder, ExecutionEvent executionEvent) {} 16 | 17 | List getSupportedGoals(); 18 | } 19 | -------------------------------------------------------------------------------- /gcp-auth-extension/src/test/java/io/opentelemetry/contrib/gcp/auth/springapp/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.gcp.auth.springapp; 7 | 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | 11 | @SpringBootApplication 12 | @SuppressWarnings("PrivateConstructorForUtilityClass") 13 | public class Application { 14 | public static void main(String[] args) { 15 | SpringApplication.run(Application.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/event_macros.j2: -------------------------------------------------------------------------------- 1 | {#- Macros for simplifying creating "Event" documentation. -#} 2 | {% import 'stability.j2' as stability %} 3 | {% import 'body_field_table.j2' as body_table %} 4 | {% macro header(event) %}**Status:** {{ stability.badge(event.stability, event.deprecated) }} 5 | 6 | The event name MUST be `{{ event.name }}`. 7 | 8 | {{ event.brief | trim }} 9 | {%if event.note %} 10 | {{ event.note | trim }} 11 | {% endif %} 12 | {% endmacro %} 13 | {% macro body(body) %}{% if body %}**Body fields:** 14 | 15 | {{ body_table.generate(body.fields) }} 16 | {% endif %}{% endmacro %} 17 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/metric_table.j2: -------------------------------------------------------------------------------- 1 | {% import 'stability.j2' as stability %} 2 | {% import 'notes.j2' as notes %} 3 | {% import 'metric_macros.j2' as metrics %} 4 | {% macro generate(group) %}| Name | Instrument Type | Unit (UCUM) | Description | Stability | 5 | | -------- | --------------- | ----------- | -------------- | --------- | 6 | | `{{ group.metric_name }}` | {{ metrics.instrument(group.instrument) | trim }} | `{{ group.unit }}` | {{ group.brief | trim }}{{ notes.add({"note": group.note}) }} | {{ stability.badge(group.stability, group.deprecated) | trim }} | 7 | {{ notes.render() }}{% endmacro %} 8 | -------------------------------------------------------------------------------- /inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/internal/semconv/Attributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.semconv; 7 | 8 | import io.opentelemetry.api.common.AttributeKey; 9 | 10 | public class Attributes { 11 | 12 | private Attributes() {} 13 | 14 | public static final AttributeKey LINK_IS_CHILD = AttributeKey.booleanKey("is_child"); 15 | public static final AttributeKey SPAN_IS_INFERRED = 16 | AttributeKey.booleanKey("is_inferred"); 17 | } 18 | -------------------------------------------------------------------------------- /prometheus-client-bridge/README.md: -------------------------------------------------------------------------------- 1 | # Prometheus client bridge 2 | 3 | This module can be used to bridge OpenTelemetry metrics into the `prometheus-simpleclient` library. 4 | 5 | Currently only registers with the CollectorRegistry's `defaultRegistry`. 6 | 7 | * Build it with `./gradlew :prometheus-simpleclient-bridge:build` 8 | 9 | ## Usage 10 | 11 | ``` 12 | sdkMeterProvider.registerMetricReader(PrometheusCollector.create()); 13 | ``` 14 | 15 | ## Component owners 16 | 17 | - [John Watson](https://github.com/jkwatson), Verta.ai 18 | 19 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 20 | -------------------------------------------------------------------------------- /.github/config/lychee.toml: -------------------------------------------------------------------------------- 1 | # Lychee configuration file 2 | # See https://lychee.cli.rs/config/ 3 | 4 | timeout = 30 5 | retry_wait_time = 5 6 | max_retries = 6 7 | max_concurrency = 4 8 | 9 | # Check link anchors 10 | include_fragments = true 11 | 12 | remap = [ 13 | # workaround for https://github.com/lycheeverse/lychee/issues/1729 14 | "https://github.com/(.*?)/(.*?)/blob/(.*?)/(.*#.*)$ https://raw.githubusercontent.com/$1/$2/$3/$4" 15 | ] 16 | 17 | exclude = [ 18 | # excluding links to pull requests and issues is done for performance 19 | "^https://github.com/open-telemetry/opentelemetry-java-contrib/(issues|pull)/\\d+$", 20 | ] 21 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/responses/ReadableResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.storage.responses; 7 | 8 | import java.io.Closeable; 9 | import java.io.IOException; 10 | import java.util.Collection; 11 | 12 | public interface ReadableResult extends Closeable { 13 | /** The consumable data. */ 14 | Collection getContent(); 15 | 16 | /** Delete the items provided in {@link #getContent()} */ 17 | void delete() throws IOException; 18 | } 19 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/resource_macros.j2: -------------------------------------------------------------------------------- 1 | {#- Macros for simplifying creating "Resource" documentation. -#} 2 | {% import 'stability.j2' as stability %} 3 | {% macro real_stability(resource) %} 4 | {% if resource.attributes | map(attribute='stability') | unique | length > 1 -%} 5 | {{ stability.badge("mixed", "") }} 6 | {%- else -%} 7 | {{ stability.badge(resource.stability, resource.deprecated) }} 8 | {%- endif %} 9 | {% endmacro %} 10 | {% macro header(resource) %} 11 | **Status:** {{ real_stability(resource) | trim }} 12 | 13 | **type:** `{{ resource.name }}` 14 | 15 | **Description:** {{ resource.brief }} 16 | {% endmacro %} -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request; 7 | 8 | import com.google.auto.value.AutoValue; 9 | import opamp.proto.AgentToServer; 10 | 11 | /** Wrapper class for "AgentToServer" request body. */ 12 | @AutoValue 13 | public abstract class Request { 14 | public abstract AgentToServer getAgentToServer(); 15 | 16 | public static Request create(AgentToServer agentToServer) { 17 | return new AutoValue_Request(agentToServer); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/files/reader/StreamReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.storage.files.reader; 7 | 8 | import java.io.Closeable; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import javax.annotation.Nullable; 12 | 13 | public interface StreamReader extends Closeable { 14 | @Nullable 15 | byte[] readNext() throws IOException; 16 | 17 | interface Factory { 18 | StreamReader create(InputStream stream); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/sampling_macros.j2: -------------------------------------------------------------------------------- 1 | {% import 'attribute_macros.j2' as attrs %} 2 | {% macro snippet(attributes, attribute_registry_base_url, lineage_attributes) %}{% set sampling_attributes = attributes | selectattr("sampling_relevant", "true") %}{% if sampling_attributes | length > 0 %} 3 | The following attributes can be important for making sampling decisions 4 | and SHOULD be provided **at span creation time** (if provided at all): 5 | 6 | {% for attribute in sampling_attributes | sort(attribute="name") %}* {{ attrs.name_with_link(attribute, attribute_registry_base_url, lineage_attributes) }} 7 | {% endfor %}{% endif %}{% endmacro %} 8 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/hadoop/yarn-site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | yarn.nodemanager.aux-services 5 | mapreduce_shuffle 6 | 7 | 8 | yarn.nodemanager.disk-health-checker.max-disk-utilization-per-disk-percentage 9 | 100 10 | 11 | 12 | yarn.nodemanager.resource.cpu-vcores 13 | 2 14 | 15 | 16 | yarn.nodemanager.resource.memory-mb 17 | 4096 18 | 19 | 20 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_1/src/main/java/io/opentelemetry/contrib/maven/test/springboot/SpringbootTestApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.maven.test.springboot; 7 | 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | 11 | @SpringBootApplication 12 | public class SpringbootTestApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(SpringbootTestApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/springboot_2/src/main/java/io/opentelemetry/contrib/maven/test/springboot/SpringbootTestApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.maven.test.springboot; 7 | 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | 11 | @SpringBootApplication 12 | public class SpringbootTestApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(SpringbootTestApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/util/ClockBuddy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.storage.util; 7 | 8 | import static java.util.concurrent.TimeUnit.NANOSECONDS; 9 | 10 | import io.opentelemetry.sdk.common.Clock; 11 | 12 | public class ClockBuddy { 13 | 14 | private ClockBuddy() {} 15 | 16 | /** Returns the current time in millis from the given clock */ 17 | public static final long nowMillis(Clock clock) { 18 | return NANOSECONDS.toMillis(clock.now()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jmx-scraper/test-webapp/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | servlet_name 8 | io.opentelemetry.contrib.jmxscraper.testwebapp.SimpleServlet 9 | 10 | 11 | servlet_name 12 | /* 13 | 14 | 15 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/delay/FixedPeriodicDelay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.delay; 7 | 8 | import java.time.Duration; 9 | 10 | final class FixedPeriodicDelay implements PeriodicDelay { 11 | private final Duration duration; 12 | 13 | public FixedPeriodicDelay(Duration duration) { 14 | this.duration = duration; 15 | } 16 | 17 | @Override 18 | public Duration getNextDelay() { 19 | return duration; 20 | } 21 | 22 | @Override 23 | public void reset() {} 24 | } 25 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/tools/SystemTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.tools; 7 | 8 | /** Utility to be able to mock the current system time for testing purposes. */ 9 | public final class SystemTime { 10 | private static final SystemTime INSTANCE = new SystemTime(); 11 | 12 | public static SystemTime getInstance() { 13 | return INSTANCE; 14 | } 15 | 16 | private SystemTime() {} 17 | 18 | public long getCurrentTimeMillis() { 19 | return System.currentTimeMillis(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/test/resources/vcap_application.json: -------------------------------------------------------------------------------- 1 | { 2 | "application_id": "0193a038-e615-7e5e-92ca-f4bcd7ba0a25", 3 | "application_name": "cf-app-name", 4 | "application_uris": [ 5 | "testapp.example.com" 6 | ], 7 | "cf_api": "https://api.cf.example.com", 8 | "limits": { 9 | "fds": 256 10 | }, 11 | "instance_index": 1, 12 | "organization_id": "0193a375-8d8e-7e0c-a832-01ce9ded40dc", 13 | "organization_name": "cf-org-name", 14 | "process_id": "0193a4e3-8fd3-71b9-9fe3-5640c53bf1e2", 15 | "process_type": "web", 16 | "space_id": "0193a7e7-da17-7ea4-8940-b1e07b401b16", 17 | "space_name": "cf-space-name", 18 | "users": null 19 | } 20 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/delay/AcceptsDelaySuggestion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.delay; 7 | 8 | import java.time.Duration; 9 | 10 | /** 11 | * A {@link PeriodicDelay} implementation that wants to accept delay time suggestions, as explained 12 | * here, 14 | * must implement this interface. 15 | */ 16 | public interface AcceptsDelaySuggestion { 17 | void suggestDelay(Duration delay); 18 | } 19 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/exporters/callback/NoopExporterCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.exporters.callback; 7 | 8 | import java.util.Collection; 9 | import javax.annotation.Nullable; 10 | 11 | public final class NoopExporterCallback implements ExporterCallback { 12 | 13 | @Override 14 | public void onExportSuccess(Collection items) {} 15 | 16 | @Override 17 | public void onExportError(Collection items, @Nullable Throwable error) {} 18 | 19 | @Override 20 | public void onShutdown() {} 21 | } 22 | -------------------------------------------------------------------------------- /.github/config/.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | # See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md 2 | # and https://github.com/DavidAnson/markdownlint-cli2 3 | 4 | config: 5 | ul-style: false 6 | line-length: false 7 | no-duplicate-heading: 8 | siblings_only: true 9 | ol-prefix: 10 | style: ordered 11 | no-inline-html: false 12 | fenced-code-language: false 13 | no-trailing-punctuation: 14 | punctuation: ".,;:" # allowing exclamation points and question marks at end of sentences 15 | 16 | ignores: 17 | - "**/build/**" 18 | - "**/node_modules/**" 19 | - "CHANGELOG.md" 20 | - "ibm-mq-metrics/docs/metrics.md" 21 | - ".github/pull_request_template.md" 22 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/AbstractAttachmentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach; 7 | 8 | import io.opentelemetry.javaagent.shaded.io.opentelemetry.api.trace.Span; 9 | import org.junit.jupiter.api.BeforeAll; 10 | 11 | class AbstractAttachmentTest { 12 | 13 | @BeforeAll 14 | static void disableMainThreadCheck() { 15 | System.setProperty("otel.javaagent.testing.runtime-attach.main-method-check", "false"); 16 | } 17 | 18 | boolean isAttached() { 19 | return Span.current().getSpanContext().isValid(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dynamic-control/README.md: -------------------------------------------------------------------------------- 1 | # Dynamic Control 2 | 3 | Adding dynamic control of some specific features of the Java agent. 4 | 5 | > [!WARNING] 6 | > This is an incubating feature. Breaking changes can happen on a new release without previous 7 | > notice and without backward compatibility guarantees. 8 | 9 | Current plans and progress is tracked in this [meta issue](https://github.com/open-telemetry/opentelemetry-java-contrib/issues/2416) 10 | 11 | ## Component owners 12 | 13 | - [Jack Shirazi](https://github.com/jackshirazi), Elastic 14 | - [Cesar Munoz](https://github.com/LikeTheSalad), Elastic 15 | 16 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 17 | -------------------------------------------------------------------------------- /.github/workflows/reusable-markdown-lint.yml: -------------------------------------------------------------------------------- 1 | name: Reusable - Markdown lint check 2 | 3 | on: 4 | workflow_call: 5 | 6 | permissions: 7 | contents: read 8 | 9 | jobs: 10 | markdown-lint-check: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 14 | 15 | - uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1 16 | 17 | - name: Run markdownlint 18 | run: | 19 | if ! mise run lint:markdown; then 20 | echo "markdownlint failed. To auto-fix many issues locally, run:" 21 | echo " mise run lint:markdown --fix" 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | < Describe what is being changed or added. 4 | Ex. Bug fix - Describe the bug and how this fixes it. 5 | Ex. Feature addition - Describe what this provides and why. > 6 | 7 | **Existing Issue(s):** 8 | 9 | < Link any applicable issues. > 10 | 11 | **Testing:** 12 | 13 | < Describe what testing was performed and any tests were added. > 14 | 15 | **Documentation:** 16 | 17 | < Describe the documentation added. 18 | Please be sure to modify relevant existing documentation if needed. > 19 | 20 | **Outstanding items:** 21 | 22 | < Anything that these changes are intentionally missing 23 | that will be needed or can be helpful in the future. > 24 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/main/java/io/opentelemetry/contrib/cloudfoundry/resources/CloudFoundryResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.cloudfoundry.resources; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | public final class CloudFoundryResourceProvider implements ResourceProvider { 13 | 14 | @Override 15 | public Resource createResource(ConfigProperties configProperties) { 16 | return CloudFoundryResource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/RValueGenerators.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent; 7 | 8 | final class RValueGenerators { 9 | 10 | private static final RValueGenerator DEFAULT = createDefault(); 11 | 12 | static RValueGenerator getDefault() { 13 | return DEFAULT; 14 | } 15 | 16 | private static RValueGenerator createDefault() { 17 | RandomGenerator randomGenerator = RandomGenerator.getDefault(); 18 | return s -> randomGenerator.numberOfLeadingZerosOfRandomLong(); 19 | } 20 | 21 | private RValueGenerators() {} 22 | } 23 | -------------------------------------------------------------------------------- /jmx-scraper/src/main/java/io/opentelemetry/contrib/jmxscraper/InvalidArgumentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper; 7 | 8 | /** 9 | * Exception indicating something is wrong with the provided arguments or reading the configuration 10 | * from them 11 | */ 12 | public final class InvalidArgumentException extends Exception { 13 | 14 | private static final long serialVersionUID = 0L; 15 | 16 | public InvalidArgumentException(String msg) { 17 | super(msg); 18 | } 19 | 20 | public InvalidArgumentException(String msg, Throwable cause) { 21 | super(msg, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /compressors/compressor-zstd/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "zstd compressor implementation for use with OTLP exporters" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.compressor.zstd") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-exporter-common") 11 | 12 | implementation("com.github.luben:zstd-jni:1.5.7-6") 13 | 14 | testImplementation("io.opentelemetry:opentelemetry-sdk-testing") 15 | testImplementation("io.opentelemetry:opentelemetry-exporter-otlp") 16 | 17 | testImplementation("io.opentelemetry.proto:opentelemetry-proto") 18 | testImplementation("com.linecorp.armeria:armeria-junit5") 19 | } 20 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/Ec2ResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | /** {@link ResourceProvider} for automatically configuring {@link Ec2Resource}. */ 13 | public final class Ec2ResourceProvider extends CloudResourceProvider { 14 | @Override 15 | public Resource createResource(ConfigProperties config) { 16 | return Ec2Resource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/EcsResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | /** {@link ResourceProvider} for automatically configuring {@link EcsResource}. */ 13 | public final class EcsResourceProvider extends CloudResourceProvider { 14 | @Override 15 | public Resource createResource(ConfigProperties config) { 16 | return EcsResource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/EksResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | /** {@link ResourceProvider} for automatically configuring {@link EksResource}. */ 13 | public final class EksResourceProvider extends CloudResourceProvider { 14 | @Override 15 | public Resource createResource(ConfigProperties config) { 16 | return EksResource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jfr-events/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "OpenTelemetry JFR Events" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.jfrevent") 8 | 9 | dependencies { 10 | implementation("io.opentelemetry:opentelemetry-sdk") 11 | } 12 | 13 | tasks { 14 | withType(JavaCompile::class) { 15 | options.release.set(11) 16 | } 17 | 18 | test { 19 | val testJavaVersion: String? by project 20 | if (testJavaVersion == "8") { 21 | enabled = false 22 | } 23 | 24 | // Disabled due to https://bugs.openjdk.java.net/browse/JDK-8245283 25 | configure { 26 | enabled = false 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/LambdaResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | /** {@link ResourceProvider} for automatically configuring {@link LambdaResource}. */ 13 | public final class LambdaResourceProvider extends CloudResourceProvider { 14 | @Override 15 | public Resource createResource(ConfigProperties config) { 16 | return LambdaResource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56/RandomValueGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | /** 9 | * A function for generating random values. 10 | * 11 | *

The distribution of random values generated by this function must be uniform over the range 12 | * [0,2^56-1] 13 | */ 14 | @FunctionalInterface 15 | public interface RandomValueGenerator { 16 | 17 | /** 18 | * Returns a 56-bit uniformly distributed random value. 19 | * 20 | * @param traceId the trace ID 21 | * @return the random value 22 | */ 23 | long generate(String traceId); 24 | } 25 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/BeanstalkResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | /** {@link ResourceProvider} for automatically configuring {@link BeanstalkResource}. */ 13 | public final class BeanstalkResourceProvider extends CloudResourceProvider { 14 | @Override 15 | public Resource createResource(ConfigProperties config) { 16 | return BeanstalkResource.get(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentAlwaysOnSampler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent; 7 | 8 | import javax.annotation.concurrent.Immutable; 9 | 10 | @Immutable 11 | final class ConsistentAlwaysOnSampler extends ConsistentSampler { 12 | 13 | ConsistentAlwaysOnSampler(RValueGenerator rValueGenerator) { 14 | super(rValueGenerator); 15 | } 16 | 17 | @Override 18 | protected int getP(int parentP, boolean isRoot) { 19 | return 0; 20 | } 21 | 22 | @Override 23 | public String getDescription() { 24 | return "ConsistentAlwaysOnSampler"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentAlwaysOffSampler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent; 7 | 8 | import javax.annotation.concurrent.Immutable; 9 | 10 | @Immutable 11 | final class ConsistentAlwaysOffSampler extends ConsistentSampler { 12 | 13 | ConsistentAlwaysOffSampler(RValueGenerator rValueGenerator) { 14 | super(rValueGenerator); 15 | } 16 | 17 | @Override 18 | protected int getP(int parentP, boolean isRoot) { 19 | return OtelTraceState.getMaxP(); 20 | } 21 | 22 | @Override 23 | public String getDescription() { 24 | return "ConsistentAlwaysOffSampler"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/RunTimeAttachBasicTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.instrumentation.annotations.WithSpan; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class RunTimeAttachBasicTest extends AbstractAttachmentTest { 14 | 15 | @Test 16 | void shouldAttach() { 17 | RuntimeAttach.attachJavaagentToCurrentJvm(); 18 | verifyAttachment(); 19 | } 20 | 21 | @WithSpan 22 | void verifyAttachment() { 23 | assertThat(isAttached()).as("Agent should be attached").isTrue(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/RequestRecipe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe; 7 | 8 | import io.opentelemetry.opamp.client.internal.request.Field; 9 | import java.util.Collection; 10 | 11 | /** 12 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 13 | * any time. 14 | */ 15 | public final class RequestRecipe { 16 | private final Collection fields; 17 | 18 | public RequestRecipe(Collection fields) { 19 | this.fields = fields; 20 | } 21 | 22 | public Collection getFields() { 23 | return fields; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request; 7 | 8 | /** 9 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 10 | * any time. 11 | * 12 | *

List of supported AgentToServer 14 | * message fields. 15 | */ 16 | public enum Field { 17 | INSTANCE_UID, 18 | SEQUENCE_NUM, 19 | AGENT_DESCRIPTION, 20 | CAPABILITIES, 21 | EFFECTIVE_CONFIG, 22 | REMOTE_CONFIG_STATUS, 23 | AGENT_DISCONNECT, 24 | FLAGS 25 | } 26 | -------------------------------------------------------------------------------- /ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/QueueCollectorSharedState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.ibm.mq.metricscollector; 7 | 8 | import java.util.concurrent.ConcurrentHashMap; 9 | import javax.annotation.Nullable; 10 | 11 | final class QueueCollectorSharedState { 12 | 13 | private final ConcurrentHashMap queueNameToType = new ConcurrentHashMap<>(); 14 | 15 | QueueCollectorSharedState() {} 16 | 17 | public void putQueueType(String name, String value) { 18 | queueNameToType.put(name, value); 19 | } 20 | 21 | @Nullable 22 | public String getType(String name) { 23 | return queueNameToType.get(name); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/hbase/hbase-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set environment variables here. 4 | 5 | # This script sets variables multiple times over the course of starting an hbase process, 6 | # so try to keep things idempotent unless you want to take an even deeper look 7 | # into the startup scripts (bin/hbase, etc.) 8 | 9 | # The java implementation to use. Java 1.8+ required. 10 | export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 11 | export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC" 12 | export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 13 | export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.rmi.port=9900 -Dcom.sun.management.jmxremote.port=9900" 14 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/resources/validConfig.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.service.url=service:jmx:rmi:///jndi/rmi://myhost:12345/jmxrmi 2 | otel.jmx.config=/my/scraping-config.yaml 3 | otel.jmx.target.system=jvm,cassandra 4 | otel.metrics.exporter=otlp 5 | otel.metric.export.interval=1000 6 | otel.exporter.otlp.endpoint=https://myotlpendpoint 7 | otel.jmx.username=myUser\n\ 8 | name 9 | otel.jmx.password=myPassw\\ord 10 | otel.jmx.remote.profile=SASL/DIG\EST-MD5 11 | otel.jmx.realm=myRealm 12 | otel.resource.attributes=one=two,three=four 13 | javax.net.ssl.keyStore=/my/key/store 14 | javax.net.ssl.keyStorePassword=abc123 15 | javax.net.ssl.keyStoreType=JKS 16 | javax.net.ssl.trustStore=/my/trust/store 17 | javax.net.ssl.trustStorePassword=def456 18 | javax.net.ssl.trustStoreType=JKS 19 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach-core/src/main/java/io/opentelemetry/contrib/attach/core/RuntimeAttachException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach.core; 7 | 8 | /** 9 | * Exception that gets thrown if a problem occurs during the attachment of the OpenTelemetry agent. 10 | */ 11 | public final class RuntimeAttachException extends RuntimeException { 12 | 13 | private static final long serialVersionUID = 1982913847038355735L; 14 | 15 | private RuntimeAttachException() {} 16 | 17 | RuntimeAttachException(String message) { 18 | super(message); 19 | } 20 | 21 | RuntimeAttachException(String message, Throwable cause) { 22 | super(message, cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent56/RandomValueGeneratorsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.getMaxRandomValue; 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | import org.junit.jupiter.api.Test; 12 | 13 | class RandomValueGeneratorsTest { 14 | @Test 15 | void testRandomRange() { 16 | int attempts = 10000; 17 | for (int i = 0; i < attempts; ++i) { 18 | assertThat(RandomValueGenerators.getDefault().generate("")) 19 | .isBetween(0L, getMaxRandomValue()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/serialization/mapping/common/ByteStringMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.common; 7 | 8 | import okio.ByteString; 9 | 10 | public final class ByteStringMapper { 11 | 12 | private static final ByteStringMapper INSTANCE = new ByteStringMapper(); 13 | 14 | public static ByteStringMapper getInstance() { 15 | return INSTANCE; 16 | } 17 | 18 | public ByteString stringToProto(String source) { 19 | return ByteString.decodeHex(source); 20 | } 21 | 22 | public String protoToString(ByteString source) { 23 | return source.hex(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/jar/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | io.opentelemetry.contrib.maven 7 | test-jar 8 | 1.0-SNAPSHOT 9 | 10 | 11 | UTF-8 12 | 13 | 14 | 15 | 16 | releases 17 | https://maven.example.com/repository/maven-releases/ 18 | 19 | 20 | snapshots 21 | https://maven.example.com/repository/maven-snapshots/ 22 | 23 | 24 | -------------------------------------------------------------------------------- /aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/CloudResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.aws.resource; 7 | 8 | import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER; 9 | 10 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ConditionalResourceProvider; 12 | import io.opentelemetry.sdk.resources.Resource; 13 | 14 | abstract class CloudResourceProvider implements ConditionalResourceProvider { 15 | @Override 16 | public final boolean shouldApply(ConfigProperties config, Resource existing) { 17 | return existing.getAttribute(CLOUD_PROVIDER) == null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/GetSamplingRulesRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.awsxray; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 10 | import com.google.auto.value.AutoValue; 11 | import javax.annotation.Nullable; 12 | 13 | @AutoValue 14 | @JsonSerialize(as = GetSamplingRulesRequest.class) 15 | abstract class GetSamplingRulesRequest { 16 | 17 | static GetSamplingRulesRequest create(@Nullable String nextToken) { 18 | return new AutoValue_GetSamplingRulesRequest(nextToken); 19 | } 20 | 21 | @JsonProperty("NextToken") 22 | @Nullable 23 | abstract String getNextToken(); 24 | } 25 | -------------------------------------------------------------------------------- /cel-sampler/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Sampler which makes its decision based on semantic attributes values" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.sampler.cel") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-sdk") 11 | 12 | implementation("dev.cel:cel:0.11.1") 13 | 14 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 15 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-incubator") 16 | 17 | testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating") 18 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 19 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator") 20 | } 21 | -------------------------------------------------------------------------------- /ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/config/ResourceFilters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.ibm.mq.config; 7 | 8 | import java.util.HashSet; 9 | import java.util.Set; 10 | 11 | public final class ResourceFilters { 12 | 13 | private Set include = new HashSet<>(); 14 | private Set exclude = new HashSet<>(); 15 | 16 | public Set getInclude() { 17 | return include; 18 | } 19 | 20 | public void setInclude(Set include) { 21 | this.include = include; 22 | } 23 | 24 | public Set getExclude() { 25 | return exclude; 26 | } 27 | 28 | public void setExclude(Set exclude) { 29 | this.exclude = exclude; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/service/DaemonThreadFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.service; 7 | 8 | import java.util.concurrent.Executors; 9 | import java.util.concurrent.ThreadFactory; 10 | import javax.annotation.Nonnull; 11 | 12 | final class DaemonThreadFactory implements ThreadFactory { 13 | private final ThreadFactory delegate = Executors.defaultThreadFactory(); 14 | 15 | @Override 16 | public Thread newThread(@Nonnull Runnable r) { 17 | Thread t = delegate.newThread(r); 18 | try { 19 | t.setDaemon(true); 20 | } catch (SecurityException e) { 21 | // Well, we tried. 22 | } 23 | return t; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/storage/result/DefaultWriteResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.storage.result; 7 | 8 | import javax.annotation.Nullable; 9 | 10 | final class DefaultWriteResult implements WriteResult { 11 | private final boolean successful; 12 | @Nullable private final Throwable error; 13 | 14 | DefaultWriteResult(boolean successful, @Nullable Throwable error) { 15 | this.successful = successful; 16 | this.error = error; 17 | } 18 | 19 | @Override 20 | public boolean isSuccessful() { 21 | return successful; 22 | } 23 | 24 | @Nullable 25 | @Override 26 | public Throwable getError() { 27 | return error; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/java/io/opentelemetry/contrib/jmxscraper/config/TestUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.config; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | import java.util.Properties; 13 | 14 | public class TestUtil { 15 | 16 | private TestUtil() {} 17 | 18 | public static ConfigProperties configProperties(Properties properties) { 19 | Map map = new HashMap<>(); 20 | properties.forEach((k, v) -> map.put((String) k, (String) v)); 21 | return DefaultConfigProperties.createFromMap(map); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /consistent-sampling/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Sampler and exporter implementations for consistent sampling" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.sampler") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-sdk-trace") 11 | api("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 12 | testImplementation("org.hipparchus:hipparchus-core:4.0.2") 13 | testImplementation("org.hipparchus:hipparchus-stat:4.0.2") 14 | } 15 | 16 | tasks { 17 | withType().configureEach { 18 | develocity.testRetry { 19 | // TODO (trask) fix flaky tests and remove this workaround 20 | if (System.getenv().containsKey("CI")) { 21 | maxRetries.set(5) 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /maven-extension/src/test/java/io/opentelemetry/maven/AutoConfigureUtil2Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; 9 | import java.lang.reflect.Method; 10 | import org.junit.jupiter.api.Test; 11 | 12 | class AutoConfigureUtil2Test { 13 | 14 | /** 15 | * Verify the reflection call works with the current version of AutoConfiguredOpenTelemetrySdk. 16 | * 17 | * @throws NoSuchMethodException if the method does not exist 18 | */ 19 | @Test 20 | void test_getResource() throws NoSuchMethodException { 21 | Method method = AutoConfiguredOpenTelemetrySdk.class.getDeclaredMethod("getResource"); 22 | method.setAccessible(true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/AgentDisabledBySystemPropertyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.instrumentation.annotations.WithSpan; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class AgentDisabledBySystemPropertyTest extends AbstractAttachmentTest { 14 | 15 | @Test 16 | void shouldNotAttachWhenAgentDisabledWithProperty() { 17 | RuntimeAttach.attachJavaagentToCurrentJvm(); 18 | verifyNoAttachment(); 19 | } 20 | 21 | @WithSpan 22 | void verifyNoAttachment() { 23 | assertThat(isAttached()).as("Agent should not be attached").isFalse(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samplers/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Sampler which makes its decision based on semantic attributes values" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.sampler") 8 | 9 | dependencies { 10 | api("io.opentelemetry:opentelemetry-sdk") 11 | 12 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 13 | compileOnly("io.opentelemetry:opentelemetry-api-incubator") 14 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-incubator") 15 | 16 | testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating") 17 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 18 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator") 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # No jars 5 | *.jar 6 | 7 | # Log file 8 | *.log 9 | 10 | # BlueJ files 11 | *.ctxt 12 | 13 | # Mobile Tools for Java (J2ME) 14 | .mtj.tmp/ 15 | 16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 17 | hs_err_pid* 18 | 19 | # IntelliJ 20 | *.idea 21 | *.iml 22 | 23 | # Gradle 24 | build 25 | .gradle 26 | local.properties 27 | out/ 28 | 29 | # Maven (proto) 30 | target 31 | 32 | # Eclipse 33 | .classpath 34 | .project 35 | .settings 36 | bin 37 | 38 | # NetBeans 39 | /.nb-gradle 40 | /.nb-gradle-properties 41 | 42 | # VS Code 43 | .vscode 44 | 45 | # etc 46 | .DS_Store 47 | 48 | # Emacs 49 | *~ 50 | \#*\# 51 | 52 | # Vim 53 | .swp 54 | 55 | .gitpod.yml 56 | 57 | # Gradle build scans 58 | build-scan.txt 59 | 60 | # Node 61 | node_modules 62 | -------------------------------------------------------------------------------- /jmx-scraper/test-webapp/src/main/java/io/opentelemetry/contrib/jmxscraper/testwebapp/SimpleServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.testwebapp; 7 | 8 | import jakarta.servlet.http.HttpServlet; 9 | import jakarta.servlet.http.HttpServletRequest; 10 | import jakarta.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | 14 | public class SimpleServlet extends HttpServlet { 15 | 16 | private static final long serialVersionUID = 3726145372238690099L; 17 | 18 | @Override 19 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 20 | try (PrintWriter out = resp.getWriter()) { 21 | out.write("hello!"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samplers/src/main/java/io/opentelemetry/contrib/sampler/LinksParentAlwaysOnSamplerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider; 10 | import io.opentelemetry.sdk.trace.samplers.Sampler; 11 | 12 | public final class LinksParentAlwaysOnSamplerProvider implements ConfigurableSamplerProvider { 13 | @Override 14 | public Sampler createSampler(ConfigProperties config) { 15 | return LinksBasedSampler.create(Sampler.parentBased(Sampler.alwaysOn())); 16 | } 17 | 18 | @Override 19 | public String getName() { 20 | return "linksbased_parentbased_always_on"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56/RandomValueGenerators.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.getMaxRandomValue; 9 | 10 | import java.util.concurrent.ThreadLocalRandom; 11 | 12 | final class RandomValueGenerators { 13 | 14 | private static final RandomValueGenerator DEFAULT = createDefault(); 15 | 16 | static RandomValueGenerator getDefault() { 17 | return DEFAULT; 18 | } 19 | 20 | private static RandomValueGenerator createDefault() { 21 | return s -> ThreadLocalRandom.current().nextLong() & getMaxRandomValue(); 22 | } 23 | 24 | private RandomValueGenerators() {} 25 | } 26 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach/src/test/java/io/opentelemetry/contrib/attach/AgentDisabledByEnvironmentVariableTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.instrumentation.annotations.WithSpan; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class AgentDisabledByEnvironmentVariableTest extends AbstractAttachmentTest { 14 | 15 | @Test 16 | void shouldNotAttachWhenAgentDisabledWithEnvVariable() { 17 | RuntimeAttach.attachJavaagentToCurrentJvm(); 18 | verifyNoAttachment(); 19 | } 20 | 21 | @WithSpan 22 | void verifyNoAttachment() { 23 | assertThat(isAttached()).as("Agent should not be attached").isFalse(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /cel-sampler/src/test/resources/cel-sampler-config.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://github.com/open-telemetry/opentelemetry-configuration/raw/refs/tags/v1.0.0-rc.2/schema/opentelemetry_configuration.json 2 | file_format: 1.0-rc.2 3 | tracer_provider: 4 | sampler: 5 | parent_based: 6 | root: 7 | cel_based: 8 | fallback_sampler: 9 | always_on: 10 | expressions: 11 | - action: DROP 12 | expression: '"example.com" in attribute["http.response.header.host"] && attribute["http.response.status_code"] == 200' 13 | - action: DROP 14 | expression: spanKind == "SERVER" && attribute["url.path"].matches("/actuator.*") 15 | - action: RECORD_AND_SAMPLE 16 | expression: spanKind == "SERVER" && attribute["url.path"].matches("/actuator.*") 17 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http/HttpErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.connectivity.http; 7 | 8 | public class HttpErrorException extends Exception { 9 | private final int errorCode; 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public int getErrorCode() { 14 | return errorCode; 15 | } 16 | 17 | /** 18 | * Constructs an HTTP error related exception. 19 | * 20 | * @param errorCode The HTTP error code. 21 | * @param message The HTTP error message associated with the code. 22 | */ 23 | public HttpErrorException(int errorCode, String message) { 24 | super(message); 25 | this.errorCode = errorCode; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /kafka-exporter/README.md: -------------------------------------------------------------------------------- 1 | # Exporting SpanData to Kafka 2 | 3 | This module contains `KafkaSpanExporter`, which is an implementation of the `io.opentelemetry.sdk.trace.export.SpanExporter` interface. 4 | 5 | `KafkaSpanExporter` can be used for sending `SpanData` to a Kafka topic. 6 | 7 | ## Usage 8 | 9 | In order to instantiate a `KafkaSpanExporter`, you either need to pass a Kafka `Producer` or the configuration of a Kafka `Producer` together with key and value serializers. 10 | You also need to pass the topic to which the SpanData need to be sent. 11 | For a sample usage, see `KafkaSpanExporterIntegrationTest`. 12 | 13 | ## Component owners 14 | 15 | - [Alessandro Vermeulen](https://github.com/spockz) 16 | - [Vincent Free](https://github.com/vincentfree) 17 | 18 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 19 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/resources/MavenResourceDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven.resources; 7 | 8 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | public class MavenResourceDetector implements ComponentProvider { 13 | 14 | @Override 15 | public Class getType() { 16 | return Resource.class; 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return "maven"; 22 | } 23 | 24 | @Override 25 | public Resource create(DeclarativeConfigProperties config) { 26 | return MavenResourceProvider.create(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /maven-extension/src/test/java/io/opentelemetry/maven/handler/MojoGoalExecutionHandlerConfigurationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven.handler; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.maven.MavenGoal; 11 | import io.opentelemetry.maven.OtelExecutionListener; 12 | import java.util.Map; 13 | import org.junit.jupiter.api.Test; 14 | 15 | class MojoGoalExecutionHandlerConfigurationTest { 16 | @Test 17 | void mojoGoalExecutionHandlers() { 18 | Map actual = 19 | MojoGoalExecutionHandlerConfiguration.loadMojoGoalExecutionHandler( 20 | OtelExecutionListener.class.getClassLoader()); 21 | assertThat(actual.size()).isEqualTo(5); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jfr-connection/src/main/java/io/opentelemetry/contrib/jfr/connection/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | /** 7 | * This package provides API for controlling Java Flight Recordings (JFR) through Java Management 8 | * Extensions (JMX). The main entry point is {@link 9 | * io.opentelemetry.contrib.jfr.connection.FlightRecorderConnection}. 10 | * 11 | *

JDK 9 introduced the {@code jdk.jfr} API which is not available in JDK 8. The {@code 12 | * jdk.management.jfr.FlightRecorderMXBean} is available in OpenJDK 8u262 and higher. By relying on 13 | * JMX and the {@code jdk.management.jfr.FlightRecorderMXBean}, the {@code 14 | * io.opentelemetry.contrib.jfr.connection} package provides access to JFR on local or remote JVMs. 15 | */ 16 | package io.opentelemetry.contrib.jfr.connection; 17 | -------------------------------------------------------------------------------- /aws-xray-propagator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | 4 | id("otel.publish-conventions") 5 | } 6 | 7 | description = "OpenTelemetry AWS X-Ray Propagator" 8 | otelJava.moduleName.set("io.opentelemetry.contrib.awsxray.propagator") 9 | 10 | dependencies { 11 | api("io.opentelemetry:opentelemetry-api") 12 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 13 | compileOnly("io.opentelemetry:opentelemetry-api-incubator") 14 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 15 | testImplementation("io.opentelemetry:opentelemetry-sdk-trace") 16 | testImplementation("io.opentelemetry:opentelemetry-sdk-testing") 17 | 18 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator") 19 | testImplementation("uk.org.webcompere:system-stubs-jupiter:2.0.3") 20 | } 21 | -------------------------------------------------------------------------------- /inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/util/DisabledOnOpenJ9.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.util; 7 | 8 | import java.lang.annotation.Documented; 9 | import java.lang.annotation.ElementType; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | import java.lang.annotation.Target; 13 | import org.junit.jupiter.api.extension.ExtendWith; 14 | 15 | @Target({ElementType.TYPE, ElementType.METHOD}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | @ExtendWith(DisabledOnOpenJ9Condition.class) 19 | public @interface DisabledOnOpenJ9 { 20 | 21 | /** The reason this annotated test class or test method is disabled. */ 22 | String value() default ""; 23 | } 24 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/AgentToServerAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import opamp.proto.AgentToServer; 9 | 10 | /** 11 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 12 | * any time. 13 | * 14 | *

AgentToServer request builder appender. Each implementation should match one of the 15 | * AgentToServer fields and ensure the field is added to a request. 16 | */ 17 | public interface AgentToServerAppender { 18 | /** 19 | * Appends its data to the builder. 20 | * 21 | * @param builder The AgentToServer message builder. 22 | */ 23 | void appendTo(AgentToServer.Builder builder); 24 | } 25 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/notes.j2: -------------------------------------------------------------------------------- 1 | {%- set ns = namespace(notes=[],index=0) -%} 2 | {%- macro add(note) %}{% if note.note %}{% set ns.notes = [ns.notes, [note]] | flatten %} [{{ ns.notes | length + ns.index }}]{% endif %}{% endmacro %} 3 | {%- macro add_with_limit(note) %}{% if note.note | length > 50 %}{% set ns.notes = [ns.notes, [note]] | flatten %} [{{ ns.notes | length + ns.index }}]{% elif note.note %} {{ note.note | trim }}{% endif %}{% endmacro %} 4 | {% macro render() %}{% if ns.notes | length > 0 %} 5 | {%- for note in ns.notes %} 6 | {% if note.name %}**[{{ns.index+loop.index}}] `{{note.name}}`:** {{ note.note | trim }}{% else -%}**[{{ns.index+loop.index}}]:** {{ note.note | trim }} {%- endif -%} 7 | {%- if not loop.last -%}{{"\n"}}{%- endif -%} 8 | {% endfor %}{% set ns.index = ns.notes | length + ns.index %}{% set ns.notes = [] %} 9 | {% endif %}{% endmacro %} 10 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/stability.j2: -------------------------------------------------------------------------------- 1 | {% macro badge(stability, deprecated) -%} 2 | {%- if deprecated %}![Deprecated](https://img.shields.io/badge/-deprecated-red)
{{ deprecated.note | trim }} 3 | {%- elif stability == "mixed" %}![Mixed](https://img.shields.io/badge/-mixed-yellow) 4 | {%- elif stability == "stable" %}![Stable](https://img.shields.io/badge/-stable-lightgreen) 5 | {%- elif stability == "release_candidate" %}![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) 6 | {%- elif stability == "deprecated" %}![Deprecated](https://img.shields.io/badge/-deprecated-red) 7 | {%- elif stability == "experimental" %}![Development](https://img.shields.io/badge/-development-blue) 8 | {%- elif stability == "development" %}![Development](https://img.shields.io/badge/-development-blue) 9 | {%- else %}{{ "Unknown stability." }} 10 | {%- endif %} 11 | {%- endmacro %} 12 | -------------------------------------------------------------------------------- /maven-extension/src/test/java/io/opentelemetry/maven/MavenUtilsTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import org.junit.jupiter.api.Test; 11 | 12 | class MavenUtilsTests { 13 | 14 | @Test 15 | public void getPluginArtifactIdShortName_builtinPluginName() { 16 | String actual = MavenUtils.getPluginArtifactIdShortName("maven-clean-plugin"); 17 | String expected = "clean"; 18 | assertThat(actual).isEqualTo(expected); 19 | } 20 | 21 | @Test 22 | public void getPluginArtifactIdShortName_thirdPartyPluginName() { 23 | String actual = MavenUtils.getPluginArtifactIdShortName("spotbugs-maven-plugin"); 24 | String expected = "spotbugs"; 25 | assertThat(actual).isEqualTo(expected); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/assign-reviewers.yml: -------------------------------------------------------------------------------- 1 | # assigns reviewers to pull requests in a similar way as CODEOWNERS, but doesn't require reviewers 2 | # to have write access to the repository 3 | # see .github/component_owners.yaml for the list of components and their owners 4 | name: Assign reviewers 5 | 6 | on: 7 | # pull_request_target is needed instead of just pull_request 8 | # because repository write permission is needed to assign reviewers 9 | pull_request_target: 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | assign-reviewers: 16 | permissions: 17 | contents: read 18 | pull-requests: write # for assigning reviewers 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: dyladan/component-owners@58bd86e9814d23f1525d0a970682cead459fa783 # v0.1.0 22 | with: 23 | config-file: .github/component_owners.yml 24 | assign-owners: false 25 | -------------------------------------------------------------------------------- /jmx-scraper/src/main/java/io/opentelemetry/contrib/jmxscraper/config/PropertiesSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.config; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.Properties; 11 | import java.util.function.Supplier; 12 | 13 | /** Configuration supplier for java properties */ 14 | public final class PropertiesSupplier implements Supplier> { 15 | 16 | private final Properties properties; 17 | 18 | public PropertiesSupplier(Properties properties) { 19 | this.properties = properties; 20 | } 21 | 22 | @Override 23 | public Map get() { 24 | Map map = new HashMap<>(); 25 | properties.forEach((k, v) -> map.put((String) k, (String) v)); 26 | return map; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http/HttpSender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.connectivity.http; 7 | 8 | import java.io.Closeable; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.io.OutputStream; 12 | import java.util.concurrent.CompletableFuture; 13 | 14 | public interface HttpSender { 15 | 16 | CompletableFuture send(BodyWriter writer, int contentLength); 17 | 18 | interface BodyWriter { 19 | void writeTo(OutputStream outputStream) throws IOException; 20 | } 21 | 22 | interface Response extends Closeable { 23 | int statusCode(); 24 | 25 | String statusMessage(); 26 | 27 | InputStream bodyInputStream(); 28 | 29 | String getHeader(String name); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /runtime-attach/runtime-attach/src/main/java/io/opentelemetry/contrib/attach/RuntimeAttach.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.attach; 7 | 8 | import io.opentelemetry.contrib.attach.core.CoreRuntimeAttach; 9 | 10 | /** This class allows you to attach the OpenTelemetry Java agent at runtime. */ 11 | public final class RuntimeAttach { 12 | 13 | /** 14 | * Attach the OpenTelemetry Java agent to the current JVM. The attachment must be requested at the 15 | * beginning of the main method. 16 | */ 17 | @SuppressWarnings("MemberName") 18 | public static void attachJavaagentToCurrentJvm() { 19 | 20 | CoreRuntimeAttach distroRuntimeAttach = new CoreRuntimeAttach("/otel-agent.jar"); 21 | 22 | distroRuntimeAttach.attachJavaagentToCurrentJvm(); 23 | } 24 | 25 | private RuntimeAttach() {} 26 | } 27 | -------------------------------------------------------------------------------- /inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/util/AutoConfigTestProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.util; 7 | 8 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 9 | import javax.annotation.Nullable; 10 | 11 | public class AutoConfigTestProperties extends TemporaryProperties { 12 | 13 | public AutoConfigTestProperties() { 14 | put("otel.java.global-autoconfigure.enabled", "true"); 15 | put("otel.traces.exporter", "logging"); 16 | put("otel.metrics.exporter", "logging"); 17 | put("otel.logs.exporter", "logging"); 18 | } 19 | 20 | @Override 21 | @CanIgnoreReturnValue 22 | public AutoConfigTestProperties put(String key, @Nullable String value) { 23 | super.put(key, value); 24 | return this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cloudfoundry-resources/src/main/java/io/opentelemetry/contrib/cloudfoundry/resources/CloudFoundryResourceDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.cloudfoundry.resources; 7 | 8 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 10 | import io.opentelemetry.sdk.resources.Resource; 11 | 12 | public final class CloudFoundryResourceDetector implements ComponentProvider { 13 | 14 | @Override 15 | public Class getType() { 16 | return Resource.class; 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return "cloud_foundry"; 22 | } 23 | 24 | @Override 25 | public Resource create(DeclarativeConfigProperties config) { 26 | return CloudFoundryResource.get(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/ResourceComponentProviderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.gcp.resource; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.common.ComponentLoader; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 12 | import org.junit.jupiter.api.Test; 13 | 14 | class ResourceComponentProviderTest { 15 | 16 | @Test 17 | @SuppressWarnings("rawtypes") 18 | void providerIsLoaded() { 19 | Iterable providers = 20 | ComponentLoader.forClassLoader(ResourceComponentProviderTest.class.getClassLoader()) 21 | .load(ComponentProvider.class); 22 | assertThat(providers).extracting(ComponentProvider::getName).containsExactly("gcp"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/AgentDisconnectAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import opamp.proto.AgentDisconnect; 9 | import opamp.proto.AgentToServer; 10 | 11 | /** 12 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 13 | * any time. 14 | */ 15 | public final class AgentDisconnectAppender implements AgentToServerAppender { 16 | 17 | public static AgentDisconnectAppender create() { 18 | return new AgentDisconnectAppender(); 19 | } 20 | 21 | private AgentDisconnectAppender() {} 22 | 23 | @Override 24 | public void appendTo(AgentToServer.Builder builder) { 25 | builder.agent_disconnect(new AgentDisconnect.Builder().build()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent56/TestUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.HEX_DIGITS; 9 | 10 | import java.util.SplittableRandom; 11 | 12 | public final class TestUtil { 13 | 14 | private TestUtil() {} 15 | 16 | static String generateRandomTraceId(SplittableRandom random) { 17 | StringBuilder sb = new StringBuilder(16); 18 | long hi = random.nextLong(); 19 | long lo = random.nextLong(); 20 | for (int i = 0; i < 64; i += 4) { 21 | sb.append(HEX_DIGITS[(int) (hi >>> i) & 0xF]); 22 | } 23 | for (int i = 0; i < 64; i += 4) { 24 | sb.append(HEX_DIGITS[(int) (lo >>> i) & 0xF]); 25 | } 26 | return sb.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /maven-extension/src/main/resources/META-INF/maven/extension.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | io.opentelemetry.api 5 | io.opentelemetry.api.* 6 | io.opentelemetry.api.baggage 7 | io.opentelemetry.api.baggage.propagation 8 | io.opentelemetry.api.common 9 | io.opentelemetry.api.internal 10 | io.opentelemetry.api.metrics 11 | io.opentelemetry.api.trace 12 | io.opentelemetry.context 13 | io.opentelemetry.context.propagation 14 | 15 | 16 | -------------------------------------------------------------------------------- /resource-providers/src/test/java/io/opentelemetry/contrib/resourceproviders/ResourceComponentProviderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.resourceproviders; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import io.opentelemetry.common.ComponentLoader; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 12 | import org.junit.jupiter.api.Test; 13 | 14 | class ResourceComponentProviderTest { 15 | 16 | @Test 17 | @SuppressWarnings("rawtypes") 18 | void providerIsLoaded() { 19 | Iterable providers = 20 | ComponentLoader.forClassLoader(ResourceComponentProviderTest.class.getClassLoader()) 21 | .load(ComponentProvider.class); 22 | assertThat(providers).extracting(ComponentProvider::getName).contains("app_server"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jmx-metrics/src/test/resources/all.properties: -------------------------------------------------------------------------------- 1 | otel.jmx.service.url=service:jmx:rmi:///jndi/rmi://myhost:12345/jmxrmi 2 | otel.jmx.groovy.script=/my/groovy/script 3 | otel.jmx.target.system=jvm,cassandra 4 | otel.jmx.interval.milliseconds=20000 5 | otel.metrics.exporter=otlp 6 | otel.metric.export.interval=1000 7 | otel.exporter.otlp.endpoint=https://myotlpendpoint 8 | otel.exporter.prometheus.host=host123.domain.com 9 | otel.exporter.prometheus.port=67890 10 | otel.jmx.username=myUser\n\ 11 | name 12 | otel.jmx.password=myPassw\\ord 13 | otel.jmx.remote.profile=SASL/DIG\EST-MD5 14 | otel.jmx.realm=myRealm 15 | otel.resource.attributes=one=two,three=four 16 | javax.net.ssl.keyStore=/my/key/store 17 | javax.net.ssl.keyStorePassword=abc123 18 | javax.net.ssl.keyStoreType=JKS 19 | javax.net.ssl.trustStore=/my/trust/store 20 | javax.net.ssl.trustStorePassword=def456 21 | javax.net.ssl.trustStoreType=JKS 22 | otel.jmx.aggregate.across.mbeans=true 23 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/ToUpperCaseTextMapGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven; 7 | 8 | import io.opentelemetry.context.propagation.TextMapGetter; 9 | import java.util.Locale; 10 | import java.util.Map; 11 | import java.util.Set; 12 | import javax.annotation.Nonnull; 13 | import javax.annotation.Nullable; 14 | 15 | final class ToUpperCaseTextMapGetter implements TextMapGetter> { 16 | @Override 17 | public Set keys(Map environmentVariables) { 18 | return environmentVariables.keySet(); 19 | } 20 | 21 | @Override 22 | @Nullable 23 | public String get(@Nullable Map environmentVariables, @Nonnull String key) { 24 | return environmentVariables == null 25 | ? null 26 | : environmentVariables.get(key.toUpperCase(Locale.ROOT)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/main/java/io/opentelemetry/contrib/metrics/micrometer/internal/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.metrics.micrometer.internal; 7 | 8 | import io.micrometer.core.instrument.Tag; 9 | 10 | /** 11 | * Constants for common Micrometer {@link Tag} names for the OpenTelemetry instrumentation scope. 12 | * 13 | *

This class is internal and is hence not for public use. Its APIs are unstable and can change 14 | * at any time. 15 | */ 16 | public final class Constants { 17 | public static final String OTEL_INSTRUMENTATION_NAME = "otel.instrumentation.name"; 18 | public static final String OTEL_INSTRUMENTATION_VERSION = "otel.instrumentation.version"; 19 | public static final Tag UNKNOWN_INSTRUMENTATION_VERSION_TAG = 20 | Tag.of(OTEL_INSTRUMENTATION_VERSION, "unknown"); 21 | 22 | private Constants() {} 23 | } 24 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/FlagsAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import opamp.proto.AgentToServer; 10 | 11 | /** 12 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 13 | * any time. 14 | */ 15 | public final class FlagsAppender implements AgentToServerAppender { 16 | private final Supplier flags; 17 | 18 | public static FlagsAppender create(Supplier flags) { 19 | return new FlagsAppender(flags); 20 | } 21 | 22 | private FlagsAppender(Supplier flags) { 23 | this.flags = flags; 24 | } 25 | 26 | @Override 27 | public void appendTo(AgentToServer.Builder builder) { 28 | builder.flags(flags.get()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/test/java/io/opentelemetry/contrib/metrics/micrometer/TestCallbackRegistrar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.metrics.micrometer; 7 | 8 | import java.util.List; 9 | 10 | public class TestCallbackRegistrar implements CallbackRegistrar, Runnable { 11 | 12 | private final List callbacks; 13 | 14 | public TestCallbackRegistrar(List callbacks) { 15 | this.callbacks = callbacks; 16 | } 17 | 18 | @Override 19 | public CallbackRegistration registerCallback(Runnable callback) { 20 | callbacks.add(callback); 21 | return () -> callbacks.remove(callback); 22 | } 23 | 24 | @Override 25 | public void close() { 26 | callbacks.clear(); 27 | } 28 | 29 | @Override 30 | public void run() { 31 | for (Runnable callback : callbacks) { 32 | callback.run(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/issue-management-feedback-label.yml: -------------------------------------------------------------------------------- 1 | name: Issue management - remove labels as needed 2 | 3 | on: 4 | issue_comment: 5 | types: [created] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | issue_comment: 12 | permissions: 13 | contents: read 14 | issues: write 15 | pull-requests: write 16 | if: > 17 | contains(github.event.issue.labels.*.name, 'needs author feedback') && 18 | github.event.comment.user.login == github.event.issue.user.login 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 22 | 23 | - name: Remove labels 24 | env: 25 | ISSUE_NUMBER: ${{ github.event.issue.number }} 26 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | run: | 28 | gh issue edit --remove-label "needs author feedback" $ISSUE_NUMBER 29 | gh issue edit --remove-label "stale" $ISSUE_NUMBER 30 | -------------------------------------------------------------------------------- /compressors/compressor-zstd/src/main/java/io/opentelemetry/contrib/compressor/zstd/ZstdCompressor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.compressor.zstd; 7 | 8 | import com.github.luben.zstd.ZstdOutputStream; 9 | import io.opentelemetry.exporter.internal.compression.Compressor; 10 | import java.io.IOException; 11 | import java.io.OutputStream; 12 | 13 | public final class ZstdCompressor implements Compressor { 14 | 15 | private static final ZstdCompressor INSTANCE = new ZstdCompressor(); 16 | 17 | private ZstdCompressor() {} 18 | 19 | public static ZstdCompressor getInstance() { 20 | return INSTANCE; 21 | } 22 | 23 | @Override 24 | public String getEncoding() { 25 | return "zstd"; 26 | } 27 | 28 | @Override 29 | public OutputStream compress(OutputStream outputStream) throws IOException { 30 | return new ZstdOutputStream(outputStream); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent56/ConsistentAlwaysOnSamplerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.getMinThreshold; 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | import org.junit.jupiter.api.Test; 12 | 13 | class ConsistentAlwaysOnSamplerTest { 14 | 15 | @Test 16 | void testDescription() { 17 | assertThat(ConsistentSampler.alwaysOn().getDescription()) 18 | .isEqualTo("ConsistentAlwaysOnSampler"); 19 | } 20 | 21 | @Test 22 | void testThreshold() { 23 | assertThat( 24 | ConsistentSampler.alwaysOn() 25 | .getSamplingIntent(null, "span_name", null, null, null) 26 | .getThreshold()) 27 | .isEqualTo(getMinThreshold()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/response/OpampServerResponseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.response; 7 | 8 | import opamp.proto.ServerErrorResponse; 9 | 10 | /** 11 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 12 | * any time. 13 | */ 14 | public class OpampServerResponseException extends Exception { 15 | private static final long serialVersionUID = 1L; 16 | 17 | public final ServerErrorResponse errorResponse; 18 | 19 | /** 20 | * Constructs an OpAMP error related exception. 21 | * 22 | * @param errorResponse The OpAMP error. 23 | * @param message The OpAMP error message. 24 | */ 25 | public OpampServerResponseException(ServerErrorResponse errorResponse, String message) { 26 | super(message); 27 | this.errorResponse = errorResponse; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent56/ConsistentAlwaysOffSamplerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.getInvalidThreshold; 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | import org.junit.jupiter.api.Test; 12 | 13 | class ConsistentAlwaysOffSamplerTest { 14 | 15 | @Test 16 | void testDescription() { 17 | assertThat(ConsistentSampler.alwaysOff().getDescription()) 18 | .isEqualTo("ConsistentAlwaysOffSampler"); 19 | } 20 | 21 | @Test 22 | void testThreshold() { 23 | assertThat( 24 | ConsistentSampler.alwaysOff() 25 | .getSamplingIntent(null, "span_name", null, null, null) 26 | .getThreshold()) 27 | .isEqualTo(getInvalidThreshold()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /resource-providers/src/main/java/io/opentelemetry/contrib/resourceproviders/AppServerResourceDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.resourceproviders; 7 | 8 | import com.google.auto.service.AutoService; 9 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 10 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 11 | import io.opentelemetry.sdk.resources.Resource; 12 | 13 | @AutoService(ComponentProvider.class) 14 | public final class AppServerResourceDetector implements ComponentProvider { 15 | 16 | @Override 17 | public Class getType() { 18 | return Resource.class; 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return "app_server"; 24 | } 25 | 26 | @Override 27 | public Resource create(DeclarativeConfigProperties config) { 28 | return new AppServerServiceNameProvider().create(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/TopicMetricsCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.ibm.mq.metricscollector; 7 | 8 | import io.opentelemetry.api.metrics.Meter; 9 | import java.util.function.Consumer; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | public final class TopicMetricsCollector implements Consumer { 14 | private static final Logger logger = LoggerFactory.getLogger(TopicMetricsCollector.class); 15 | private final InquireTStatusCmdCollector inquireTStatusCmdCollector; 16 | 17 | public TopicMetricsCollector(Meter meter) { 18 | this.inquireTStatusCmdCollector = new InquireTStatusCmdCollector(meter); 19 | } 20 | 21 | @Override 22 | public void accept(MetricsCollectorContext context) { 23 | logger.info("Collecting Topic metrics..."); 24 | inquireTStatusCmdCollector.accept(context); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /micrometer-meter-provider/src/test/java/io/opentelemetry/contrib/metrics/micrometer/internal/instruments/RandomUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.metrics.micrometer.internal.instruments; 7 | 8 | import java.util.concurrent.ThreadLocalRandom; 9 | import java.util.stream.Stream; 10 | 11 | final class RandomUtils { 12 | 13 | @SuppressWarnings("StreamToIterable") 14 | static Iterable randomDoubles(long size, double origin, double bound) { 15 | Stream stream = ThreadLocalRandom.current().doubles(size, origin, bound).boxed(); 16 | 17 | return stream::iterator; 18 | } 19 | 20 | @SuppressWarnings("StreamToIterable") 21 | static Iterable randomLongs(long size, long origin, long bound) { 22 | Stream stream = ThreadLocalRandom.current().longs(size, origin, bound).boxed(); 23 | 24 | return stream::iterator; 25 | } 26 | 27 | private RandomUtils() {} 28 | } 29 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayComponentProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.awsxray.propagator.internal; 7 | 8 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 9 | import io.opentelemetry.context.propagation.TextMapPropagator; 10 | import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 12 | 13 | public class AwsXrayComponentProvider implements ComponentProvider { 14 | @Override 15 | public Class getType() { 16 | return TextMapPropagator.class; 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return "xray"; 22 | } 23 | 24 | @Override 25 | public TextMapPropagator create(DeclarativeConfigProperties config) { 26 | return AwsXrayPropagator.getInstance(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ParentBasedConsistentProbabilitySamplerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent; 7 | 8 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 9 | import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider; 10 | import io.opentelemetry.sdk.trace.samplers.Sampler; 11 | 12 | public final class ParentBasedConsistentProbabilitySamplerProvider 13 | implements ConfigurableSamplerProvider { 14 | 15 | @Override 16 | public Sampler createSampler(ConfigProperties config) { 17 | double samplingProbability = config.getDouble("otel.traces.sampler.arg", 1.0d); 18 | return ConsistentSampler.parentBased(ConsistentSampler.probabilityBased(samplingProbability)); 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return "parentbased_consistent_probability"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56/PredicatedSampler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static java.util.Objects.requireNonNull; 9 | 10 | /** A class for holding a pair (Predicate, Composable) */ 11 | public final class PredicatedSampler { 12 | 13 | public static PredicatedSampler onMatch(Predicate predicate, Composable sampler) { 14 | return new PredicatedSampler(predicate, sampler); 15 | } 16 | 17 | private final Predicate predicate; 18 | private final Composable sampler; 19 | 20 | private PredicatedSampler(Predicate predicate, Composable sampler) { 21 | this.predicate = requireNonNull(predicate); 22 | this.sampler = requireNonNull(sampler); 23 | } 24 | 25 | public Predicate getPredicate() { 26 | return predicate; 27 | } 28 | 29 | public Composable getSampler() { 30 | return sampler; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jmx-metrics/src/main/java/io/opentelemetry/contrib/jmxmetrics/InstrumentDescriptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxmetrics; 7 | 8 | import com.google.auto.value.AutoValue; 9 | import io.opentelemetry.sdk.metrics.InstrumentType; 10 | import io.opentelemetry.sdk.metrics.InstrumentValueType; 11 | 12 | @AutoValue 13 | abstract class InstrumentDescriptor { 14 | 15 | static InstrumentDescriptor create( 16 | String name, 17 | String description, 18 | String unit, 19 | InstrumentType instrumentType, 20 | InstrumentValueType valueType) { 21 | return new AutoValue_InstrumentDescriptor(name, description, unit, instrumentType, valueType); 22 | } 23 | 24 | abstract String getName(); 25 | 26 | abstract String getDescription(); 27 | 28 | abstract String getUnit(); 29 | 30 | abstract InstrumentType getInstrumentType(); 31 | 32 | abstract InstrumentValueType getValueType(); 33 | } 34 | -------------------------------------------------------------------------------- /jmx-scraper/src/test/java/io/opentelemetry/contrib/jmxscraper/config/PropertiesSupplierTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jmxscraper.config; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import java.util.Properties; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class PropertiesSupplierTest { 14 | 15 | @Test 16 | void empty() { 17 | PropertiesSupplier supplier = new PropertiesSupplier(new Properties()); 18 | assertThat(supplier.get()).isEmpty(); 19 | } 20 | 21 | @Test 22 | void someValues() { 23 | Properties properties = new Properties(); 24 | properties.setProperty("foo", "bar"); 25 | properties.setProperty("hello", "world"); 26 | PropertiesSupplier supplier = new PropertiesSupplier(properties); 27 | assertThat(supplier.get()) 28 | .hasSize(2) 29 | .containsEntry("foo", "bar") 30 | .containsEntry("hello", "world"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/workflows/build-pull-request.yml: -------------------------------------------------------------------------------- 1 | name: Build Pull Request 2 | 3 | on: 4 | pull_request: 5 | merge_group: 6 | 7 | permissions: 8 | contents: read 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | common: 16 | uses: ./.github/workflows/build-common.yml 17 | with: 18 | cache-read-only: true 19 | # retry in merge queue to avoid unnecessary failures 20 | max-test-retries: ${{ github.event_name == 'merge_group' && 5 || 0 }} 21 | 22 | link-check: 23 | uses: ./.github/workflows/reusable-link-check.yml 24 | 25 | required-status-check: 26 | if: always() 27 | needs: 28 | - common 29 | - link-check # wait for link check to complete, but don't require it to pass for merging 30 | runs-on: ubuntu-latest 31 | steps: 32 | # The reusable workflow success depends on all its jobs passing 33 | - if: needs.common.result != 'success' 34 | run: exit 1 # fail 35 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayLambdaComponentProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.awsxray.propagator.internal; 7 | 8 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 9 | import io.opentelemetry.context.propagation.TextMapPropagator; 10 | import io.opentelemetry.contrib.awsxray.propagator.AwsXrayLambdaPropagator; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 12 | 13 | public class AwsXrayLambdaComponentProvider implements ComponentProvider { 14 | @Override 15 | public Class getType() { 16 | return TextMapPropagator.class; 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return "xray-lambda"; 22 | } 23 | 24 | @Override 25 | public TextMapPropagator create(DeclarativeConfigProperties config) { 26 | return AwsXrayLambdaPropagator.getInstance(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/CapabilitiesAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import opamp.proto.AgentToServer; 10 | 11 | /** 12 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 13 | * any time. 14 | */ 15 | public final class CapabilitiesAppender implements AgentToServerAppender { 16 | private final Supplier capabilities; 17 | 18 | public static CapabilitiesAppender create(Supplier capabilities) { 19 | return new CapabilitiesAppender(capabilities); 20 | } 21 | 22 | private CapabilitiesAppender(Supplier capabilities) { 23 | this.capabilities = capabilities; 24 | } 25 | 26 | @Override 27 | public void appendTo(AgentToServer.Builder builder) { 28 | builder.capabilities(capabilities.get()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/response/MessageData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.response; 7 | 8 | import com.google.auto.value.AutoValue; 9 | import io.opentelemetry.opamp.client.OpampClient; 10 | import javax.annotation.Nullable; 11 | import opamp.proto.AgentRemoteConfig; 12 | 13 | /** 14 | * Data class provided in {@link OpampClient.Callbacks#onMessage(OpampClient, MessageData)} with 15 | * Server's provided status changes. 16 | */ 17 | @AutoValue 18 | public abstract class MessageData { 19 | @Nullable 20 | public abstract AgentRemoteConfig getRemoteConfig(); 21 | 22 | public static Builder builder() { 23 | return new AutoValue_MessageData.Builder(); 24 | } 25 | 26 | @AutoValue.Builder 27 | public abstract static class Builder { 28 | public abstract Builder setRemoteConfig(AgentRemoteConfig remoteConfig); 29 | 30 | public abstract MessageData build(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /azure-resources/src/main/java/io/opentelemetry/contrib/azure/resource/CloudResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.azure.resource; 7 | 8 | import static io.opentelemetry.contrib.azure.resource.IncubatingAttributes.CLOUD_PROVIDER; 9 | 10 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 11 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ConditionalResourceProvider; 12 | import io.opentelemetry.sdk.resources.Resource; 13 | 14 | public abstract class CloudResourceProvider implements ConditionalResourceProvider { 15 | 16 | @Override 17 | public final boolean shouldApply(ConfigProperties config, Resource existing) { 18 | return existing.getAttribute(CLOUD_PROVIDER) == null; 19 | } 20 | 21 | @Override 22 | public final Resource createResource(ConfigProperties config) { 23 | // not using config in any providers 24 | return createResource(); 25 | } 26 | 27 | abstract Resource createResource(); 28 | } 29 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsConfigurablePropagator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.awsxray.propagator.internal; 7 | 8 | import io.opentelemetry.context.propagation.TextMapPropagator; 9 | import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator; 10 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 11 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; 12 | 13 | /** 14 | * A {@link ConfigurablePropagatorProvider} which allows enabling the {@link AwsXrayPropagator} with 15 | * the propagator name {@code xray}. 16 | */ 17 | public final class AwsConfigurablePropagator implements ConfigurablePropagatorProvider { 18 | @Override 19 | public TextMapPropagator getPropagator(ConfigProperties config) { 20 | return AwsXrayPropagator.getInstance(); 21 | } 22 | 23 | @Override 24 | public String getName() { 25 | return "xray"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /kafka-exporter/src/main/java/io/opentelemetry/contrib/kafka/SpanDataDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.kafka; 7 | 8 | import com.google.protobuf.InvalidProtocolBufferException; 9 | import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; 10 | import java.util.Objects; 11 | import org.apache.kafka.common.errors.SerializationException; 12 | import org.apache.kafka.common.serialization.Deserializer; 13 | 14 | public final class SpanDataDeserializer implements Deserializer { 15 | @SuppressWarnings("NullAway") 16 | @Override 17 | public ExportTraceServiceRequest deserialize(String topic, byte[] data) { 18 | if (Objects.isNull(data)) { 19 | return null; 20 | } 21 | try { 22 | return ExportTraceServiceRequest.parseFrom(data); 23 | } catch (InvalidProtocolBufferException e) { 24 | throw new SerializationException("Error while deserializing data", e); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/SequenceNumberAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import opamp.proto.AgentToServer; 10 | 11 | /** 12 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 13 | * any time. 14 | */ 15 | public final class SequenceNumberAppender implements AgentToServerAppender { 16 | private final Supplier sequenceNumber; 17 | 18 | public static SequenceNumberAppender create(Supplier sequenceNumber) { 19 | return new SequenceNumberAppender(sequenceNumber); 20 | } 21 | 22 | private SequenceNumberAppender(Supplier sequenceNumber) { 23 | this.sequenceNumber = sequenceNumber; 24 | } 25 | 26 | @Override 27 | public void appendTo(AgentToServer.Builder builder) { 28 | builder.sequence_num(sequenceNumber.get()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/InstanceUidAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import okio.ByteString; 10 | import opamp.proto.AgentToServer; 11 | 12 | /** 13 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 14 | * any time. 15 | */ 16 | public final class InstanceUidAppender implements AgentToServerAppender { 17 | private final Supplier instanceUid; 18 | 19 | public static InstanceUidAppender create(Supplier instanceUid) { 20 | return new InstanceUidAppender(instanceUid); 21 | } 22 | 23 | private InstanceUidAppender(Supplier instanceUid) { 24 | this.instanceUid = instanceUid; 25 | } 26 | 27 | @Override 28 | public void appendTo(AgentToServer.Builder builder) { 29 | builder.instance_uid(ByteString.of(instanceUid.get())); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/reusable-link-check.yml: -------------------------------------------------------------------------------- 1 | name: Reusable - Link check 2 | 3 | on: 4 | workflow_call: 5 | 6 | permissions: 7 | contents: read 8 | 9 | jobs: 10 | link-check: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 14 | with: 15 | fetch-depth: 0 # needed for merge-base used in lint:links-in-modified-files 16 | 17 | - uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1 18 | 19 | - name: Link check for pull requests 20 | if: github.event_name == 'pull_request' 21 | env: 22 | GITHUB_TOKEN: ${{ github.token }} 23 | run: | 24 | mise run lint:local-links 25 | mise run lint:links-in-modified-files --base origin/${{ github.base_ref }} --head ${{ github.event.pull_request.head.sha }} 26 | 27 | - name: Link check for pushes and scheduled workflows 28 | if: github.event_name != 'pull_request' 29 | env: 30 | GITHUB_TOKEN: ${{ github.token }} 31 | run: mise run lint:links 32 | -------------------------------------------------------------------------------- /consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56/ConsistentFixedThresholdSampler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.sampler.consistent56; 7 | 8 | import static io.opentelemetry.contrib.sampler.consistent56.ConsistentSamplingUtil.calculateThreshold; 9 | 10 | public class ConsistentFixedThresholdSampler extends ConsistentThresholdSampler { 11 | 12 | private final long threshold; 13 | private final String description; 14 | 15 | protected ConsistentFixedThresholdSampler(long threshold) { 16 | this.threshold = getThreshold(threshold); 17 | this.description = getThresholdDescription(threshold); 18 | } 19 | 20 | protected ConsistentFixedThresholdSampler(double samplingProbability) { 21 | this(calculateThreshold(samplingProbability)); 22 | } 23 | 24 | @Override 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | @Override 30 | public long getThreshold() { 31 | return threshold; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/AgentDescriptionAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import opamp.proto.AgentDescription; 10 | import opamp.proto.AgentToServer; 11 | 12 | /** 13 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 14 | * any time. 15 | */ 16 | public final class AgentDescriptionAppender implements AgentToServerAppender { 17 | private final Supplier data; 18 | 19 | public static AgentDescriptionAppender create(Supplier data) { 20 | return new AgentDescriptionAppender(data); 21 | } 22 | 23 | private AgentDescriptionAppender(Supplier data) { 24 | this.data = data; 25 | } 26 | 27 | @Override 28 | public void appendTo(AgentToServer.Builder builder) { 29 | builder.agent_description(data.get()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/markdown/examples_macros.j2: -------------------------------------------------------------------------------- 1 | {% macro print_examples(examples) %}{%- for e in examples %}{%if loop.first == false %}; {% endif %}`{{ e | trim }}`{%- endfor %}{% endmacro %} 2 | 3 | {% macro format(item) %}{%- if item.examples %} 4 | {%- if "[]" in item.type and "template" not in item.type %} 5 | {%- if item.examples is sequence %} 6 | {%- if item.examples | select("sequence") | length == 0 %}`{{ item.examples | trim }}` 7 | {%- else %}{{ print_examples(item.examples) }} 8 | {%- endif %} 9 | {%- else %}`[{{ item.examples | trim }}]` 10 | {%- endif %} 11 | {%- elif item.examples is sequence %}{{ print_examples(item.examples) }} 12 | {%- else %}`{{ item.examples | trim }}` 13 | {%- endif %}{%- elif item.type is mapping %} 14 | {%- for e in item.type.members %}{% if loop.index0 < 3 %}{% if loop.first == false %}; {% endif %}`{{ e.value | trim }}`{% endif %}{%- endfor %} 15 | {%- elif item.type == "enum" -%} 16 | {%- for e in item.members %}{% if loop.index0 < 3 %}{% if loop.first == false %}; {% endif %}`{{ e.value | trim }}`{% endif %}{%- endfor %} 17 | {%- endif %}{% endmacro %} 18 | -------------------------------------------------------------------------------- /jfr-events/README.md: -------------------------------------------------------------------------------- 1 | # OpenTelemetry Java Flight Recorder (JFR) Events 2 | 3 | Create JFR events that can be recorded and viewed in Java Mission Control (JMC). 4 | 5 | * Creates Open Telemetry Tracing/Span events for spans 6 | * The thread and stacktrace will be of the thead ending the span which might be different from the thread creating the span. 7 | * Has the fields 8 | * Operation Name 9 | * Trace ID 10 | * Parent Span ID 11 | * Span ID 12 | * Creates Open Telemetry Tracing/Scope events for scopes 13 | * Thread will match the thread the scope was active in and the stacktrace will be when scope was closed 14 | * Multiple scopes might be collected for a single span 15 | * Has the fields 16 | * Trace ID 17 | * Span ID 18 | * Supports the Open Source version of JFR in Java 11. 19 | * Might support back port to OpenJDK 8, but not tested and classes are built with JDK 11 bytecode. 20 | 21 | ## Component owners 22 | 23 | - [Staffan Friberg](https://github.com/sfriberg) 24 | 25 | Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). 26 | -------------------------------------------------------------------------------- /resource-providers/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Contributed ResourceProviders" 7 | otelJava.moduleName.set("io.opentelemetry.contrib.resourceproviders") 8 | 9 | dependencies { 10 | annotationProcessor("com.google.auto.service:auto-service") 11 | 12 | compileOnly("com.google.auto.service:auto-service") 13 | compileOnly("io.opentelemetry:opentelemetry-api") 14 | compileOnly("io.opentelemetry:opentelemetry-api-incubator") 15 | compileOnly("io.opentelemetry:opentelemetry-sdk") 16 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 17 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 18 | compileOnly("io.opentelemetry.semconv:opentelemetry-semconv") 19 | testImplementation("io.opentelemetry.semconv:opentelemetry-semconv") 20 | testImplementation("com.google.auto.service:auto-service") 21 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 22 | testImplementation("io.opentelemetry:opentelemetry-api-incubator") 23 | } 24 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/exporters/callback/ExporterCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.exporters.callback; 7 | 8 | import java.util.Collection; 9 | import javax.annotation.Nullable; 10 | 11 | /** Notifies about exporter and storage-related operations from within a signal to disk exporter. */ 12 | public interface ExporterCallback { 13 | /** 14 | * Called when an export to disk operation succeeded. 15 | * 16 | * @param items The items successfully stored in disk. 17 | */ 18 | void onExportSuccess(Collection items); 19 | 20 | /** 21 | * Called when an export to disk operation failed. 22 | * 23 | * @param items The items that couldn't get stored in disk. 24 | * @param error Optional - provides more information of why the operation failed. 25 | */ 26 | void onExportError(Collection items, @Nullable Throwable error); 27 | 28 | /** Called when the exporter is closed. */ 29 | void onShutdown(); 30 | } 31 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/serialization/deserializers/SignalDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; 7 | 8 | import io.opentelemetry.sdk.logs.data.LogRecordData; 9 | import io.opentelemetry.sdk.metrics.data.MetricData; 10 | import io.opentelemetry.sdk.trace.data.SpanData; 11 | import java.util.List; 12 | 13 | public interface SignalDeserializer { 14 | 15 | static SignalDeserializer ofSpans() { 16 | return SpanDataDeserializer.getInstance(); 17 | } 18 | 19 | static SignalDeserializer ofMetrics() { 20 | return MetricDataDeserializer.getInstance(); 21 | } 22 | 23 | static SignalDeserializer ofLogs() { 24 | return LogRecordDataDeserializer.getInstance(); 25 | } 26 | 27 | /** Deserializes the given byte array into a list of telemetry items. */ 28 | List deserialize(byte[] source) throws DeserializationException; 29 | } 30 | -------------------------------------------------------------------------------- /gcp-resources/src/main/java/io/opentelemetry/contrib/gcp/resource/internal/GcpResourceDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.gcp.resource.internal; 7 | 8 | import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; 9 | import io.opentelemetry.contrib.gcp.resource.GCPResourceProvider; 10 | import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; 11 | import io.opentelemetry.sdk.resources.Resource; 12 | import io.opentelemetry.sdk.resources.ResourceBuilder; 13 | 14 | public class GcpResourceDetector implements ComponentProvider { 15 | 16 | @Override 17 | public Class getType() { 18 | return Resource.class; 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return "gcp"; 24 | } 25 | 26 | @Override 27 | public Resource create(DeclarativeConfigProperties config) { 28 | ResourceBuilder builder = Resource.builder(); 29 | builder.putAll(new GCPResourceProvider().getAttributes()); 30 | return builder.build(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/MavenGoal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven; 7 | 8 | import com.google.auto.value.AutoValue; 9 | import org.apache.maven.plugin.MojoExecution; 10 | 11 | @AutoValue 12 | public abstract class MavenGoal { 13 | public static MavenGoal create(String groupId, String artifactId, String goal) { 14 | return new AutoValue_MavenGoal(groupId, artifactId, goal); 15 | } 16 | 17 | public static MavenGoal create(MojoExecution mojoExecution) { 18 | return create( 19 | mojoExecution.getGroupId(), mojoExecution.getArtifactId(), mojoExecution.getGoal()); 20 | } 21 | 22 | abstract String groupId(); 23 | 24 | abstract String artifactId(); 25 | 26 | abstract String goal(); 27 | 28 | @Override 29 | public final String toString() { 30 | return "MavenGoal{ " 31 | + groupId() 32 | + ":" 33 | + MavenUtils.getPluginArtifactIdShortName(artifactId()) 34 | + ":" 35 | + goal() 36 | + "}"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/internal/AwsXrayLambdaConfigurablePropagator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.awsxray.propagator.internal; 7 | 8 | import io.opentelemetry.context.propagation.TextMapPropagator; 9 | import io.opentelemetry.contrib.awsxray.propagator.AwsXrayLambdaPropagator; 10 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; 11 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; 12 | 13 | /** 14 | * A {@link ConfigurablePropagatorProvider} which allows enabling the {@link 15 | * AwsXrayLambdaPropagator} with the propagator name {@code xray-lambda}. 16 | */ 17 | public final class AwsXrayLambdaConfigurablePropagator implements ConfigurablePropagatorProvider { 18 | @Override 19 | public TextMapPropagator getPropagator(ConfigProperties config) { 20 | return AwsXrayLambdaPropagator.getInstance(); 21 | } 22 | 23 | @Override 24 | public String getName() { 25 | return "xray-lambda"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resource-providers/src/main/java/io/opentelemetry/contrib/resourceproviders/WebSphereAppServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.resourceproviders; 7 | 8 | import java.nio.file.Path; 9 | import javax.annotation.Nullable; 10 | 11 | class WebSphereAppServer implements AppServer { 12 | 13 | private static final String SERVER_CLASS_NAME = "com.ibm.wsspi.bootstrap.WSPreLauncher"; 14 | private final ResourceLocator locator; 15 | 16 | WebSphereAppServer(ResourceLocator locator) { 17 | this.locator = locator; 18 | } 19 | 20 | @Override 21 | public boolean isValidAppName(Path path) { 22 | // query.ear is bundled with websphere 23 | String name = path.getFileName().toString(); 24 | return !"query.ear".equals(name); 25 | } 26 | 27 | @Nullable 28 | @Override 29 | public Path getDeploymentDir() { 30 | // not used 31 | return null; 32 | } 33 | 34 | @Nullable 35 | @Override 36 | public Class getServerClass() { 37 | return locator.findClass(SERVER_CLASS_NAME); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /opamp-client/src/test/java/io/opentelemetry/opamp/client/internal/request/service/PeriodicDelayWithSuggestion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.service; 7 | 8 | import io.opentelemetry.opamp.client.internal.request.delay.AcceptsDelaySuggestion; 9 | import io.opentelemetry.opamp.client.internal.request.delay.PeriodicDelay; 10 | import java.time.Duration; 11 | 12 | public class PeriodicDelayWithSuggestion implements PeriodicDelay, AcceptsDelaySuggestion { 13 | private final Duration initialDelay; 14 | private Duration currentDelay; 15 | 16 | public PeriodicDelayWithSuggestion(Duration initialDelay) { 17 | this.initialDelay = initialDelay; 18 | currentDelay = initialDelay; 19 | } 20 | 21 | @Override 22 | public void suggestDelay(Duration delay) { 23 | currentDelay = delay; 24 | } 25 | 26 | @Override 27 | public Duration getNextDelay() { 28 | return currentDelay; 29 | } 30 | 31 | @Override 32 | public void reset() { 33 | currentDelay = initialDelay; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/ScopeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jfrevent; 7 | 8 | import io.opentelemetry.api.trace.SpanContext; 9 | import jdk.jfr.Category; 10 | import jdk.jfr.Description; 11 | import jdk.jfr.Event; 12 | import jdk.jfr.Label; 13 | import jdk.jfr.Name; 14 | 15 | @Name("io.opentelemetry.context.Scope") 16 | @Label("Scope") 17 | @Category("Open Telemetry Tracing") 18 | @Description( 19 | "Open Telemetry trace event corresponding to the span currently " 20 | + "in scope/active on this thread.") 21 | class ScopeEvent extends Event { 22 | 23 | private final String traceId; 24 | private final String spanId; 25 | 26 | ScopeEvent(SpanContext spanContext) { 27 | this.traceId = spanContext.getTraceId(); 28 | this.spanId = spanContext.getSpanId(); 29 | } 30 | 31 | @Label("Trace Id") 32 | public String getTraceId() { 33 | return traceId; 34 | } 35 | 36 | @Label("Span Id") 37 | public String getSpanId() { 38 | return spanId; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /kafka-exporter/src/test/java/io/opentelemetry/contrib/kafka/TestUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.kafka; 7 | 8 | import io.opentelemetry.api.trace.SpanContext; 9 | import io.opentelemetry.api.trace.SpanKind; 10 | import io.opentelemetry.sdk.testing.trace.TestSpanData; 11 | import io.opentelemetry.sdk.trace.data.SpanData; 12 | import io.opentelemetry.sdk.trace.data.StatusData; 13 | import java.util.concurrent.TimeUnit; 14 | 15 | public class TestUtil { 16 | private TestUtil() {} 17 | 18 | public static SpanData makeBasicSpan(String spanName) { 19 | return TestSpanData.builder() 20 | .setHasEnded(true) 21 | .setSpanContext(SpanContext.getInvalid()) 22 | .setName(spanName) 23 | .setKind(SpanKind.SERVER) 24 | .setStartEpochNanos(TimeUnit.SECONDS.toNanos(100) + 100) 25 | .setStatus(StatusData.ok()) 26 | .setEndEpochNanos(TimeUnit.SECONDS.toNanos(200) + 200) 27 | .setTotalRecordedLinks(0) 28 | .setTotalRecordedEvents(0) 29 | .build(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /processors/src/main/java/io/opentelemetry/contrib/interceptor/common/ComposableInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.interceptor.common; 7 | 8 | import io.opentelemetry.contrib.interceptor.api.Interceptor; 9 | import java.util.concurrent.CopyOnWriteArrayList; 10 | import javax.annotation.Nullable; 11 | 12 | /** Allows to run an item through a list of interceptors in the order they were added. */ 13 | public final class ComposableInterceptor implements Interceptor { 14 | private final CopyOnWriteArrayList> interceptors = new CopyOnWriteArrayList<>(); 15 | 16 | public void add(Interceptor interceptor) { 17 | interceptors.addIfAbsent(interceptor); 18 | } 19 | 20 | @Nullable 21 | @Override 22 | public T intercept(T item) { 23 | T intercepted = item; 24 | for (Interceptor interceptor : interceptors) { 25 | intercepted = interceptor.intercept(intercepted); 26 | if (intercepted == null) { 27 | break; 28 | } 29 | } 30 | return intercepted; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /disk-buffering/src/test/java/io/opentelemetry/contrib/disk/buffering/internal/serialization/serializers/ByteArraySerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.serialization.serializers; 7 | 8 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 9 | import java.io.IOException; 10 | import java.io.OutputStream; 11 | import java.util.Collection; 12 | 13 | public final class ByteArraySerializer implements SignalSerializer { 14 | 15 | private final byte[] data; 16 | 17 | public ByteArraySerializer(byte[] data) { 18 | this.data = data; 19 | } 20 | 21 | @CanIgnoreReturnValue 22 | @Override 23 | public SignalSerializer initialize(Collection data) { 24 | return null; 25 | } 26 | 27 | @Override 28 | public void writeBinaryTo(OutputStream output) throws IOException { 29 | output.write(data); 30 | } 31 | 32 | @Override 33 | public int getBinarySerializedSize() { 34 | return data.length; 35 | } 36 | 37 | @Override 38 | public void reset() {} 39 | } 40 | -------------------------------------------------------------------------------- /processors/src/main/java/io/opentelemetry/contrib/filter/FilteringLogRecordProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.filter; 7 | 8 | import io.opentelemetry.context.Context; 9 | import io.opentelemetry.sdk.logs.LogRecordProcessor; 10 | import io.opentelemetry.sdk.logs.ReadWriteLogRecord; 11 | import io.opentelemetry.sdk.logs.data.LogRecordData; 12 | import java.util.function.Predicate; 13 | 14 | public final class FilteringLogRecordProcessor implements LogRecordProcessor { 15 | 16 | private final LogRecordProcessor delegate; 17 | private final Predicate predicate; 18 | 19 | public FilteringLogRecordProcessor( 20 | LogRecordProcessor delegate, Predicate predicate) { 21 | this.delegate = delegate; 22 | this.predicate = predicate; 23 | } 24 | 25 | @Override 26 | public void onEmit(Context context, ReadWriteLogRecord readWriteLogRecord) { 27 | if (predicate.test(readWriteLogRecord.toLogRecordData())) { 28 | delegate.onEmit(context, readWriteLogRecord); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/FixedClock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal; 7 | 8 | import io.opentelemetry.api.trace.Span; 9 | import io.opentelemetry.context.Context; 10 | import io.opentelemetry.sdk.trace.ReadWriteSpan; 11 | 12 | public class FixedClock extends SpanAnchoredClock { 13 | 14 | private long nanoTime = -1L; 15 | 16 | @Override 17 | public void onSpanStart(ReadWriteSpan started, Context parentContext) {} 18 | 19 | @Override 20 | public long nanoTime() { 21 | if (nanoTime == -1L) { 22 | return System.nanoTime(); 23 | } 24 | return nanoTime; 25 | } 26 | 27 | @Override 28 | public long getAnchor(Span parent) { 29 | return 0; 30 | } 31 | 32 | @Override 33 | @SuppressWarnings("CanIgnoreReturnValueSuggester") 34 | public long toEpochNanos(long anchor, long recordedNanoTime) { 35 | return recordedNanoTime; 36 | } 37 | 38 | public void setNanoTime(long nanoTime) { 39 | this.nanoTime = nanoTime; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gcp-auth-extension/src/test/java/io/opentelemetry/contrib/gcp/auth/springapp/Controller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.gcp.auth.springapp; 7 | 8 | import io.opentelemetry.instrumentation.annotations.WithSpan; 9 | import java.time.Duration; 10 | import java.time.Instant; 11 | import java.util.Random; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | @RestController 16 | public class Controller { 17 | 18 | private final Random random = new Random(); 19 | 20 | @GetMapping("/ping") 21 | public String ping() { 22 | int busyTime = random.nextInt(200); 23 | busyloop(busyTime); 24 | return "pong"; 25 | } 26 | 27 | @WithSpan 28 | private static long busyloop(int busyMillis) { 29 | Instant start = Instant.now(); 30 | Instant end; 31 | long counter = 0; 32 | do { 33 | counter++; 34 | end = Instant.now(); 35 | } while (Duration.between(start, end).toMillis() < busyMillis); 36 | return counter; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /opamp-client/src/test/java/io/opentelemetry/opamp/client/internal/request/delay/ExponentialBackoffPeriodicDelayTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.request.delay; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import java.time.Duration; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class ExponentialBackoffPeriodicDelayTest { 14 | @Test 15 | void verifyDelayUpdates() { 16 | ExponentialBackoffPeriodicDelay delay = 17 | new ExponentialBackoffPeriodicDelay(Duration.ofSeconds(1)); 18 | 19 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(1)); 20 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(2)); 21 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(4)); 22 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(8)); 23 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(16)); 24 | 25 | // Reset 26 | delay.reset(); 27 | assertThat(delay.getNextDelay()).isEqualTo(Duration.ofSeconds(1)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/impl/recipe/appenders/EffectiveConfigAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.impl.recipe.appenders; 7 | 8 | import java.util.function.Supplier; 9 | import opamp.proto.AgentToServer; 10 | import opamp.proto.EffectiveConfig; 11 | 12 | /** 13 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 14 | * any time. 15 | */ 16 | public final class EffectiveConfigAppender implements AgentToServerAppender { 17 | private final Supplier effectiveConfig; 18 | 19 | public static EffectiveConfigAppender create(Supplier effectiveConfig) { 20 | return new EffectiveConfigAppender(effectiveConfig); 21 | } 22 | 23 | private EffectiveConfigAppender(Supplier effectiveConfig) { 24 | this.effectiveConfig = effectiveConfig; 25 | } 26 | 27 | @Override 28 | public void appendTo(AgentToServer.Builder builder) { 29 | builder.effective_config(effectiveConfig.get()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /processors/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("otel.java-conventions") 3 | id("otel.publish-conventions") 4 | } 5 | 6 | description = "Tools to intercept and process signals globally." 7 | otelJava.moduleName.set("io.opentelemetry.contrib.processors") 8 | 9 | java { 10 | sourceCompatibility = JavaVersion.VERSION_1_8 11 | targetCompatibility = JavaVersion.VERSION_1_8 12 | } 13 | 14 | dependencies { 15 | api("io.opentelemetry:opentelemetry-sdk") 16 | compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") 17 | compileOnly("io.opentelemetry:opentelemetry-api-incubator") 18 | 19 | // For EventToSpanEventBridge 20 | implementation("io.opentelemetry:opentelemetry-exporter-otlp-common") 21 | implementation("com.fasterxml.jackson.core:jackson-core") 22 | 23 | testImplementation("io.opentelemetry:opentelemetry-api-incubator") 24 | testImplementation("io.opentelemetry:opentelemetry-sdk-testing") 25 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") 26 | testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator") 27 | testImplementation("io.opentelemetry:opentelemetry-exporter-logging") 28 | } 29 | -------------------------------------------------------------------------------- /jmx-metrics/src/integrationTest/resources/script.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry 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 | import io.opentelemetry.api.common.Attributes 18 | 19 | def loadMatches = otel.queryJmx("org.apache.cassandra.metrics:type=Storage,name=Load") 20 | if (!loadMatches.isEmpty()) { 21 | def load = loadMatches.first() 22 | 23 | def lvr = otel.longHistogram( 24 | "cassandra.storage.load", 25 | "Size, in bytes, of the on disk data size this node manages", 26 | "By" 27 | ) 28 | lvr.record(load.Count, Attributes.builder().put("myKey", "myVal").build()) 29 | } 30 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/storage/result/WriteResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.storage.result; 7 | 8 | import io.opentelemetry.contrib.disk.buffering.storage.SignalStorage; 9 | import javax.annotation.Nullable; 10 | 11 | /** The result of a {@link SignalStorage} write operation. */ 12 | public interface WriteResult { 13 | /** 14 | * Whether the operation succeeded or not. 15 | * 16 | * @return `true` if the items have been successfully stored, `false` otherwise. 17 | */ 18 | boolean isSuccessful(); 19 | 20 | /** 21 | * Provides details of why the operation failed. 22 | * 23 | * @return The error (if any) for the failed operation. It must be null for successful operations. 24 | */ 25 | @Nullable 26 | Throwable getError(); 27 | 28 | static WriteResult successful() { 29 | return new DefaultWriteResult(/* successful= */ true, null); 30 | } 31 | 32 | static WriteResult error(@Nullable Throwable t) { 33 | return new DefaultWriteResult(/* successful= */ false, t); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/internal/pooling/Resetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.inferredspans.internal.pooling; 7 | 8 | /** 9 | * Defines reset strategy to use for a given pooled object type when they are returned to pool 10 | * 11 | * @param pooled object type 12 | */ 13 | public interface Resetter { 14 | 15 | /** 16 | * Recycles a pooled object state 17 | * 18 | * @param object object to recycle 19 | */ 20 | void recycle(T object); 21 | 22 | /** 23 | * Resetter for objects that implement {@link Recyclable} 24 | * 25 | * @param recyclable object type 26 | */ 27 | @SuppressWarnings({"unchecked", "rawtypes"}) 28 | class ForRecyclable implements Resetter { 29 | private static final ForRecyclable INSTANCE = new ForRecyclable(); 30 | 31 | public static Resetter get() { 32 | return INSTANCE; 33 | } 34 | 35 | @Override 36 | public void recycle(Recyclable object) { 37 | object.resetState(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /maven-extension/src/main/java/io/opentelemetry/maven/StringUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.maven; 7 | 8 | final class StringUtils { 9 | 10 | private StringUtils() {} 11 | 12 | /** Copy org.apache.commons.lang3.StringUtils#isBlank(java.lang.CharSequence) */ 13 | public static boolean isBlank(String str) { 14 | int strLen; 15 | if (str == null || (strLen = str.length()) == 0) { 16 | return true; 17 | } 18 | for (int i = 0; i < strLen; i++) { 19 | if (Character.isWhitespace(str.charAt(i)) == false) { 20 | return false; 21 | } 22 | } 23 | return true; 24 | } 25 | 26 | /** Copy org.apache.commons.lang3.StringUtils#isNotBlank(java.lang.CharSequence) */ 27 | public static boolean isNotBlank(String str) { 28 | return !isBlank(str); 29 | } 30 | 31 | /** 32 | * Copy org.apache.commons.lang3.StringUtils#defaultIfBlank(java.lang.CharSequence, 33 | * java.lang.CharSequence) 34 | */ 35 | public static String defaultIfBlank(String str, String defaultStr) { 36 | return isBlank(str) ? defaultStr : str; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/serialization/serializers/SignalSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.disk.buffering.internal.serialization.serializers; 7 | 8 | import io.opentelemetry.sdk.logs.data.LogRecordData; 9 | import io.opentelemetry.sdk.metrics.data.MetricData; 10 | import io.opentelemetry.sdk.trace.data.SpanData; 11 | import java.io.IOException; 12 | import java.io.OutputStream; 13 | import java.util.Collection; 14 | 15 | public interface SignalSerializer { 16 | 17 | static SignalSerializer ofSpans() { 18 | return new SpanDataSerializer(); 19 | } 20 | 21 | static SignalSerializer ofMetrics() { 22 | return new MetricDataSerializer(); 23 | } 24 | 25 | static SignalSerializer ofLogs() { 26 | return new LogRecordDataSerializer(); 27 | } 28 | 29 | SignalSerializer initialize(Collection data); 30 | 31 | void writeBinaryTo(OutputStream output) throws IOException; 32 | 33 | int getBinarySerializedSize(); 34 | 35 | void reset(); 36 | } 37 | -------------------------------------------------------------------------------- /jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/JfrContextStorageWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.contrib.jfrevent; 7 | 8 | import io.opentelemetry.api.trace.Span; 9 | import io.opentelemetry.context.Context; 10 | import io.opentelemetry.context.ContextStorage; 11 | import io.opentelemetry.context.Scope; 12 | import javax.annotation.Nullable; 13 | 14 | public final class JfrContextStorageWrapper implements ContextStorage { 15 | 16 | private final ContextStorage wrapped; 17 | 18 | public JfrContextStorageWrapper(ContextStorage wrapped) { 19 | this.wrapped = wrapped; 20 | } 21 | 22 | @Override 23 | public Scope attach(Context toAttach) { 24 | Scope scope = wrapped.attach(toAttach); 25 | ScopeEvent event = new ScopeEvent(Span.fromContext(toAttach).getSpanContext()); 26 | event.begin(); 27 | return () -> { 28 | if (event.shouldCommit()) { 29 | event.commit(); 30 | } 31 | scope.close(); 32 | }; 33 | } 34 | 35 | @Override 36 | @Nullable 37 | public Context current() { 38 | return wrapped.current(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /maven-extension/src/test/resources/projects/snyk_1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | io.opentelemetry.contrib.maven 7 | test-snyk-1 8 | 1.0-SNAPSHOT 9 | 10 | 11 | UTF-8 12 | 13 | 14 | 15 | 16 | io.snyk 17 | snyk-maven-plugin 18 | 19 | ${snyk.token} 20 | 21 | --all-projects 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | releases 30 | https://maven.example.com/repository/maven-releases/ 31 | 32 | 33 | snapshots 34 | https://maven.example.com/repository/maven-snapshots/ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/state/InMemoryState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package io.opentelemetry.opamp.client.internal.state; 7 | 8 | import static java.util.Objects.requireNonNull; 9 | 10 | import java.util.concurrent.atomic.AtomicReference; 11 | import javax.annotation.Nonnull; 12 | 13 | /** 14 | * This class is internal and is hence not for public use. Its APIs are unstable and can change at 15 | * any time. 16 | */ 17 | abstract class InMemoryState implements State { 18 | private final AtomicReference state = new AtomicReference<>(); 19 | 20 | public InMemoryState(T initialValue) { 21 | if (initialValue == null) { 22 | throw new IllegalArgumentException("The value must not be null"); 23 | } 24 | state.set(initialValue); 25 | } 26 | 27 | public void set(T value) { 28 | if (value == null) { 29 | throw new IllegalArgumentException("The value must not be null"); 30 | } 31 | state.set(value); 32 | } 33 | 34 | @Nonnull 35 | @Override 36 | public T get() { 37 | return requireNonNull(state.get()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ibm-mq-metrics/templates/registry/java/IbmMqAttributes.java.j2: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The OpenTelemetry Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package io.opentelemetry.ibm.mq.metrics; 6 | 7 | import static io.opentelemetry.api.common.AttributeKey.stringKey; 8 | import static io.opentelemetry.api.common.AttributeKey.longKey; 9 | import io.opentelemetry.api.common.AttributeKey; 10 | 11 | // This file is generated using weaver. Do not edit manually. 12 | 13 | /** Attribute definitions generated from a Weaver model. Do not edit manually. */ 14 | public final class IbmMqAttributes { 15 | {% for attr in ctx %} 16 | /** 17 | {{ attr.brief }} */{% if attr.type == 'string' %} 18 | public final static AttributeKey {{ attr.name.upper().split('.')|join('_') }} = stringKey("{{attr.name}}"); 19 | {% elif attr.type == 'int' %} 20 | public final static AttributeKey {{ attr.name.upper().split('.')|join('_') }} = longKey("{{attr.name}}"); 21 | {% else %} 22 | // UNHANDLED TYPE PLEASE FIXME 23 | public final static AttributeKey {{ attr.name.upper().split('.')|join('_') }} = ??key("{{attr.name}}"); 24 | {% endif %} 25 | {% endfor %} 26 | private IbmMqAttributes(){} 27 | } 28 | --------------------------------------------------------------------------------