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 import (
|
|
|
|
PipelineReportingConfig,
|
|
|
|
reporting,
|
|
|
|
)
|
|
|
|
from pydantic import Field as pydantic_Field
|
|
|
|
|
|
|
|
|
|
|
|
class Reporters(Enum):
|
|
|
|
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."""
|
|
|
|
|
2024-07-15 16:42:22 -07:00
|
|
|
type: Literal["app_insights"] = Reporters.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 = (
|
|
|
|
reporting.PipelineReportingConfigTypes | PipelineAppInsightsReportingConfig
|
|
|
|
)
|