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): add metrics logging and configuration support #1559

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Junjiequan
Copy link
Contributor

Description

Motivation

Fixes

  • Bug fixed (#X)

Changes:

  • changes made

Tests included

  • Included for each change/fix?
  • Passing?

Documentation

  • swagger documentation updated (required for API changes)
  • official documentation updated

official documentation info

@Junjiequan Junjiequan changed the title feat(metrics): add metrics logging and configuration support [WIP] feat(metrics): add metrics logging and configuration support Dec 11, 2024
@Junjiequan Junjiequan marked this pull request as draft December 11, 2024 16:00
@Junjiequan Junjiequan added the feature New feature label Dec 11, 2024
@Junjiequan Junjiequan changed the title [WIP] feat(metrics): add metrics logging and configuration support [WIP] [POC] feat(metrics): add metrics logging and configuration support Dec 12, 2024
@Junjiequan Junjiequan force-pushed the SWAP-4345-scicat-be-metrics-system-poc branch from 72084b7 to a8911c0 Compare December 17, 2024 15:28
@Junjiequan Junjiequan requested a review from nitrosx January 7, 2025 14:50
@Junjiequan Junjiequan marked this pull request as ready for review January 7, 2025 14:50
@Junjiequan Junjiequan force-pushed the SWAP-4345-scicat-be-metrics-system-poc branch from a1f424b to f656e3a Compare January 7, 2025 14:51
@Junjiequan Junjiequan changed the title [WIP] [POC] feat(metrics): add metrics logging and configuration support feat(metrics): add metrics logging and configuration support Jan 7, 2025
Comment on lines +48 to +49
(env: NodeJS.ProcessEnv) => env.METRICS_ENABLED === "yes",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the configuration module that is imported on line 43?

Copy link
Contributor Author

@Junjiequan Junjiequan Jan 10, 2025

Choose a reason for hiding this comment

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

I have checked official documentation and some other articles. ConditionalModule.registerWhen method do not support access to the configService.
The cleanest way is to use ConditionalModule.registerWhen and fetch env directly, however, there's hack to achieve same result with DyncmiModule with increased complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

src/metrics/middlewares/accessTracking.middleware.ts Outdated Show resolved Hide resolved
metricsConfig.example.json Outdated Show resolved Hide resolved
@Junjiequan Junjiequan force-pushed the SWAP-4345-scicat-be-metrics-system-poc branch from 32c4913 to 92098f3 Compare January 8, 2025 13:38
@Junjiequan Junjiequan force-pushed the SWAP-4345-scicat-be-metrics-system-poc branch from 92098f3 to a99a96d Compare January 10, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants