-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuhaidong
committed
May 9, 2024
1 parent
d4907ec
commit 0c52c80
Showing
4 changed files
with
25 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
--- | ||
|
||
## [1.2.0] - 2024-04-29 | ||
## [1.2.1] - 2024-04-29 | ||
|
||
### Added: | ||
|
||
|
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,18 @@ | ||
import opentelemetry.trace as trace | ||
from opentelemetry.instrumentation.redis import RedisInstrumentor | ||
|
||
|
||
def sync_once(func): | ||
def wrapper(*args, **kwargs): | ||
if not wrapper._done: | ||
wrapper._done = True | ||
return func(*args, **kwargs) | ||
|
||
wrapper._done = False | ||
return wrapper | ||
|
||
|
||
@sync_once | ||
def otel_instrument(app=None): | ||
if app is None or app.config.get_namespace("OTEL_").get("enable", False): | ||
RedisInstrumentor().instrument(tracer_provider=trace.get_tracer_provider()) |