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

Move the metrics basic test to TestBase class #3092

Closed

Conversation

shalevr
Copy link
Member

@shalevr shalevr commented Dec 14, 2022

Description

Move the metrics basic test to TestBase class so each metric instrumentation could use those functions
The functions moved from the tornado instrumentation test:
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0f2451be26c87a366d44283022341fc904c88b22/instrumentation/opentelemetry-instrumentation-tornado/tests/test_metrics_instrumentation.py#L38

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@shalevr shalevr requested a review from a team as a code owner December 14, 2022 16:13
@shalevr shalevr force-pushed the Move-metrics-basic-test-to-TestBase branch 4 times, most recently from 934c9b5 to 8c56a37 Compare December 14, 2022 17:12
@shalevr shalevr force-pushed the Move-metrics-basic-test-to-TestBase branch from 8c56a37 to 459bb92 Compare December 14, 2022 17:28
self.assertEqual(
data_point.sum,
expected_value,
)
Copy link
Member

Choose a reason for hiding this comment

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

Where are min, max, count etc... assertions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@shalevr
Copy link
Member Author

shalevr commented Dec 18, 2022

Can you add a Skip Changelog label?

@shalevr shalevr marked this pull request as draft December 20, 2022 12:27
@shalevr shalevr force-pushed the Move-metrics-basic-test-to-TestBase branch from bcc7b78 to eb27734 Compare December 20, 2022 13:14
@shalevr shalevr marked this pull request as ready for review December 20, 2022 13:14
@srikanthccv srikanthccv self-assigned this Jan 11, 2023
Comment on lines +117 to +118
metric: Metric,
expected_value: Union[int, float],
Copy link
Member

Choose a reason for hiding this comment

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

The way I would find this useful is if it takes the current metric and the expected metric, not a single float/int value. The following code has things that don't make it useable for many use cases; why does the count have to be 1? How can one use this when the count is not 1? There are no assertions of min, max etc.?

@shalevr shalevr marked this pull request as draft January 24, 2023 09:54
@shalevr shalevr mentioned this pull request Feb 16, 2023
10 tasks
@shalevr shalevr closed this Feb 23, 2023
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.

None yet

3 participants