-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[ja] fix: drifted files of content/ja/docs/zero-code/python/ #7906
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
Open
Msksgm
wants to merge
8
commits into
main
Choose a base branch
from
drifted-content-ja-docs-zero-code-python
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
03cfbfe
to
071eb7e
Compare
071eb7e
to
5f04642
Compare
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
kohbis
reviewed
Sep 29, 2025
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.
@Msksgm いくつかコメントしました 🙇
Co-authored-by: Kohei Sugimoto <[email protected]>
Co-authored-by: Kohei Sugimoto <[email protected]>
Co-authored-by: Kohei Sugimoto <[email protected]>
Co-authored-by: Kohei Sugimoto <[email protected]>
Co-authored-by: Kohei Sugimoto <[email protected]>
Co-authored-by: Kohei Sugimoto <[email protected]>
@kohbis |
/fix:dict |
✅ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
original.
preview.
drifted diffs.
+### Pre-fork server issues
+
+A pre-fork server, such as Gunicorn with multiple workers, could be run like
+this:
+
+
sh +gunicorn myapp.main:app --workers 4 +
+
+However, specifying more than one
--workers
may break the generation of+metrics when auto-instrumentation is applied. This is because forking, the
+creation of worker/child processes, creates inconsistencies between each child
+in the background threads and locks assumed by key OpenTelemetry SDK components.
+Specifically, the
PeriodicExportingMetricReader
spawns its own thread to+periodically flush data to the exporter. See also issues
+#2767 and
+#3307.
+After forking, each child seeks a thread object in memory that is not actually
+run, and any original locks may not unlock for each child. See also forks and
+deadlocks described in Python issue 6721.
+
+#### Workarounds
+
+There are some workarounds for pre-fork servers with OpenTelemetry. The
+following table summarizes the current support of signal export by different
+auto-instrumented web server gateway stacks that have been pre-forked with
+multiple workers. See below for more details and options:
+
+| Stack with multiple workers | Traces | Metrics | Logs |
+| --------------------------- | ------ | ------- | ---- |
+| Uvicorn | x | | x |
+| Gunicorn | x | | x |
+| Gunicorn + UvicornWorker | x | x | x |
+
+##### Deploy with Gunicorn and UvicornWorker
+
+To auto-instrument a server with multiple workers, it is recommended to deploy
+using Gunicorn with
uvicorn.workers.UvicornWorker
if it is an Asynchronous+Server Gateway Interface (ASGI) app (FastAPI, Starlette, etc). The UvicornWorker
+class is specifically designed to handle forks with preservation of background
+processes and threads. For example:
+
+```sh
+opentelemetry-instrument gunicorn \
+```
+##### Use programmatic auto-instrumentation
+
+Initialize OpenTelemetry inside the worker process with
+programmatic auto-instrumentation
+after the server fork, instead of with
opentelemetry-instrument
. For example:+
+
python +from opentelemetry.instrumentation.auto_instrumentation import initialize +initialize() + +from your_app import app +
+
+If using FastAPI, note that
initialize()
must be called before importing+
FastAPI
because of how instrumentation is patched. For example:+
+```python
+from opentelemetry.instrumentation.auto_instrumentation import initialize
+initialize()
+
+from fastapi import FastAPI
+
+app = FastAPI()
+
[email protected]("/")
+async def root():
+```
+Then, run the server with:
+
+
sh +uvicorn main:app --workers 2 +
+
+##### Use Prometheus with direct OTLP
+
+Consider using a recent version of
+Prometheus to receive OTLP
+metrics directly. Set up a
PeriodicExportingMetricReader
and one OTLP worker+per process to push to Prometheus server. We recommend not using
+
PrometheusMetricReader
with forking -- see issue+#3747.
+
+##### Use a single worker
+
+Alternatively, use a single worker in pre-fork with zero-code instrumentation:
+
+
sh +opentelemetry-instrument gunicorn your_app:app --workers 1 +
+
Connectivity issues
gRPC Connectivity
diff --git a/content/en/docs/zero-code/python/configuration.md b/content/en/docs/zero-code/python/configuration.md
index 4aa43d83..971332d9 100644
--- a/content/en/docs/zero-code/python/configuration.md
+++ b/content/en/docs/zero-code/python/configuration.md
@@ -5,7 +5,8 @@ weight: 10
aliases:
-cSpell:ignore: healthcheck instrumentor myapp pyproject Starlette urllib
+# prettier-ignore
+cSpell:ignore: gevent healthcheck instrumentor monkeypatch myapp pyproject Starlette urllib
The agent is highly configurable, either by:
@@ -146,6 +147,9 @@ specific category.
OTEL_PYTHON_ID_GENERATOR
: to specify which IDs generator to use for theglobal Tracer Provider
OTEL_PYTHON_INSTRUMENTATION_SANITIZE_REDIS
: to enable query sanitization+-
OTEL_PYTHON_AUTO_INSTRUMENTATION_EXPERIMENTAL_GEVENT_PATCH
: set topatch_all
to call gevent monkeypatchpatch_all
method before initializingExamples:
@@ -155,6 +159,7 @@ export OTEL_PYTHON_ELASTICSEARCH_NAME_PREFIX=my-custom-prefix
export OTEL_PYTHON_GRPC_EXCLUDED_SERVICES="GRPCTestServer,GRPCHealthServer"
export OTEL_PYTHON_ID_GENERATOR=xray
export OTEL_PYTHON_INSTRUMENTATION_SANITIZE_REDIS=true
+export OTEL_PYTHON_AUTO_INSTRUMENTATION_EXPERIMENTAL_GEVENT_PATCH=patch_all