Skip to content

Commit 7da6603

Browse files
cbosbaywet
authored andcommitted
Update changelog and add info how to use OpenTelemetry with GraphServiceClient
1 parent 8221a4a commit 7da6603

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Added
10+
### Changed
11+
12+
- Changed CoreHttpProvider dependency from OkHttpClient to Call.Factory (parent interface implemented by OkHttpClient). This make usage of OpenTelemetry tracing possible.
13+
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/okhttp/okhttp-3.0/library/README.md
14+
15+
```java
16+
private Call.Factory createTracedClient(OpenTelemetry openTelemetry, @Nonnull final IAuthenticationProvider auth) {
17+
return OkHttpTelemetry.builder(openTelemetry).build().newCallFactory(createClient(auth));
18+
}
19+
20+
private OkHttpClient createClient(@Nonnull final IAuthenticationProvider auth) {
21+
return HttpClients.createDefault(auth);
22+
}
23+
24+
// then create the GraphServiceClient
25+
IAuthenticationProvider authenticationProvider = ...;
26+
GraphServiceClient
27+
.builder(Call.Factory.class, Request.class)
28+
.httpClient(createTracedClient(openTelemetry, authenticationProvider))
29+
.authenticationProvider(authenticationProvider)
30+
.buildClient();
31+
```
32+
1133

1234
## [2.0.20] - 2023-10-23
1335

0 commit comments

Comments
 (0)