Skip to content

feat(go.d): support managed metadata for payload-aware functions - #23940

Merged
ilyam8 merged 3 commits into
netdata:masterfrom
ilyam8:feat/functions-managed-info
Sep 17, 2026
Merged

ilyam8 merged 3 commits into
netdata:masterfrom
ilyam8:feat/functions-managed-info

Conversation

@ilyam8

@ilyam8 ilyam8 commented Sep 17, 2026

Copy link
Copy Markdown
Member
Summary

Add opt-in initial and job-scoped metadata handling, keeping job selection and response composition in the framework. Support history and accepted-input declarations while preserving existing structured Functions and SDK passthrough.

Test Plan
Additional Information
For users: How does this change affect me?

Summary by cubic

Adds opt-in framework-managed metadata for payload-aware Functions. Raw-input methods can now declare ManagedInfo: true to get framework-composed info responses with job selection and domain selectors, while existing structured and raw passthrough behavior is unchanged.

  • ManagedInfo and AcceptedParams require RawRequest; invalid declarations are rejected.
  • Info without a selected __job returns declaration metadata and available jobs without calling the handler.
  • Scoped info calls the handler with Info: true; the handler supplies domain selectors via RequiredParams.
  • Adds HasHistory and AcceptedParams declaration fields that advertise time-range and extra input support without implementing them.
  • RawResponse still bypasses managed serialization.
  • Group signature generation now includes the new fields, so published generations reflect metadata changes.

Written for commit 4b10aef. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added managed metadata for function information responses, including history support and accepted parameters.
    • Added job-scoped routing and metadata handling for shared functions.
    • Added documentation covering function declarations, request and response handling, selectors, and response schemas.
  • Bug Fixes

    • Improved validation and error handling for managed metadata and job selection.
  • Tests

    • Expanded coverage for information responses, routing, schemas, cancellation, reloads, and notifications.

@ilyam8
ilyam8 requested a review from Ancairon as a code owner September 17, 2026 19:11
@qodo-free-for-open-source-projects

This comment was marked as resolved.

@github-actions github-actions Bot added area/docs area/collectors Everything related to data collection collectors/go.d area/go labels Sep 17, 2026
@coderabbitai

This comment was marked as resolved.

@qodo-code-review

This comment was marked as resolved.

@qodo-code-review

This comment was marked as resolved.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files

Architecture diagram
sequenceDiagram
    participant UI as UI Client
    participant AM as Agent Manager
    participant JG as Job Generation
    participant MG as Method Generation
    participant H as Handler
    participant R as Raw Handler
    participant C as Collector

    Note over UI,C: Managed Metadata for Payload-Aware Functions

    UI->>AM: Function request (info)
    AM->>JG: Route to generation
    JG->>MG: handle(info request)

    MG->>MG: Parse args & payload
    
    alt Structured or raw without job selection
        MG->>MG: Return declaration metadata
        MG-->>UI: Info response (no handler call)
    else Raw with managed info and job selection
        MG->>MG: Resolve selected job
        MG->>R: HandleRaw with Info:true
        R-->>MG: RequiredParams + Help
        MG->>MG: Merge metadata & selectors
        MG-->>UI: Scoped info response
    end

    Note over UI,C: Data Request Flow

    UI->>AM: Function request (data + __job)
    AM->>JG: Route to generation
    JG->>MG: handle(data request)

    MG->>MG: Parse args & payload
    MG->>MG: Resolve target job
    
    alt Structured method
        MG->>H: MethodParams + Handle
        H-->>MG: FunctionResponse
    else Raw method
        MG->>R: HandleRaw (preserve payload)
        R-->>MG: FunctionResponse
    end

    alt Managed info requested
        MG->>MG: Include metadata only
    else Data response
        MG->>MG: Include columns & data
    end
    
    MG-->>UI: Composed response

    Note over MG,H: Validation and Failures
    
    alt Invalid declaration (ManagedInfo without RawRequest)
        MG-->>UI: 400 error
    else Unknown job or multiple jobs
        MG-->>UI: 4xx error
    else Job stopped during request
        MG-->>UI: 503 error
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/go/plugin/agent/jobmgr/functions/method_generation.go
@ilyam8
ilyam8 enabled auto-merge (squash) September 17, 2026 19:34
@ilyam8
ilyam8 merged commit 7b4bc65 into netdata:master Sep 17, 2026
148 of 149 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@ilyam8
ilyam8 deleted the feat/functions-managed-info branch September 17, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants