Skip to content

Commit db428f2

Browse files
author
Liudmila Molkova
authored
ClientCore tracing zero dependencies, no plugins (#43346)
ClientCore tracing zero dependencies, no plugins
1 parent eaf0860 commit db428f2

File tree

65 files changed

+5191
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5191
-71
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/.idea

eng/.docsettings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ known_content_issues:
108108
- ['sdk/clientcore/README.md', '#3113']
109109
- ['sdk/clientcore/core/README.md', '#3113']
110110
- ['sdk/clientcore/http-okhttp3/README.md', '#3113']
111+
- ['sdk/clientcore/optional-dependency-tests/README.md', '#3113']
111112
- ['sdk/core/azure-core-experimental/README.md', '#3113']
112113
- ['sdk/cosmos/faq/README.md', '#3113']
113114
- ['sdk/cosmos/azure-cosmos-benchmark/README.md', '#3113']

eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,17 @@
184184
<suppress checks="com.azure.tools.checkstyle.checks.GoodLoggingCheck" files="ConsoleLogger.java"/>
185185
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck"
186186
files="com.azure.sdk.build.tool.*\.java"/>
187+
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" files="io.clientcore.core.json.*" />
188+
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" files="io.clientcore.core.http.pipeline.HttpLoggingPolicy" />
189+
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" files="io.clientcore.core.http.pipeline.InstrumentationPolicy" />
190+
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="io.clientcore.core.http.client.DefaultHttpClientBuilder" />
191+
<suppress checks="com.azure.tools.checkstyle.checks.UseCaughtExceptionCauseCheck" files="io.clientcore.core.http.pipeline.HttpRetryPolicy" />
192+
193+
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck" files="io.clientcore.http.okhttp3.OkHttpHttpClientBuilder" />
194+
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="io.clientcore.http.okhttp3.OkHttpHttpClientBuilder" />
195+
<suppress checks="ExternalDependencyExposed" files=".*[/\\]http-stress[/\\].*\.java"/>
196+
<suppress checks="IllegalImport" files="io.clientcore.http.*.stress"/>
197+
<suppress checks="IllegalImport" files="io.clientcore.core.telemetry.*Tests"/>
198+
<suppress checks="IllegalImport" files="io.clientcore.core.telemetry.*Benchmarks"/>
199+
<suppress checks="IllegalImport" files="io.clientcore.core.http.pipeline.InstrumentationPolicyTests"/>
187200
</suppressions>

sdk/clientcore/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ extends:
5050
groupId: io.clientcore
5151
safeName: httpokhttp3
5252
releaseInBatch: ${{ parameters.release_clientcorehttpokhttp3 }}
53+
AdditionalModules:
54+
- name: optional-dependency-tests
55+
groupId: io.clientcore

sdk/clientcore/core/checkstyle-suppressions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@
3737
<suppress files="io.clientcore.core.serialization.json.implementation.StringBuilderWriter.java" checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" />
3838
<suppress files="io.clientcore.core.serialization.json.models.JsonNumber.java" checks="com.azure.tools.checkstyle.checks.UseCaughtExceptionCauseCheck" />
3939
<suppress files="io.clientcore.core.http.pipeline.HttpLoggingPolicy" checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" />
40+
<suppress files="io.clientcore.core.http.pipeline.HttpInstrumentationPolicy.java" checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" />
4041
</suppressions>

sdk/clientcore/core/pom.xml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
<properties>
3939
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
40-
<jacoco.min.linecoverage>0.60</jacoco.min.linecoverage>
41-
<jacoco.min.branchcoverage>0.60</jacoco.min.branchcoverage>
40+
<jacoco.min.linecoverage>0.50</jacoco.min.linecoverage>
41+
<jacoco.min.branchcoverage>0.50</jacoco.min.branchcoverage>
4242

4343
<javaModulesSurefireArgLine>
4444
--add-opens io.clientcore.core/io.clientcore.core.annotation=ALL-UNNAMED
@@ -161,14 +161,6 @@
161161
<groupId>org.apache.maven.plugins</groupId>
162162
<artifactId>maven-failsafe-plugin</artifactId>
163163
<version>3.5.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
164-
<dependencies>
165-
<!-- Inject slf4j-simple into integration testing to verify the shim works as intended. -->
166-
<dependency>
167-
<groupId>org.slf4j</groupId>
168-
<artifactId>slf4j-simple</artifactId>
169-
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
170-
</dependency>
171-
</dependencies>
172164
</plugin>
173165

174166
<plugin>
@@ -183,6 +175,23 @@
183175
</excludes>
184176
</configuration>
185177
</plugin>
178+
<plugin>
179+
<groupId>com.azure.tools</groupId>
180+
<artifactId>codesnippet-maven-plugin</artifactId>
181+
<version>1.0.0-beta.10</version> <!-- {x-version-update;com.azure.tools:codesnippet-maven-plugin;external_dependency} -->
182+
<configuration>
183+
<additionalCodesnippets>
184+
<additionalCodesnippet>
185+
<root>../optional-dependency-tests/src/samples/java</root>
186+
<glob>**/*.java</glob>
187+
</additionalCodesnippet>
188+
<additionalCodesnippet>
189+
<root>src/test</root>
190+
<glob>**/*.java</glob>
191+
</additionalCodesnippet>
192+
</additionalCodesnippets>
193+
</configuration>
194+
</plugin>
186195
</plugins>
187196
</build>
188197

sdk/clientcore/core/spotbugs-exclude.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<Class name="io.clientcore.core.implementation.http.rest.SwaggerMethodParser" />
7474
<Class name="io.clientcore.core.serialization.json.implementation.jackson.core.util.RequestPayload" />
7575
<Class name="io.clientcore.core.util.ClientLogger" />
76+
<Class name="io.clientcore.core.implementation.instrumentation.otel.OTelInstrumentation" />
7677
</Or>
7778
</Match>
7879
<Match>
@@ -393,4 +394,12 @@
393394
<Bug pattern="XXE_XMLSTREAMREADER" />
394395
<Class name="io.clientcore.core.serialization.xml.XmlReader" />
395396
</Match>
397+
<Match>
398+
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" />
399+
<Class name="io.clientcore.core.http.pipeline.HttpInstrumentationPolicy" />
400+
</Match>
401+
<Match>
402+
<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE" />
403+
<Class name="io.clientcore.core.http.pipeline.HttpInstrumentationPolicy" />
404+
</Match>
396405
</FindBugsFilter>

sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/RequestOptions.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,26 @@ public RequestOptions setContext(Context context) {
323323
return this;
324324
}
325325

326+
/**
327+
* Adds a key-value pair to the request context associated with this request.
328+
*
329+
* @param key The key to add to the context.
330+
* @param value The value to add to the context.
331+
* @return The updated {@link RequestOptions} object.
332+
*
333+
* @see #setContext(Context)
334+
*/
335+
public RequestOptions putContext(Object key, Object value) {
336+
if (locked) {
337+
throw LOGGER.logThrowableAsError(
338+
new IllegalStateException("This instance of RequestOptions is immutable. Cannot set context."));
339+
}
340+
341+
this.context = this.context.put(key, value);
342+
343+
return this;
344+
}
345+
326346
/**
327347
* Sets the configuration indicating how the body of the resulting HTTP response should be handled. If {@code null},
328348
* the response body will be handled based on the content type of the response.

0 commit comments

Comments
 (0)