← Back to Pull requests

feat(logs): Kusto Functions Framework #7278

Open
unknown opened this pull request with 459 lines diff across 5 files
View on GitHub
unknown unknown commented on Sep 30, 2026 20:08 UTC
Author

https://redhat.atlassian.net/browse/ARO-30047

What

<!-- Briefly describe what this PR does -->

  • Add new file structure to scaffold out adding kusto functions to tables

  • Implement some POC functions

  • - get a ResourceID from a ClusterID
    - get a ClusterID from a ResourceID
  • Add integration test framework based on test-integration folder (tests as desired state)

  • Fixups on some bugs I found - kustoctl validation order of existing functions and removal of skipping validation on those critically important functions so we catch validation errors if they are introduced
  • Why

    <!-- Briefly explain why this change is needed -->
    Consistent log schemas and structure are critical to operational readiness and BU reporting. Providing a framework for these teams to communicate necessities in logs via integration testing allows us to establish a contract for what shouldn't change.

    The addition of functions in general also solves many many other issues:

    1. Our logs are incredible, but complex. Queries can easily go >100LOC; that's not simple to teach or learn - but writing a single function and executing it is. It also keeps tickets shorter (don't have to scroll past 100LOC of kql in an ICM). I'm sure there are other usability benefits too.
    2. Named functions are easier for human eyes to understand, which makes it easier for AI agents to understand as well.
    - Having human-verified KQL statements wrapped in a plaintext identifier (name) eliminates hallucinations that are omnipresent in the "just throw AI at Kusto" space (no hallucinated | where resourceId has "name" junk that can match multiple clusters).
    - When you give an AI clear inputs/outputs and also hints at what a function does via docstrings and folder organization, you get native discoverability and more precise results
    - It's cheaper - well-defined and validated KQL means AI don't need to discover their way through a full kusto schema each time you run a query.
    - Not having AI write its own KQL (rather, providing it output of a human-approved KQL statement) is in alignment with Microsoft recommendations for AI use.
    4. We can define KQL once for a standard query and reuse it in many ways - same KQL executes for AI agents, dashboards, ICM Automation, or direct human use in kusto - we have a single source of truth that's easily shared.

    Testing

    This PR introduces a new integration suite (based on the RP one) which validates the KQL we have by spinning up a local container, applying our expected tables and functions, then running a series of tests with sample data and expected results.

    While this PR introduces the concept of this test framework, it has no impact on CI (breaking the schema is still possible with green CI). Changing this would require a merge to Prow.

    Notes

    To review, I'd recommend this order (there's lots here):

    1. Check out a basic function definition in the functions folder
    2. Check out the README at the top-level of the suite - gives an overview of the test architecture as a whole.
    3. Look at manifest.json to see how the test suite maps all the Databases, tables, and functions it needs to test (what it puts in the emulator).
    4. Look at any sub-directory of artifacts to see what it takes to define a test (spoiler: it's just JSON and particularly named directories/files)
    5. Pull this PR local - run make test-integration-kusto to see the suite in action. If you'd like, ask Claude to write up a new function and implement a test to see the dev flow. Asking it to show you step-by-step what to do will be helpful too.
    6. Look through the rest as you like.

    Diff: 459 lines (+344 / -115) across 5 files Reviewer: hlipsig Review duration: 88034m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.53) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 459 lines diff across 5 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.367
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7278"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.5% (MEDIUM) · Higher = larger blast radius
    52.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29% · Safe to merge
    29%
    Repository