Skip to content

Comments

feat: add prometheus.getSilence ,prometheus.query and prometheus.queryRange action components#3229

Merged
forestileao merged 6 commits intosuperplanehq:mainfrom
samuel-asleep:2/2-prometheus
Feb 23, 2026
Merged

feat: add prometheus.getSilence ,prometheus.query and prometheus.queryRange action components#3229
forestileao merged 6 commits intosuperplanehq:mainfrom
samuel-asleep:2/2-prometheus

Conversation

@samuel-asleep
Copy link
Contributor

Adds three new action components to the Prometheus integration: getSilence, query, and queryRange.

Backend (pkg/integrations/prometheus/)

  • client.go: Extended AlertmanagerSilence with full Alertmanager v2 fields (Matchers, StartsAt, EndsAt, CreatedBy, Comment, UpdatedAt); added GetSilence(silenceID string) (GET /api/v2/silence/{id}) and QueryRange(query, start, end, step string) (GET /api/v1/query_range) methods
  • get_silence.go: Fetches a silence by ID, emits prometheus.silence payload, stores GetSilenceNodeMetadata{SilenceID}
  • query.go: Executes instant PromQL query, emits prometheus.query payload, stores QueryNodeMetadata{Query}
  • query_range.go: Executes range PromQL query (requires query, start, end, step), emits prometheus.queryRange payload, stores QueryRangeNodeMetadata{Query}
  • prometheus.go: Registered all three components in Components()
  • example.go: Embedded example output JSON for all three; added ExampleOutput() methods

Frontend (web_src/src/pages/workflowv2/mappers/prometheus/)

  • get_silence.ts: Canvas metadata shows silence ID (bell-off); execution details show status, matchers, start/end, creator, comment
  • query.ts / query_range.ts: Canvas metadata shows PromQL expression (search); execution details show query params, result type, and result count
  • types.ts: Added typed interfaces for all three components' configuration, node metadata, and payload
  • index.ts: Registered new mappers and event state entries (retrieved / queried)

closes #3083

video

2026-02-23.16-22-20.mp4

Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
@samuel-asleep
Copy link
Contributor Author

@AleksandarCole @forestileao the final part of the components

@forestileao forestileao self-assigned this Feb 23, 2026
@forestileao forestileao self-requested a review February 23, 2026 15:50
…zation

Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
@samuel-asleep
Copy link
Contributor Author

@forestileao Refactored GetSilence.Execute() to remove manual map[string]any building (including the custom matchers loop) and replaced it with a typed getSilencePayload + mapstructure.Decode, consistent with our existing decoding pattern.

  • Added mapstructure tags to Matcher in client.go to preserve camelCase keys.
  • Introduced getSilencePayload in get_silence.go and decode it into map[string]any with proper error handling.

Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
@forestileao forestileao added bounty This issue has a bounty open pr:stage-3/3 Ready for full, in-depth, review labels Feb 23, 2026
@forestileao
Copy link
Collaborator

@samuel-asleep I applied some minor fixes:

  • Show begin and End ranges on component ui
  • Updated Silence property to be ResourceList like ExpireSilence

@forestileao
Copy link
Collaborator

image

@forestileao forestileao merged commit ff63e20 into superplanehq:main Feb 23, 2026
3 checks passed
@samuel-asleep samuel-asleep deleted the 2/2-prometheus branch February 23, 2026 21:32
@forestileao
Copy link
Collaborator

@samuel-asleep Thanks for the contribution. Feel free to claim your bounty.

cc: @AleksandarCole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty This issue has a bounty open pr:stage-3/3 Ready for full, in-depth, review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Prometheus] Expand Integration

2 participants