| from rest_framework import serializers | |
| from .models import ErrorPattern, FailureAnalysis, FixAction | |
| class FixActionSerializer(serializers.ModelSerializer): | |
| class Meta: | |
| model = FixAction | |
| fields = [ | |
| "id", | |
| "analysis", | |
| "action_type", | |
| "description", | |
| "config_changes", | |
| "is_applied", | |
| "applied_at", | |
| "applied_by", | |
| "created_at", | |
| ] | |
| read_only_fields = [ | |
| "id", | |
| "is_applied", | |
| "applied_at", | |
| "applied_by", | |
| "created_at", | |
| ] | |
| class FailureAnalysisSerializer(serializers.ModelSerializer): | |
| fix_actions = FixActionSerializer(many=True, read_only=True) | |
| run_name = serializers.CharField(source="run.name", read_only=True) | |
| run_status = serializers.CharField(source="run.status", read_only=True) | |
| initiated_by_username = serializers.CharField( | |
| source="initiated_by.username", read_only=True | |
| ) | |
| class Meta: | |
| model = FailureAnalysis | |
| fields = [ | |
| "id", | |
| "run", | |
| "run_name", | |
| "run_status", | |
| "initiated_by", | |
| "initiated_by_username", | |
| "status", | |
| "root_cause_category", | |
| "root_cause_detail", | |
| "confidence", | |
| "error_logs", | |
| "anomaly_patterns", | |
| "suggestions", | |
| "fix_actions", | |
| "created_at", | |
| ] | |
| read_only_fields = [ | |
| "id", | |
| "status", | |
| "root_cause_category", | |
| "root_cause_detail", | |
| "confidence", | |
| "error_logs", | |
| "anomaly_patterns", | |
| "suggestions", | |
| "created_at", | |
| ] | |
| class ErrorPatternSerializer(serializers.ModelSerializer): | |
| class Meta: | |
| model = ErrorPattern | |
| fields = [ | |
| "id", | |
| "pattern_name", | |
| "regex_pattern", | |
| "root_cause_category", | |
| "description", | |
| "suggestion", | |
| "occurrences", | |
| "is_active", | |
| "created_at", | |
| ] | |
| read_only_fields = ["id", "occurrences", "created_at"] | |
Xet Storage Details
- Size:
- 2.22 kB
- Xet hash:
- 12ac2720ee9f228244fa9e2ea9b233b395c94ffccf788384b519c73dae209207
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.