Skip to content

Simplify stats to basic counters + SMF Type 243 #54

@mgrossmann

Description

@mgrossmann

Summary

Replace the 4-tier time-series statistics (~16 KB RAM, ~1,000 LOC across httpstat.c and httprepo.c) with:

  1. SMF Type 243 records per HTTP request via crent370's smf_init() + smf_write() API
  2. Simple in-memory counters in the HTTPD struct for operator display (/F HTTPD,STATS)

Current State (to be removed)

File LOC Description
httpstat.c 509 4-tier time-series (month/day/hour/min), HTTPSTAT records, dataset load/save
httprepo.c 419 Apache Combined Log Format formatter + httpstat_add()

HTTPD struct fields to remove: st_month, st_day, st_hour, st_min, st_dataset, cfg_st_*_max, FILE *stats

New Design

SMF Type 243 Record (httpsmf.c, ~50 LOC)

#define SMF_TYPE_HTTPD     243
#define SMF_HTTPD_REQUEST  1

struct smf_httpd_request {
    SMF_HEADER      hdr;            /* 18 Bytes Standard SMF Header */
    char            ssi[4];         /* "HTTP"                       */
    short           subtype;        /* 1 = Request completed        */
    char            userid[8];      /* RACF User (blank if none)    */
    unsigned int    client_addr;    /* Client IPv4                  */
    short           resp_code;      /* HTTP Status Code             */
    unsigned int    bytes_sent;     /* Response Bytes               */
    unsigned int    duration_us;    /* Request duration microseconds*/
    char            method[8];      /* GET/POST/PUT/DELETE          */
    char            uri[64];        /* Request URI (truncated)      */
};

In-Memory Counters

unsigned    total_requests;
unsigned    total_errors;
unsigned    total_bytes_sent;
unsigned    active_connections;

/F HTTPD,STATS displays these via WTO — no dataset I/O.

Implementation Steps

  1. Delete httpstat.c — remove HTTPSTAT arrays/fields from HTTPD struct, remove httpstat_load()/httpstat_save() calls, replace httpstat_report() with counter display, remove stats parmlib keywords
  2. Delete httprepo.c, create httpsmf.c — SMF record + counter increment + state transition
  3. Add counters to HTTPD struct — replace old st_* fields

No access log in 4.0.0 — can be added as optional feature later.

Dependencies

  • crent370 SMF API (smf_init() + smf_write()) must be implemented first
  • SMF must be activated in SYS1.PARMLIB(SMFPRMxx): SYS(TYPE(243))

Acceptance Criteria

  • httpstat.c deleted
  • httprepo.c deleted, replaced by httpsmf.c
  • No HTTPSTAT arrays in HTTPD struct (~16KB RAM freed)
  • No dataset load/save at start/shutdown
  • No access log (FILE *stats removed)
  • SMF Type 243 records visible in SYS1.MANX after HTTP requests
  • /F HTTPD,STATS shows simple counters (requests, errors, bytes, connections)
  • Existing functionality (curl, Zowe, mvsMF) not affected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions