-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add jaeger tracing #3
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ba61533
add jaeger tracing
rsweis62 74f298f
fix env var
rsweis62 c4343dc
add docker test
rsweis62 d2b42a3
update actions
rsweis62 076390a
clean up and app reload fix
rsweis62 1198329
fix docker files and use manual otel
rsweis62 026c72b
update to follow base settings pattern
rsweis62 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 |
---|---|---|
@@ -1 +1,4 @@ | ||
# place to init logging changes and monitoring integration | ||
import os | ||
|
||
if os.environ.get("OTEL_SERVICE_NAME"): | ||
import opentelemetry.instrumentation.auto_instrumentation.sitecustomize as autotrace | ||
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,46 @@ | ||
version: "3.8" | ||
|
||
services: | ||
fast-api-docker-poetry: | ||
image: local/fast-api-docker-poetry:${BUILD_TAG:-local-dev} | ||
ports: | ||
- "8009:8009" | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: ${TARGET:-development} | ||
environment: | ||
POSTGRES_DB_HOST: postgresql | ||
OTEL_SERVICE_NAME: fastApiDockerPoetry | ||
OTEL_METRICS_EXPORTER: none | ||
OTEL_TRACES_EXPORTER: "otlp" | ||
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317 | ||
volumes: | ||
- ./app:/home/appuser/app | ||
- ./tests:/home/appuser/tests | ||
depends_on: | ||
- fast-api-postgres | ||
- jaeger | ||
links: | ||
- fast-api-postgres:postgresql | ||
- jaeger:jaeger | ||
|
||
fast-api-postgres: | ||
image: postgres:15-alpine | ||
ports: | ||
- "5432:5432" | ||
# volumes: | ||
# - .pgdata/:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_DB: fastapi_db | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
|
||
jaeger: | ||
image: jaegertracing/all-in-one:latest | ||
ports: | ||
- "16686:16686" # Jaeger UI | ||
- "4317:4317" # OTLP gRPC | ||
environment: | ||
COLLECTOR_OTLP_ENABLED: "true" | ||
LOG_LEVEL: "debug" |
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
Large diffs are not rendered by default.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this certainly works. You can also do the pre-setup too like you had and just call this at the end. Example:
The real power of doing that is that you can do different things based on your
BaseSettings
bindings instead of only using environment variables.For example, you might want to disable exports like in a local environment (relevant if you're using something like Datadog or don't wan to run Jaeger):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
youre right I'm creating an inconsistent pattern. Ill add these to BaseSettings and merge