51 lines
1.4 KiB
Python
Raw Permalink Normal View History

2024-06-26 15:45:06 -04:00
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
from enum import Enum
from typing import Literal
from graphrag.index.config.reporting import (
2024-06-26 15:45:06 -04:00
PipelineReportingConfig,
PipelineReportingConfigTypes,
2024-06-26 15:45:06 -04:00
)
from pydantic import Field as pydantic_Field
class Logger(Enum):
2024-06-26 15:45:06 -04:00
BLOB = (1, "blob")
CONSOLE = (2, "console")
FILE = (3, "file")
2024-07-15 16:42:22 -07:00
APP_INSIGHTS = (4, "app_insights")
2024-06-26 15:45:06 -04:00
class PipelineAppInsightsReportingConfig(
2024-07-15 16:42:22 -07:00
PipelineReportingConfig[Literal["app_insights"]]
2024-06-26 15:45:06 -04:00
):
"""Represents the ApplicationInsights reporting configuration for the pipeline."""
type: Literal["app_insights"] = Logger.APP_INSIGHTS.name.lower()
2024-06-26 15:45:06 -04:00
"""The type of reporting."""
connection_string: str = pydantic_Field(
description="The connection string for the App Insights instance.",
default=None,
)
"""The connection string for the App Insights instance."""
logger_name: str = pydantic_Field(
description="The name for logger instance", default=None
)
"""The name for logger instance"""
logger_level: int = pydantic_Field(
description="The name of the logger. Defaults to None.", default=logging.INFO
)
"""The name of the logger. Defaults to None."""
# add the new type to the existing PipelineReportingConfigTypes
PipelineReportingConfigTypes = (
PipelineReportingConfigTypes | PipelineAppInsightsReportingConfig
2024-06-26 15:45:06 -04:00
)