azure-sdk-for-python
azure-sdk-for-python copied to clipboard
Azure Monitor Exporter connection string parser insights key validator regex expression
- azure-monitor-opentelemetry-exporter
- 1.0.0b4
- linux/ubuntu
- 3.8
Describe the bug ValueError: Invalid instrumentation key. It should be a valid UUID.
The regex validation in _connection_string_parser.py for azure monitor exporter seems wrong. This is being used: uuid_regex_pattern = re.compile( "^[0-9a-f]{8}-" "[0-9a-f]{4}-" "[1-5][0-9a-f]{3}-" "[89ab][0-9a-f]{3}-" "[0-9a-f]{12}$" ) But app insights has generated a key where the first letter is not [1-5]. How is this regex not [0-9a-f] for all of the segments of the uuid?
uuid_regex_pattern = re.compile( "^[0-9a-f]{8}-" "[0-9a-f]{4}-" "[0-9a-f]{4}-" "[0-9a-f]{4}-" "[0-9a-f]{12}$" )
To Reproduce Steps to reproduce the behavior: 1. connection_string = 'aa11a1aa-aaa1-f111-aa1a-11111aa11a11' AzureMonitorTraceExporter.from_connection_string(connection_string)
throws ValueError: Invalid instrumentation key. It should be a valid UUID. Expected behavior A clear and concise description of what you expected to happen.
This code should work?
Thank you for your feedback @tomasro27. We will investigate asap and get back to you
Thank you for your feedback. This has been routed to the support team for assistance.
@tomasro27
But app insights has generated a key where the first letter is not [1-5].
You were able to generate an ikey in which the first character of the third section was not in [1-5] for Application Insights in production?
Fixed with https://github.com/Azure/azure-sdk-for-python/pull/28316