You've already forked tribes-plugin-supertest
forked from tribes/tribes-plugin-template
982243e64a
Refresh the plugin Mix dependency FOD hash for the current host source. Align the probe telemetry event and VictoriaMetrics query with the metric actually exported by the host telemetry reporter.
83 lines
2.2 KiB
Elixir
83 lines
2.2 KiB
Elixir
defmodule TribeOne.TribesPlugin.Supertest.Plugin do
|
|
@moduledoc """
|
|
Tribes plugin entry point for the supertest fixture.
|
|
"""
|
|
|
|
use Tribes.Plugin.Base, otp_app: :tribe_one_supertest
|
|
|
|
@impl true
|
|
def register(context) do
|
|
super(context)
|
|
|> Map.merge(%{
|
|
nav_items: [
|
|
%{
|
|
label: "Supertest",
|
|
path: "/supertest",
|
|
icon: nil,
|
|
requires: [],
|
|
order: 90
|
|
}
|
|
],
|
|
pages: [
|
|
%{
|
|
path: "/supertest",
|
|
live_view: TribeOne.TribesPlugin.SupertestWeb.HomeLive,
|
|
layout: nil
|
|
}
|
|
],
|
|
api_routes: [
|
|
{"/", TribeOne.TribesPlugin.SupertestWeb.APIPlug}
|
|
],
|
|
management_methods: [
|
|
%{
|
|
name: "supertest.echo",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Supertest.API,
|
|
action: :management_echo,
|
|
auth: :admin,
|
|
description: "Echo plugin management context"
|
|
}
|
|
],
|
|
metrics: [
|
|
%{
|
|
name: "probe_value",
|
|
stat: "last",
|
|
query: "last_over_time(plugins_tribeonesupertest_probe_value[60s])",
|
|
description: "Supertest plugin metrics probe value",
|
|
event_name: [:supertest, :metrics, :probe],
|
|
measurement: :value,
|
|
max_series: 1
|
|
}
|
|
],
|
|
scheduler_crons: [
|
|
%{
|
|
id: "scheduler.singleton_counter",
|
|
schedule: "* * * * *",
|
|
worker: TribeOne.TribesPlugin.Supertest.Scheduler.SingletonCounterWorker,
|
|
mode: :singleton,
|
|
placement_strategy: :sticky_singleton,
|
|
max_attempts: 3,
|
|
lease_seconds: 60
|
|
},
|
|
%{
|
|
id: "scheduler.all_nodes_counter",
|
|
schedule: "* * * * *",
|
|
worker: TribeOne.TribesPlugin.Supertest.Scheduler.AllNodesCounterWorker,
|
|
mode: :all_nodes,
|
|
placement_strategy: :balanced_singleton,
|
|
max_attempts: 3,
|
|
lease_seconds: 60
|
|
}
|
|
],
|
|
children: cluster_pubsub_children(context)
|
|
})
|
|
end
|
|
|
|
defp cluster_pubsub_children(context) do
|
|
case Map.get(context, :cluster_pubsub) do
|
|
nil -> []
|
|
pubsub -> [{TribeOne.TribesPlugin.Supertest.ClusterPubSubProbe, pubsub: pubsub}]
|
|
end
|
|
end
|
|
end
|