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

Basic Telemetry Validation #12

Merged
merged 8 commits into from
Dec 16, 2024
Merged

Basic Telemetry Validation #12

merged 8 commits into from
Dec 16, 2024

Conversation

mrm9084
Copy link
Contributor

@mrm9084 mrm9084 commented Oct 10, 2024

Adds Telemetry validation for the feature management library. This doesn't validate fields created in the provider libraries such as allocation id. A separate PR will be created to do end to end validation testing that has an arm template to create FM resources in a live config store that it creates.

mrm9084 and others added 4 commits October 10, 2024 15:35
* Python tests + Spring Start

* debugging

* fixed

* requirementType

* Python Readme & More Spring Tests

* Spring Readme and Updates

* Python variants + basic variants

* Adds .net Validation Tests

* Adjusts variant result to use dynamic configuration value

* Uses Pascal Case in tests

* Merge with main

* Updates to pascal case

* Resovles attribute Users instead of User

* Adjusts tests to all work with new schema

* Fixes test call in shared script

* Update pom.xml

* Fixes path after spring tests

* Fixes schema typo

* Adds name to variant result expectation

* Misc. dotnet fixes

* Adds more names

---------

Co-authored-by: Matt Metcalf <mrm9084@gmail.com>
amerjusupovic
amerjusupovic previously approved these changes Nov 7, 2024
Samples/BasicTelemetry.tests.json Outdated Show resolved Hide resolved
libraryValidations/Python/test_json_validations.py Outdated Show resolved Hide resolved
@microsoft microsoft deleted a comment from zhiyuanliang-ms Nov 11, 2024
@microsoft microsoft deleted a comment from rossgrambo Nov 11, 2024
@mrm9084 mrm9084 requested a review from Copilot December 5, 2024 18:25

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 5 changed files in this pull request and generated no suggestions.

Files not reviewed (3)
  • Samples/BasicTelemetry.sample.json: Language not supported
  • Samples/BasicTelemetry.tests.json: Language not supported
  • libraryValidations/Python/requirements.txt: Language not supported
Comments skipped due to low confidence (2)

libraryValidations/Python/test_json_validations.py:96

  • The telemetry_callback method should explicitly check the event name and properties instead of using None. This could lead to false positives in the tests.
def telemetry_callback(self, evaluation_event):

libraryValidations/Python/test_json_validations_with_provider.py:153

  • Add a check to ensure that connection_string is not None before using it to avoid potential issues if the environment variable is not set.
connection_string = os.getenv("APP_CONFIG_VALIDATION_CONNECTION_STRING")
def test_variant_assignment(self):
test_key = "VariantAssignment"
self.run_tests(test_key)

@patch("featuremanagement.azuremonitor._send_telemetry.azure_monitor_track_event")
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need to be a patch, right? Since we pass in the callback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you look at the method telemetry_callback you see we call the standard publish_telemetry method, so we still need this. The idea is we are testing the publish_telemetry method, the custom callback method is for validating publish_telemetry.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay that works. That feels more like a python test rather than one of the shared test, but I don't think there's harm in checking it here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean by this? This is testing the values we calculate in publish_telemetry. Doesn't .Net also calculate a few values then too?

libraryValidations/Python/test_json_validations.py Outdated Show resolved Hide resolved
@@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
Copy link
Contributor

Choose a reason for hiding this comment

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

I still feel like this code should be deduped between provider and no provider. Ideally the only difference is where we're loading flags from and which tests we read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the issue is that the telemetry part at the very end, I could try to rework it, but that could be it's own PR.

@mrm9084 mrm9084 merged commit 9a3b4a0 into main Dec 16, 2024
5 checks passed
@mrm9084 mrm9084 deleted the BasicTelemetry branch December 16, 2024 18:35
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.

3 participants