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 prometheus duplicated metrics #6911

Merged
merged 14 commits into from
May 8, 2024
Merged

Conversation

EmrysMyrddin
Copy link
Collaborator

Description

When polling is enabled, a new Mesh instance is created in the same Node run. This means the plugins are initialized again, which for the Prometheus plugin means we are trying to register metrics again on the same registry. But this is not something possible with the prom-client API.

Fixes #6545

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)

Further comments

The actual fix is the addition of a metrics objects (Histogram, Counter and Summary) cache based on registry instance and metric name. The actual implementation of this is done in the base envelop plugin (see n1ru4l/envelop#2217).

For this to actually work, we had to change the API to customize metrics config, but since this was not exposed by the Mesh plugin, this is not an actual breaking change for the Mesh variant plugin.

Copy link

codesandbox bot commented Apr 29, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Apr 29, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
json-machete 0.97.3-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.100.5-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.100.6-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.100.5-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.100.5-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.100.6-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.100.5-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 0.100.0-alpha-20240508110504-0393f55302cc850bd572c5d129d8273595191835 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Apr 29, 2024

💻 Website Preview

The latest changes are available as preview in: https://837e7875.graphql-mesh.pages.dev

@EmrysMyrddin EmrysMyrddin force-pushed the fix-prometheus-duplicated-metrics branch from 1da808c to 2bb1729 Compare May 7, 2024 14:56
@EmrysMyrddin EmrysMyrddin force-pushed the fix-prometheus-duplicated-metrics branch from 934c2eb to 8a38ab2 Compare May 8, 2024 09:33
@EmrysMyrddin EmrysMyrddin force-pushed the fix-prometheus-duplicated-metrics branch from e68ea09 to f48789e Compare May 8, 2024 11:00
@EmrysMyrddin EmrysMyrddin requested a review from ardatan May 8, 2024 11:10
@ardatan ardatan merged commit 532c935 into master May 8, 2024
20 checks passed
@ardatan ardatan deleted the fix-prometheus-duplicated-metrics branch May 8, 2024 11:11
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.

How to run Prometheus with mesh start without giving an error?
2 participants