pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[feat][broker] PIP-264: Add schema registry metrics

Open dragosvictor opened this issue 9 months ago • 2 comments

PIP-264

Motivation

Exposes the current Schema Registry metrics described in the doc using OpenTelemetry.

Modifications

Modified SchemaRegistryStats to expose metrics pulsar.broker.request.schema_registry.duration and pulsar.broker.operation.schema_registry.compatibility_check.count. A full description of these metrics can be found in the documentation PR: https://github.com/apache/pulsar-site/pull/892. Unlike the former approach, this records request latencies irrespective of the response type (success/failure), thus simplifying the design.

Modified SchemaRegistryStats to not be a singleton. This fits better with the OpenTelemetry design and allows for easier testing, as resources are not shared across tests. It broke parameterized test class SimpleSchemaTest, which had to be fixed by reordering the test based on the test instance object first. This way, no two instances of the same metric co-exist, as expected by the OpenTelemetry SDK.

Verifying this change

  • [ ] Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Extended tests SchemaServiceTest#testSchemaRegistryMetrics and SchemaServiceTest#checkIsCompatible to validate the new metrics

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

  • [ ] 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: As described above
  • [ ] Anything that affects deployment

Documentation

  • [ ] doc
  • [x] doc-required https://github.com/apache/pulsar-site/pull/892
  • [ ] doc-not-needed
  • [ ] doc-complete

Matching PR in forked repository

PR in forked repository: https://github.com/dragosvictor/pulsar/pull/19

dragosvictor avatar May 01 '24 06:05 dragosvictor

/pulsarbot rerun-failure-checks

nodece avatar May 05 '24 15:05 nodece

@dragosvictor please resolve the merge conflicts in this PR

lhotari avatar May 20 '24 16:05 lhotari