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

[fix][fn] fix broken function-go test #22260

Merged
merged 1 commit into from Mar 13, 2024

Conversation

pgier
Copy link
Contributor

@pgier pgier commented Mar 13, 2024

Upgrade the prometheus client_golang library which changes the format of the metric output to match the current tests.

Motivation

A previous upgrade (#20579) to the prometheus client library broke one of the tests because the spacing changes in the serialized metric output. The specifc commit in prometheus that caused this change is here: prometheus/client_golang#955

Version v1.15.1 of the prometheus client lib changes the spacing back to what it was in v1.11.0. However, it seems that this spacing is not consistent between versions, so we may want to make the test more flexible in the future to avoid hitting this issue again in future upgrades.

=== RUN   TestExampleSummaryVec
    stats_test.go:149:
        	Error Trace:	/Users/paulgier/projects/apache/pulsar/pulsar-function-go/pf/stats_test.go:149
        	Error:      	Not equal:
        	            	expected: "name: \"pond_temperature_celsius\"\nhelp: \"The temperature of the frog pond.\"\ntype: SUMMARY\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"leiopelma-hochstetteri\"\n  }\n  summary: {\n    sample_count: 0\n    sample_sum: 0\n    quantile: {\n      quantile: 0.5\n      value: nan\n    }\n    quantile: {\n      quantile: 0.9\n      value: nan\n    }\n    quantile: {\n      quantile: 0.99\n      value: nan\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"lithobates-catesbeianus\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 31956.100000000017\n    quantile: {\n      quantile: 0.5\n      value: 32.4\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.4\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"litoria-caerulea\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 29969.50000000001\n    quantile: {\n      quantile: 0.5\n      value: 31.1\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.3\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\n"
        	            	actual  : "name:  \"pond_temperature_celsius\"\nhelp:  \"The temperature of the frog pond.\"\ntype:  SUMMARY\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"leiopelma-hochstetteri\"\n  }\n  summary:  {\n    sample_count:  0\n    sample_sum:  0\n    quantile:  {\n      quantile:  0.5\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  nan\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"lithobates-catesbeianus\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  31956.100000000017\n    quantile:  {\n      quantile:  0.5\n      value:  32.4\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.4\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"litoria-caerulea\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  29969.50000000001\n    quantile:  {\n      quantile:  0.5\n      value:  31.1\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.3\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\n"

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • [ X ] The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • [ X ] doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: pgier#12

Upgrade the prometheus client_golang library which changes the format of the metric output
to match the current tests.
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 13, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution @pgier

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.61%. Comparing base (bbc6224) to head (9c5cf0f).
Report is 47 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22260      +/-   ##
============================================
+ Coverage     73.57%   73.61%   +0.03%     
- Complexity    32624    32755     +131     
============================================
  Files          1877     1879       +2     
  Lines        139502   139794     +292     
  Branches      15299    15340      +41     
============================================
+ Hits         102638   102906     +268     
- Misses        28908    28909       +1     
- Partials       7956     7979      +23     
Flag Coverage Δ
inttests 26.48% <ø> (+1.90%) ⬆️
systests 24.39% <ø> (+0.06%) ⬆️
unittests 72.87% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 83 files with indirect coverage changes

@merlimat merlimat merged commit 20c2f75 into apache:master Mar 13, 2024
59 checks passed
@Technoboy- Technoboy- added this to the 3.3.0 milestone Mar 20, 2024
lhotari pushed a commit that referenced this pull request Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants