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

feat(metrics): added collectMetricsExpressMiddleware and deprecated defaultMetricsMiddleware #54

Merged
merged 20 commits into from
Aug 27, 2023

Conversation

syncush
Copy link
Contributor

@syncush syncush commented Jul 7, 2023

Question Answer
Bug fix
New feature
Breaking change
Deprecations
Documentation
Tests added
Chore

@syncush syncush requested a review from CptSchnitz July 7, 2023 11:02
@syncush syncush changed the title feat(metrics): added collectMetricsExpressMiddleware and deprecated defaultNodeMetrics feat(metrics): added collectMetricsExpressMiddleware and deprecated defaultMetricsMiddleware Jul 8, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "@map-colonies/telemetry",
"version": "5.0.0",
"version": "5.1.13",
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 7 to 19
const deconstructSemver = (semverString: string): { major: string; minor: string; patch: string; prerelease: string; build: string } | null => {
const match = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([\w-]+))?(?:\+([\w-]+))?/i.exec(semverString);
if (!match) {
return null;
}
return {
major: match[1],
minor: match[2],
patch: match[3],
prerelease: match[4],
build: match[5],
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

move to a common util area

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


export function collectMetricsExpressMiddleware(options: Partial<Opts>): promBundle.Middleware {
const pacakgeInfo = loadPackageInfo();
const defaultOpts: Opts = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe upgrade typescript version and try the satisfy keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

...(options.labels ? options.labels : {}),
};
register.setDefaultLabels(mergedLabels);
if (meregedOptions.collectNodeMetrics) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

merged

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@syncush syncush force-pushed the collect-up-and-express-metrics branch from 33d4445 to 4306a9b Compare August 27, 2023 10:50
@syncush syncush merged commit 1148a83 into master Aug 27, 2023
@syncush syncush deleted the collect-up-and-express-metrics branch August 27, 2023 10:55
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.

2 participants