File tree Expand file tree Collapse file tree 5 files changed +49
-6
lines changed
src/main/java/com/microsoft/graph Expand file tree Collapse file tree 5 files changed +49
-6
lines changed Original file line number Diff line number Diff line change 88 - feature/v2
99 pull_request :
1010 types : [opened, synchronize, reopened]
11+
12+ env :
13+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
14+
1115jobs :
16+ checksecret :
17+ name : check if SONAR_TOKEN is set in github secrets
18+ runs-on : ubuntu-latest
19+ outputs :
20+ is_SONAR_TOKEN_set : ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }}
21+ steps :
22+ - name : Check whether unity activation requests should be done
23+ id : checksecret_job
24+ run : |
25+ echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT
1226 build :
27+ needs : [checksecret]
28+ if : needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true'
1329 name : Build
1430 runs-on : ubuntu-latest
1531 steps :
3753 - name : Build and analyze
3854 env :
3955 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
40- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
4156 run : ./gradlew build sonarqube --info
Original file line number Diff line number Diff line change @@ -9,6 +9,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010### Added
1111
12+ ### Changed
13+
14+ ## [ 2.0.21] - 2023-11-08
15+
16+ ### Changed
17+
18+ - Changed CoreHttpProvider dependency from OkHttpClient to Call.Factory (parent interface implemented by OkHttpClient). This make usage of OpenTelemetry tracing possible.
19+ https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/okhttp/okhttp-3.0/library/README.md
20+
21+ ``` java
22+ private Call . Factory createTracedClient(OpenTelemetry openTelemetry, @Nonnull final IAuthenticationProvider auth) {
23+ return OkHttpTelemetry . builder(openTelemetry). build(). newCallFactory(createClient(auth));
24+ }
25+
26+ private OkHttpClient createClient(@Nonnull final IAuthenticationProvider auth) {
27+ return HttpClients . createDefault(auth);
28+ }
29+
30+ // then create the GraphServiceClient
31+ IAuthenticationProvider authenticationProvider = ... ;
32+ GraphServiceClient
33+ .builder(Call . Factory . class, Request . class)
34+ .httpClient(createTracedClient(openTelemetry, authenticationProvider))
35+ .authenticationProvider(authenticationProvider)
36+ .buildClient();
37+ ```
38+
1239## [ 2.0.20] - 2023-10-23
1340
1441### Changed
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
2525mavenArtifactId = microsoft-graph-core
2626mavenMajorVersion = 2
2727mavenMinorVersion = 0
28- mavenPatchVersion = 20
28+ mavenPatchVersion = 21
2929mavenArtifactSuffix =
3030
3131# These values are used to run functional tests
Original file line number Diff line number Diff line change 4141import javax .annotation .Nonnull ;
4242
4343import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
44+ import okhttp3 .Call ;
4445import okhttp3 .OkHttpClient ;
4546import okhttp3 .Request ;
4647
@@ -185,7 +186,7 @@ private httpClientType getHttpClient() {
185186 @ SuppressWarnings ("unchecked" )
186187 private IHttpProvider <nativeRequestType > getHttpProvider () {
187188 if (httpProvider == null ) {
188- return (IHttpProvider <nativeRequestType >)new CoreHttpProvider (getSerializer (), getLogger (), (OkHttpClient ) getHttpClient ());
189+ return (IHttpProvider <nativeRequestType >)new CoreHttpProvider (getSerializer (), getLogger (), (Call . Factory ) getHttpClient ());
189190 } else {
190191 return httpProvider ;
191192 }
Original file line number Diff line number Diff line change @@ -98,9 +98,9 @@ public class CoreHttpProvider implements IHttpProvider<Request> {
9898 private final ILogger logger ;
9999
100100 /**
101- * The OkHttpClient that handles all requests
101+ * The OkHttpClient(Call.Factory) that handles all requests
102102 */
103- private OkHttpClient corehttpClient ;
103+ private Call . Factory corehttpClient ;
104104
105105 /**
106106 * Creates the CoreHttpProvider
@@ -112,7 +112,7 @@ public class CoreHttpProvider implements IHttpProvider<Request> {
112112 @ SuppressFBWarnings
113113 public CoreHttpProvider (@ Nonnull final ISerializer serializer ,
114114 @ Nonnull final ILogger logger ,
115- @ Nonnull final OkHttpClient httpClient ) {
115+ @ Nonnull final Call . Factory httpClient ) {
116116 Objects .requireNonNull (logger , "parameter logger cannot be null" );
117117 Objects .requireNonNull (serializer , "parameter serializer cannot be null" );
118118 Objects .requireNonNull (httpClient , "parameter httpClient cannot be null" );
You can’t perform that action at this time.
0 commit comments