Skip to content
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

Merged
merged 5 commits into from
Jan 6, 2023
Merged

Add gateway APM support #5652

merged 5 commits into from
Jan 6, 2023

Conversation

ninpan-ms
Copy link
Contributor


Add new arguments --apm-types, --properties and --secrets for az spring gateway update

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run 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.

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 19, 2022

spring

Comment on lines 721 to 722
c.argument('apm_types', nargs='*',
help="Space-separated list of APM integrated with Gateway, Allowed values: [\"ApplicationInsights\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ElasticAPM\"].")
Copy link
Contributor

@zhoxing-ms zhoxing-ms Jan 5, 2023

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"]
Copy link
Contributor

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\".")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment on lines 721 to 722
c.argument('apm_types', nargs='*',
help="Space-separated list of APM integrated with Gateway.")
Copy link
Contributor

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

Comment on lines 226 to 233
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))
Copy link
Contributor

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?

Comment on lines 442 to 449
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"
Copy link
Contributor

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?

Comment on lines 42 to 45
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
Copy link
Contributor

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?

Comment on lines 227 to 228
if (type not in list(v20221101_preview_AppPlatformEnums.ApmType)):
raise InvalidArgumentValueError("Allowed APM types are: " + ', '.join(list(v20221101_preview_AppPlatformEnums.ApmType)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@zhoxing-ms zhoxing-ms merged commit e465829 into Azure:main Jan 6, 2023
@azclibot
Copy link
Collaborator

azclibot commented Jan 6, 2023

[Release] Update index.json for extension [ spring ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=24519&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants