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: add prometheus metrics #11612

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

Conversation

jiangbo721
Copy link
Contributor

Summary

Added Prometheus monitoring, users can add corresponding indicators to grafana to monitor alarms.

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

Screenshots

Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

image
WX20241212-224019

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 12, 2024
@jiangbo721 jiangbo721 force-pushed the add_prometheus_metrics branch from 161a656 to 12cb895 Compare December 13, 2024 11:41
@luckylhb90
Copy link
Contributor

File "dify/api/core/app/task_pipeline/workflow_cycle_manage.py", line 740, in _workflow_time_it
username = self._user.email if isinstance(self._user, Account) else self._user.name
^^^^^^^^^^^^^^^^

sqlalchemy.orm.exc.DetachedInstanceError: Instance <Account at 0x1773d2dd0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3)

2024-12-20 12:03:05,583,583 WARNING [large_language_model.py:691] 42e8fe48a1 Callback MetricsCallback on_new_chunk failed with error 'NoneType' object has no attribute 'latency'

Well done, I just need it, I tested it, some bugs, can be fixed.

@jiangbo721 jiangbo721 force-pushed the add_prometheus_metrics branch 5 times, most recently from 3b1afa8 to 4b6bfd5 Compare December 20, 2024 13:20
@jiangbo721 jiangbo721 force-pushed the add_prometheus_metrics branch from 4b6bfd5 to b8b7907 Compare December 20, 2024 13:27
@jiangbo721
Copy link
Contributor Author

File "dify/api/core/app/task_pipeline/workflow_cycle_manage.py", line 740, in _workflow_time_it username = self._user.email if isinstance(self._user, Account) else self._user.name ^^^^^^^^^^^^^^^^

sqlalchemy.orm.exc.DetachedInstanceError: Instance <Account at 0x1773d2dd0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3)

2024-12-20 12:03:05,583,583 WARNING [large_language_model.py:691] 42e8fe48a1 Callback MetricsCallback on_new_chunk failed with error 'NoneType' object has no attribute 'latency'

Well done, I just need it, I tested it, some bugs, can be fixed.

have a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants