-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 gateway APM support #5652
Add gateway APM support #5652
Conversation
spring |
src/spring/azext_spring/_params.py
Outdated
c.argument('apm_types', nargs='*', | ||
help="Space-separated list of APM integrated with Gateway, Allowed values: [\"ApplicationInsights\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ElasticAPM\"].") |
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.
Could we define the allowed values as enumeration values and then use the get_enum_type
? In addition, can we get these values from the Python SDK?
def _validate_gateway_apm_types(namespace): | ||
if namespace.apm_types is None: | ||
return | ||
allowedApmTypes = ["ApplicationInsights", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM"] |
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.
It is recommended to define the allowed value as an enumeration, and then reuse it with _params.py
allowedApmTypes = ["ApplicationInsights", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM"] | ||
for type in namespace.apm_types: | ||
if (type not in allowedApmTypes): | ||
raise InvalidArgumentValueError("Allowed APM types are \"ApplicationInsights\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ElasticAPM\".") |
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.
Same as above
src/spring/azext_spring/_params.py
Outdated
c.argument('apm_types', nargs='*', | ||
help="Space-separated list of APM integrated with Gateway.") |
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.
I believe the allowedApmTypes
enumeration can be reused here
allowedApmTypes = [v20221101_preview_AppPlatformEnums.GatewayApmType.APPLICATION_INSIGHTS, | ||
v20221101_preview_AppPlatformEnums.GatewayApmType.APP_DYNAMICS, | ||
v20221101_preview_AppPlatformEnums.GatewayApmType.DYNATRACE, | ||
v20221101_preview_AppPlatformEnums.GatewayApmType.NEW_RELIC, | ||
v20221101_preview_AppPlatformEnums.GatewayApmType.ELASTIC_APM] | ||
for type in namespace.apm_types: | ||
if (type not in allowedApmTypes): | ||
raise InvalidArgumentValueError("Allowed APM types are " + ','.join(allowedApmTypes)) |
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.
How about using the v20221101_preview_AppPlatformEnums.GatewayApmType
enumeration from Python SDK directly?
class GatewayApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): | ||
"""Spring Cloud Gateway APM Type.""" | ||
|
||
APPLICATION_INSIGHTS = "ApplicationInsights" | ||
APP_DYNAMICS = "AppDynamics" | ||
DYNATRACE = "Dynatrace" | ||
NEW_RELIC = "NewRelic" | ||
ELASTIC_APM = "ElasticAPM" |
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.
May I ask whether this enumeration is automatically generated by the Python SDK or manually added by you?
src/spring/azext_spring/_params.py
Outdated
from .vendored_sdks.appplatform.v2022_01_01_preview.models._app_platform_management_client_enums import SupportedRuntimeValue, TestKeyType | ||
from .vendored_sdks.appplatform.v2022_09_01_preview.models._app_platform_management_client_enums import BackendProtocol, SessionAffinity | ||
from .vendored_sdks.appplatform.v2022_11_01_preview.models \ | ||
import _app_platform_management_client_enums as v20221101_preview_AppPlatformEnums |
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.
Could you make the way of importing enumeration consistent?
if (type not in list(v20221101_preview_AppPlatformEnums.ApmType)): | ||
raise InvalidArgumentValueError("Allowed APM types are: " + ', '.join(list(v20221101_preview_AppPlatformEnums.ApmType))) |
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.
Same as above
[Release] Update index.json for extension [ spring ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=24519&view=results |
Add new arguments
--apm-types
,--properties
and--secrets
foraz spring gateway update
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.json
automatically.The precondition is to put your code inside this repository and upgrade the version in the pull request but do not modify
src/index.json
.