-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: introduce APM_TRACING RC product
We introduce the APM_TRACING remote configuration product that allows dispatching remote configuration to the library for remote enablement/ configuration of library components and features.
- Loading branch information
Showing
7 changed files
with
82 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
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
Empty file.
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,31 @@ | ||
from ddtrace import config | ||
|
||
|
||
requires = ["remote-configuration"] | ||
|
||
|
||
def post_preload(): | ||
pass | ||
|
||
|
||
def start(): | ||
if config._remote_config_enabled: | ||
from ddtrace.internal.remoteconfig.worker import remoteconfig_poller | ||
from ddtrace.settings.remoteconfig import APMTracingAdapter | ||
|
||
remoteconfig_poller.register("APM_TRACING", APMTracingAdapter()) | ||
|
||
|
||
def restart(join=False): | ||
pass | ||
|
||
|
||
def stop(join=False): | ||
if config._remote_config_enabled: | ||
from ddtrace.internal.remoteconfig.worker import remoteconfig_poller | ||
|
||
remoteconfig_poller.unregister("APM_TRACING") | ||
|
||
|
||
def at_exit(join=False): | ||
stop(join=join) |
File renamed without changes.
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,30 @@ | ||
from ddtrace.internal.core.event_hub import dispatch | ||
from ddtrace.internal.logger import get_logger | ||
from ddtrace.internal.remoteconfig._connectors import PublisherSubscriberConnector | ||
from ddtrace.internal.remoteconfig._publishers import RemoteConfigPublisher | ||
from ddtrace.internal.remoteconfig._pubsub import PubSub | ||
from ddtrace.internal.remoteconfig._subscribers import RemoteConfigSubscriber | ||
|
||
|
||
log = get_logger(__name__) | ||
|
||
|
||
def _rc_callback(data, test_tracer=None): | ||
for metadata, config in zip(data["metadata"], data["config"]): | ||
if metadata is None: | ||
continue | ||
|
||
lib_config = config.get("lib_config") | ||
if lib_config is not None: | ||
dispatch("apm-tracing.rc", (lib_config,)) | ||
print("apm-tracing.rc", (config,)) | ||
|
||
|
||
class APMTracingAdapter(PubSub): | ||
__publisher_class__ = RemoteConfigPublisher | ||
__subscriber_class__ = RemoteConfigSubscriber | ||
__shared_data__ = PublisherSubscriberConnector() | ||
|
||
def __init__(self): | ||
self._publisher = self.__publisher_class__(self.__shared_data__) | ||
self._subscriber = self.__subscriber_class__(self.__shared_data__, _rc_callback, "APM_TRACING") |
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