-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into influxdb-operation
- Loading branch information
Showing
9 changed files
with
157 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...tp2Test/java/io/opentelemetry/javaagent/instrumentation/okhttp/v3_0/OkHttp3Http2Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.okhttp.v3_0; | ||
|
||
import static java.util.Collections.singletonList; | ||
|
||
import io.opentelemetry.instrumentation.okhttp.v3_0.AbstractOkHttp3Test; | ||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; | ||
import okhttp3.Call; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.Protocol; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class OkHttp3Http2Test extends AbstractOkHttp3Test { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); | ||
|
||
@Override | ||
public Call.Factory createCallFactory(OkHttpClient.Builder clientBuilder) { | ||
clientBuilder.protocols(singletonList(Protocol.H2_PRIOR_KNOWLEDGE)); | ||
return clientBuilder.build(); | ||
} | ||
|
||
@Override | ||
protected void configure(HttpClientTestOptions.Builder optionsBuilder) { | ||
super.configure(optionsBuilder); | ||
|
||
// https does not work with H2_PRIOR_KNOWLEDGE | ||
optionsBuilder.disableTestHttps(); | ||
optionsBuilder.setHttpProtocolVersion(uri -> "2"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ary/src/http2Test/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttp3Http2Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.okhttp.v3_0; | ||
|
||
import static java.util.Collections.singletonList; | ||
|
||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; | ||
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; | ||
import okhttp3.Call; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.Protocol; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class OkHttp3Http2Test extends AbstractOkHttp3Test { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forLibrary(); | ||
|
||
@Override | ||
public Call.Factory createCallFactory(OkHttpClient.Builder clientBuilder) { | ||
clientBuilder.protocols(singletonList(Protocol.H2_PRIOR_KNOWLEDGE)); | ||
return OkHttpTelemetry.builder(testing.getOpenTelemetry()) | ||
.setCapturedRequestHeaders(singletonList(AbstractHttpClientTest.TEST_REQUEST_HEADER)) | ||
.setCapturedResponseHeaders(singletonList(AbstractHttpClientTest.TEST_RESPONSE_HEADER)) | ||
.build() | ||
.newCallFactory(clientBuilder.build()); | ||
} | ||
|
||
@Override | ||
protected void configure(HttpClientTestOptions.Builder optionsBuilder) { | ||
super.configure(optionsBuilder); | ||
|
||
// https does not work with H2_PRIOR_KNOWLEDGE | ||
optionsBuilder.disableTestHttps(); | ||
optionsBuilder.setHttpProtocolVersion(uri -> "2"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters