-
Notifications
You must be signed in to change notification settings - Fork 1
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
NH-65068 Add is_lambda checks and todos to APM Python #211
Conversation
try: | ||
# SolarWindsDistro._configure does setdefault so this shouldn't | ||
# be None, but safer and more explicit this way | ||
environ_exporters = os.environ.get( | ||
OTEL_TRACES_EXPORTER, | ||
INTL_SWO_DEFAULT_TRACES_EXPORTER, | ||
).split(",") | ||
# If not using the default propagators, | ||
# If not using the default exporters, |
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.
Just fixing an old typo
@@ -530,7 +572,6 @@ def _snake_to_camel_case(key): | |||
self.agent_enabled = cnf_agent_enabled | |||
|
|||
available_cnf = set(self.__config.keys()) | |||
# TODO after alpha: is_lambda |
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.
As per Slack chat starting here, we won't configure token_*
in APM Python like we did in AO. So no longer needed.
@@ -611,11 +652,12 @@ def update_with_env_var(self) -> None: | |||
self.agent_enabled = env_agent_enabled | |||
|
|||
available_envvs = set(self.__config.keys()) | |||
# TODO after alpha: is_lambda |
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.
See above comment.
@@ -700,7 +742,6 @@ def _set_config_value(self, keys_str: str, val: Any) -> Any: | |||
) | |||
self.__config[key] = oboe_trigger_trace | |||
elif keys == ["reporter"]: | |||
# TODO: support 'lambda' |
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.
See above comment.
@@ -46,7 +47,6 @@ | |||
) | |||
from solarwinds_apm.apm_fwkv_manager import SolarWindsFrameworkKvManager | |||
from solarwinds_apm.apm_meter_manager import SolarWindsMeterManager | |||
from solarwinds_apm.apm_noop import Reporter |
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.
This was actually the wrong import used for type checking before. Removed this and added solarwinds_apm.extension.oboe.Reporter
below.
@@ -165,12 +170,16 @@ def _configure_sampler( | |||
), | |||
) | |||
|
|||
def _configure_metrics_span_processor( | |||
def _configure_inbound_metrics_span_processor( |
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.
Renaming for clarity
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.
Looks good !
Thanks @raphael-theriault-swi ! Could I please have another check? I had to resolve a changelog merge conflict. |
This adds
is_lambda
in-code checks and distro setup to APM Python. Also adds TODOs for what's next for lambda mode that I hope are self-explanatory. Big pieces to note:(1) _get_extension_components
The base of this approach is a little draconian: new function
ApmConfig._get_extension_components
declares which parts of the c-lib extension should be no-op depending onagent_enabled
andis_lambda
. Right now it's:After introducing c-lib settings API usage update in https://swicloud.atlassian.net/browse/NH-64716, it will be
I'm doing it this way because we do not want any non-OboeAPI business triggered by APM Python when in lambda, based on testing with Jerry.
(2) _calculate_agent_enabled_config_lambda
New function
ApmConfig._calculate_agent_enabled_config_lambda
is separate from the config check if outside lambda. I'm thinking the only user-side config that would disable APM Python inside lambda would be ifSW_APM_AGENT_ENABLED
is false. As per testing c-lib updates with Jerry, no need for service key.(3) calculate_liboboe_decision
Updates existing function
calculate_liboboe_decision
with a condition ifis_lambda
. It drops trace at the moment until c-lib settings API usage update in https://swicloud.atlassian.net/browse/NH-64716Please let me know what you think!