feat: [FME-19300]: add metric and event_type nouns, with owners/tags mutation - #250
Merged
Merged
Conversation
apetruccelli
force-pushed
the
FME-19300-metrics
branch
from
September 29, 2026 15:29
ef023e6 to
172f00a
Compare
Rebased onto main post-harness#257 merge: the fme:owners/fme:tags framework this built on top of already landed via harness#257's squash merge, so this carries only the metric/event_type-specific additions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Wire metric's tags/owners fields onto the existing fme:owners/fme:tags field types (no new Go code), widen update metric's update_body_pick to carry both collections, and add unit tests mirroring the feature_flag/segment coverage. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eate metric Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tric Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
apetruccelli
force-pushed
the
FME-19300-metrics
branch
from
September 30, 2026 16:51
eebf2fd to
10da2d9
Compare
puthrayaharness
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
metriclist/get, on the premise that create/update/delete don't exist in v4 yet. That premise is stale — v4 already exposes full CRUD (POST/GET /fme/api/v4/metrics,GET/PATCH/DELETE /fme/api/v4/metrics/{metric-id}), and the MCP server already ships all five operations forfme_metric.metricnoun, full CRUD:list,get,create,update,deleteagainst v4.{metric-id}), unlikefeature_flag/segmentwhich use name.nameandtrafficTypeare immutable;updaterejects both.create metricaccepts-f metric.jsonas a full alternative to--traffic-type/--event-type/--set; values already present in the file are not overridden.update metricaccepts-f patch.jsonas a full alternative to--set/--del; the file is sent as-is as the merge-patch document, with no GET orupdate_body_pickinvolved.event_typenoun, read-only:list,get— mirrors the existingtraffic_typelookup pattern. Needed becausebaseEventTypesis a required field oncreate metricand there is otherwise no way to discover a valid event type id from the CLI.tags/ownersare fully mutable, wired onto thefme:owners/fme:tagsfield types (--add/--del tags.<name>,--add/--del owners.user:<email|id>,--add/--del owners.group:<identifier>) — no new Go code, the handlers are noun-agnostic.update metric'supdate_body_pickcarries both collections so a mutation on one preserves the other.cap.*,filterEventType, andtriggerEventTypeare mutable via dotted--setfields (cap_metric_value,cap_base_event_count,cap_base_event_sum,cap_base_event_value,cap_filter_event_count,cap_filter_event_sum,cap_filter_event_value,cap_granularity,filter_event_type,filter_aggregation,trigger_event_type) — flat scalars against v4'sMetricCap/FilterEventType/TriggerEventTypeDTOs, no new Go code.trigger_event_typeis the wire representation of the product UI's "before event" filter dimension. The server applies genuine RFC 7396 recursive merge-patch, so setting onecap/filterEventTypesub-field via--setpreserves untouched siblings onupdate.--addon create,cap/filterEventType/triggerEventTypescalar--seton create and update, and-f-supplied create/update fields.Commands
harness list event_type [--name <substring>] [--traffic-type <id-or-name>]harness create metric <name> --traffic-type <type> --event-type <event-type-id> --set format=NUMBER --set aggregation=COUNT --set is_positive=true --add tags.<name> --add owners.user:<email>harness create metric <name> --traffic-type <type> --event-type <event-type-id> --set format=NUMBER --set aggregation=COUNT --set is_positive=true --set cap_metric_value=100 --set cap_granularity=DAYS --set filter_event_type=<event-type-id> --set filter_aggregation=COUNT --set trigger_event_type=<event-type-id>harness create metric <name> -f metric.json, wheremetric.jsonis:{"trafficType":"user","baseEventTypes":[{"eventTypeId":"signup"}],"format":"NUMBER","aggregation":"COUNT","isPositive":true,"cap":{"metricValueCap":100,"granularity":"DAYS"},"filterEventType":{"eventTypeId":"checkout","filterAggregation":"COUNT"},"triggerEventType":{"eventTypeId":"signed-up"}}harness list metric [--name <substring>] [--event-type-id <id>] [--tag <name>]harness get metric <metric-id>harness update metric <metric-id> --add owners.group:<identifier> --del owners.user:<id> --add tags.<name> --del tags.<name>harness update metric <metric-id> --set cap_metric_value=250 --set cap_base_event_count=10 --set trigger_event_type=<event-type-id>harness update metric <metric-id> -f patch.json, wherepatch.jsonis any subset of mutable fields, e.g.{"cap":{"metricValueCap":250}}harness delete metric <metric-id> --forceTesting
go build ./...andgo test ./pkg/...passname,traffic_type), hard-delete-then-404 behaviormetric: create with tags+owners in one call, add a GROUP owner and a tag, delete the original USER owner and the original tag, confirmed final state-f metric.jsononcreate metricand-f patch.jsononupdate metricagainst qa0, with no--traffic-type/--event-type/--set/--delon the command linecap/filterEventTypevia both--setand-foncreate metricandupdate metric, confirming the merge-patch preserves untouched sibling fields (e.g.cap.granularitysurvives acap.metricValueCap-only update)--setas strings (Jackson lenient coercion), so no CLI-side type coercion was needed🤖 Generated with Claude Code