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

[AutoPR apimanagement/resource-manager] [DO NOT MERGE] httpCorrelationProtocol property was added to diagnostic entity #6148

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
State,
SamplingType,
AlwaysLog,
HttpCorrelationProtocol,
PolicyContentFormat,
VersioningScheme,
GrantType,
Expand Down Expand Up @@ -594,6 +595,7 @@
'State',
'SamplingType',
'AlwaysLog',
'HttpCorrelationProtocol',
'PolicyContentFormat',
'VersioningScheme',
'GrantType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class AlwaysLog(str, Enum):
all_errors = "allErrors" #: Always log all erroneous request regardless of sampling settings.


class HttpCorrelationProtocol(str, Enum):

none = "None" #: Do not read and inject correlation headers.
legacy = "Legacy" #: Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.
w3_c = "W3C" #: Inject Trace Context headers. See https://w3c.github.io/trace-context.


class PolicyContentFormat(str, Enum):

xml = "xml" #: The contents are inline and Content type is an XML document.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class DiagnosticContract(Resource):
Headers coming to Api Management Service. Only applicable to Application
Insights diagnostics. Default is true.
:type enable_http_correlation_headers: bool
:param http_correlation_protocol: Sets correlation protocol to use for
Application Insights diagnostics. Possible values include: 'None',
'Legacy', 'W3C'
:type http_correlation_protocol: str or
~azure.mgmt.apimanagement.models.HttpCorrelationProtocol
"""

_validation = {
Expand All @@ -63,6 +68,7 @@ class DiagnosticContract(Resource):
'frontend': {'key': 'properties.frontend', 'type': 'PipelineDiagnosticSettings'},
'backend': {'key': 'properties.backend', 'type': 'PipelineDiagnosticSettings'},
'enable_http_correlation_headers': {'key': 'properties.enableHttpCorrelationHeaders', 'type': 'bool'},
'http_correlation_protocol': {'key': 'properties.httpCorrelationProtocol', 'type': 'str'},
}

def __init__(self, **kwargs):
Expand All @@ -73,3 +79,4 @@ def __init__(self, **kwargs):
self.frontend = kwargs.get('frontend', None)
self.backend = kwargs.get('backend', None)
self.enable_http_correlation_headers = kwargs.get('enable_http_correlation_headers', None)
self.http_correlation_protocol = kwargs.get('http_correlation_protocol', None)
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class DiagnosticContract(Resource):
Headers coming to Api Management Service. Only applicable to Application
Insights diagnostics. Default is true.
:type enable_http_correlation_headers: bool
:param http_correlation_protocol: Sets correlation protocol to use for
Application Insights diagnostics. Possible values include: 'None',
'Legacy', 'W3C'
:type http_correlation_protocol: str or
~azure.mgmt.apimanagement.models.HttpCorrelationProtocol
"""

_validation = {
Expand All @@ -63,13 +68,15 @@ class DiagnosticContract(Resource):
'frontend': {'key': 'properties.frontend', 'type': 'PipelineDiagnosticSettings'},
'backend': {'key': 'properties.backend', 'type': 'PipelineDiagnosticSettings'},
'enable_http_correlation_headers': {'key': 'properties.enableHttpCorrelationHeaders', 'type': 'bool'},
'http_correlation_protocol': {'key': 'properties.httpCorrelationProtocol', 'type': 'str'},
}

def __init__(self, *, logger_id: str, always_log=None, sampling=None, frontend=None, backend=None, enable_http_correlation_headers: bool=None, **kwargs) -> None:
def __init__(self, *, logger_id: str, always_log=None, sampling=None, frontend=None, backend=None, enable_http_correlation_headers: bool=None, http_correlation_protocol=None, **kwargs) -> None:
super(DiagnosticContract, self).__init__(**kwargs)
self.always_log = always_log
self.logger_id = logger_id
self.sampling = sampling
self.frontend = frontend
self.backend = backend
self.enable_http_correlation_headers = enable_http_correlation_headers
self.http_correlation_protocol = http_correlation_protocol