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 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pgier
Copy link
Owner

@pgier pgier commented Mar 12, 2024

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

Motivation

A previous upgrade (apache#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 pgier changed the title [fix][functions] fix broken function-go test [fix][function] fix broken function-go test Mar 12, 2024
@pgier pgier changed the title [fix][function] fix broken function-go test [fix][fn] fix broken function-go test Mar 12, 2024
Upgrade the prometheus client_golang library which changes the format of the metric output
to match the current tests.
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.

1 participant