Skip to content

3-shake/alert-menta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

164 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

alert-menta

An innovative tool πŸš€ for real-time analysis and management of Issues' alerts. πŸ” It identifies alert causes, proposes actionable solutions, πŸ’‘and detailed reports. πŸ“ˆ Designed for developers πŸ‘¨β€πŸ’», managers πŸ“‹, and IT teams .πŸ’» Alert-menta enhances productivity and software quality. 🌟

Overview of alert-menta

The purpose of alert-menta

We reduce the burden of system failure response using LLM.

Main Features

You can receive support for failure handling that is completed within GitHub.

  • Execute commands interactively in GitHub Issue comments:
    • describe command to summarize the Issue
    • analysis command for root cause analysis of failures using 5 Whys method
    • suggest command for proposing improvement measures for failures
    • ask command for asking additional questions
  • Mechanism to improve response accuracy using RAG (in development)
  • Selectable LLM models (OpenAI, VertexAI)
  • Extensible prompt text
    • Multilingual support
  • Allows dialogue that includes images.

How to Use

Alert-menta is intended to be run on GitHub Actions.

1. Prepare GitHub PAT

Prepare a GitHub PAT with the following permissions and register it in Secrets:

  • repo
  • workflow

2. Configure to use LLM

Open AI

Generate an API key and register it in Secrets.

Vertex AI

Enable Vertex AI on Google Cloud. Alert-menta obtains access to VertexAI using Workload Identity Federation. Please see here for details.

3. Create the alert-menta configuration file

Create the alert-menta configuration file in the root of the repository. For details, please see here.

4. Create the Actions configuration file

There is a template available, so please use it.

5. Monitoring alerts or user reports are received on Issues

For the method to bring monitoring alerts to Issues, please see this repository.

6. Execute alert-menta

Execute commands on the Issue. Run commands with a backslash at the beginning (e.g., /describe). For the ask command, leave a space and enter the question (e.g., /ask What about the Next Action?). Alert-menta includes the text of the Issue in the prompt and sends it to the LLM, then posts the response as a comment on the Issue.

Configuration

.alert-menta.user.yaml

It contains information such as the LLM model to use, system prompt text for each command, etc. The .alert-menta.user.yaml in this repository is a template. The contents are as follows:

system:
  debug: 
    log_level: debug

ai:
  provider: "openai" # "openai" or "vertexai"
  openai:
    model: "gpt-4o-mini" # Check the list of available models by curl https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"
  vertexai:
    project: "<YOUR_PROJECT_ID>"
    location: "us-central1"
    model: "gemini-2.0-flash-001"
  commands:
    - describe:
        description: "Generate a detailed description of the Issue."
        system_prompt: "The following is the GitHub Issue and comments on it. Please Generate a detailed description.\n"
        require_intent: false
    - suggest:
        description: "Provide suggestions for improvement based on the contents of the Issue."
        system_prompt: "The following is the GitHub Issue and comments on it. Please identify the issues that need to be resolved based on the contents of the Issue and provide three suggestions for improvement.\n"
        require_intent: false
    - ask:
        description: "Answer free-text questions."
        system_prompt: "The following is the GitHub Issue and comments on it. Based on the content, provide a detailed response to the following question:\n"
        require_intent: true

Specify the LLM to use with ai.provider. You can change the system prompt with commands.{command}.system_prompt.

Custom command

.alert-menta.user.yaml allows you to set up custom commands for users. Set the following in command.{command}.

  • description
  • system_prompt: describe the primary instructions for this command.
  • require_intent: allows the command to specify arguments. (e.g. if require_intent is true, we execute command that /{command} β€œsome instruction”)

The built-in analysis command uses the 5 Whys method for root cause analysis. You can customize it or create your own RCA command:

- analysis:
    description: "Perform root cause analysis using 5 Whys method."
    system_prompt: |
      You are an SRE expert. Perform a root cause analysis on the following incident.

      Analysis Framework:
      1. Identify the direct cause
      2. Apply 5 Whys analysis
      3. Identify the root cause
      4. List contributing factors
      5. Propose recommended actions

      Output in structured Markdown format with sections:
      - Direct Cause
      - 5 Whys Analysis
      - Root Cause
      - Contributing Factors
      - Recommended Actions
    require_intent: false

Actions

Template

The .github/workflows/alert-menta.yaml in this repository is a template. The contents are as follows:

name: "Alert-Menta: Reacts to specific commands"
run-name: LLM responds to issues against the repository.πŸš€

on:
  issue_comment:
    types: [created]

jobs:
  Alert-Menta:
    if: startsWith(github.event.comment.body, '/') && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
    runs-on: ubuntu-24.04
    permissions:
      issues: write
      contents: read
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4

      - name: Download and Install alert-menta
        run: |
          curl -sLJO -H 'Accept: application/octet-stream' \
          "https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/assets/$( \
          curl -sL "https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/tags/v0.1.2" \
          | jq '.assets[] | select(.name | contains("Linux_x86")) | .id')"
          tar -zxvf alert-menta_Linux_x86_64.tar.gz

      - run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" >> $GITHUB_ENV

      - name: Get user defined config file
        id: user_config
        if: hashFiles('.alert-menta.user.yaml') != ''
        run: |
          curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" -L -o .alert-menta.user.yaml "https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}/main/.alert-menta.user.yaml" && echo "CONFIG_FILE=./.alert-menta.user.yaml" >> $GITHUB_ENV

      - name: Extract command and intent
        id: extract_command
        run: |
          COMMENT_BODY="${{ github.event.comment.body }}"
          COMMAND=$(echo "$COMMENT_BODY" | sed -E 's|^/([^ ]*).*|\1|')
          echo "COMMAND=$COMMAND" >> $GITHUB_ENV
          
          if [[ "$COMMENT_BODY" == "/$COMMAND "* ]]; then
            INTENT=$(echo "$COMMENT_BODY" | sed -E "s|^/$COMMAND ||")
            echo "INTENT=$INTENT" >> $GITHUB_ENV
          fi
          
          COMMANDS_CHECK=$(yq e '.ai.commands[] | keys' .alert-menta.user.yaml | grep -c "$COMMAND" || echo "0")
          if [ "$COMMANDS_CHECK" -eq "0" ]; then
            echo "Invalid command: $COMMAND. Command not found in configuration."
            exit 1
          fi

      - name: Add Comment
        run: |
          if [ -n "$INTENT" ]; then
            ./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE -intent "$INTENT"
          else
            ./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE
          fi

If using Vertex AI

Configure Workload Identity Federation with reference to the documentation.

Local

In an environment where Golang can be executed, clone the repository and run it as follows:

go run ./cmd/main.go -repo <repository> -owner <owner> -issue <issue-number> -github-token $GITHUB_TOKEN -api-key $OPENAI_API_KEY -command <describe, etc.> -config <User_defined_config_file>

Contribution

We welcome you. Please submit pull requests to the develop branch. See Branch strategy for more information.

About

An innovative tool πŸš€ for real-time analysis and management of Issues' alerts. πŸ” It identifies alert causes, proposes actionable solutions πŸ’‘, and offers customizable filters πŸŽ›οΈ and detailed reports πŸ“ˆ. Designed for developers πŸ‘¨β€πŸ’», managers πŸ“‹, and IT teams πŸ’», AlertMenta enhances productivity and software quality. 🌟

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors