Skip to content
Merged
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 @@ -285,6 +285,10 @@ def _get_identifier_from_hostname(self, hostname: str) -> str:
parts = hostname.split(".")
if hostname.endswith("amazonaws.com") and len(parts) == 6:
return f"{parts[0]}.{parts[2]}"
# AWS China regions use the amazonaws.com.cn endpoint suffix
# e.g. my-cluster.id.cn-north-1.redshift.amazonaws.com.cn (7 parts vs 6 for global)
if hostname.endswith("amazonaws.com.cn") and len(parts) == 7:
return f"{parts[0]}.{parts[2]}"
self.log.debug(
"""Could not parse identifier from hostname '%s'.
You are probably using IP to connect to Redshift cluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,18 @@ def test_get_conn_iam_does_not_mutate_connection(self, mock_connect, mock_aws_ho
{},
"1.2.3.4",
),
# test with AWS China region endpoint (provisioned cluster)
(
"cluster_identifier_from_host.id.cn-north-1.redshift.amazonaws.com.cn",
{"iam": True},
"cluster_identifier_from_host.cn-north-1",
),
# test with AWS China region endpoint (serverless)
(
"workgroup-name.account-id.cn-northwest-1.redshift-serverless.amazonaws.com.cn",
{"iam": True},
"workgroup-name.cn-northwest-1",
),
],
)
def test_get_openlineage_redshift_authority_part(
Expand Down
Loading