-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove extra information and fix actions
- Loading branch information
Станислав Михайлов
committed
Sep 19, 2024
1 parent
ad55590
commit 34dc068
Showing
9 changed files
with
228 additions
and
35 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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import asyncio | ||
|
||
from kontur.httptoolkitcore import AsyncService, Service | ||
from kontur.httptoolkitcore.transport import HttpxTransport, AsyncHttpxTransport | ||
from kontur.httptoolkitcoreopentelemetry import HttpxTransportInstrumentor | ||
|
||
from instrumentation import tracer | ||
|
||
|
||
HttpxTransportInstrumentor.instrument() | ||
|
||
|
||
def sync_request(): | ||
with tracer.start_as_current_span("client-app-sync"): | ||
response = Service( | ||
transport=HttpxTransport( | ||
"http://server:8888", | ||
open_timeout_in_seconds=60, | ||
read_timeout_in_seconds=60, | ||
) | ||
).get("/") | ||
assert response.status_code == 200 | ||
|
||
|
||
async def async_request(): | ||
with tracer.start_as_current_span("client-app-async"): | ||
response = await AsyncService( | ||
transport=AsyncHttpxTransport( | ||
"http://server:8888", | ||
open_timeout_in_seconds=60, | ||
read_timeout_in_seconds=60, | ||
) | ||
).get("/") | ||
assert response.status_code == 200 | ||
|
||
|
||
with tracer.start_as_current_span("client-app"): | ||
sync_request() | ||
asyncio.run(async_request()) |
14 changes: 14 additions & 0 deletions
14
kontur/httptoolkitcoreopentelemetry/example/docker-compose.yml
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,14 @@ | ||
version: '3.6' | ||
|
||
services: | ||
client: | ||
image: $PYTHON_IMAGE | ||
env_file: | ||
- .env.common | ||
- clients/.env.clients | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
pip install -r requirements.txt | ||
python client.py |
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,5 @@ | ||
opentelemetry-api | ||
opentelemetry-sdk | ||
opentelemetry-exporter-otlp-proto-grpc | ||
|
||
kontur_http_toolkit_core[opentelemetry]~=1.0 |
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