Closed AlNotSteve closed 8 months ago
This classification is calculated in the UI, but I am planning (in due course) to move part of this calculation to the server side (see classification below). The picture you show is further aggregated and makes a distinction between moving and not moving (speed < .5 kts). We can push the below class to Prometheus if useful?
const ShippingClass = {
OTHER: 0,
UNKNOWN: 1,
CARGO: 2,
B: 3,
PASSENGER: 4,
SPECIAL: 5,
TANKER: 6,
HIGHSPEED: 7,
FISHING: 8,
PLANE: 9,
HELICOPTER: 10,
STATION: 11,
ATON: 12,
SARTEPIRB: 13,
};
Hi Jasper,
That'll be awesome to also have moving and non-moving in Prometheus metrics.
Hope you have a good new year!
Sent from my Galaxy
-------- Original message -------- From: Jasper @.> Date: 31/12/23 06:18 (GMT+10:00) To: jvde-github/AIS-catcher @.> Cc: Alan Johnson @.>, Author @.> Subject: Re: [jvde-github/AIS-catcher] Feature Request - Current counts of vessels, SAR, Base stations etc. published for Prometheus consumption (Issue #214)
This classification is calculated in the UI, but I am planning (in due course) to move part of this calculation to the server side. The picture you show is further aggregated and makes a distinction between moving and not moving (speed < .5 kts). We can push this to Prometheus if useful?
const ShippingClass = {
OTHER: 0,
UNKNOWN: 1,
CARGO: 2,
B: 3,
PASSENGER: 4,
SPECIAL: 5,
TANKER: 6,
HIGHSPEED: 7,
FISHING: 8,
PLANE: 9,
HELICOPTER: 10,
STATION: 11,
ATON: 12,
SARTEPIRB: 13,
};
— Reply to this email directly, view it on GitHubhttps://github.com/jvde-github/AIS-catcher/issues/214#issuecomment-1872598022, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH5TB4UIRKXIES5GMENBE2DYMBZIFAVCNFSM6AAAAABBGLKOP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGU4TQMBSGI. You are receiving this because you authored the thread.Message ID: @.***>
I have added something, but cannot fully test it. The metrics output now includes moving and stationary ships:
# HELP ais_stat_ship_moving Total number of ships moving
# TYPE ais_stat_ship_moving counter
ais_stat_ship_moving 0
# HELP ais_stat_ship_stationary Total number of ships stationary
# TYPE ais_stat_ship_stationary counter
ais_stat_ship_stationary 2
and a counter per ship class:
# HELP ais_stat_count_shipclass_0 Total number of messages of shipclass 0
# TYPE ais_stat_count_shipclass_0 counter
ais_stat_count_shipclass_0 0
# HELP ais_stat_count_shipclass_1 Total number of messages of shipclass 1
# TYPE ais_stat_count_shipclass_1 counter
ais_stat_count_shipclass_1 2
Etc.
This uses the following classification:
CLASS_OTHER = 0,
CLASS_UNKNOWN = 1,
CLASS_CARGO = 2,
CLASS_B = 3,
CLASS_PASSENGER = 4,
CLASS_SPECIAL = 5,
CLASS_TANKER = 6,
CLASS_HIGHSPEED = 7,
CLASS_FISHING = 8,
CLASS_PLANE = 9,
CLASS_HELICOPTER = 10,
CLASS_STATION = 11,
CLASS_ATON = 12,
CLASS_SARTEPIRB = 13
Please have a look and see if this works. It contains all the information you were looking for.
Hi Jasper,
That's exactly what I was looking for!
Nice work.
I see you've updated your release branch. Will update today and let you know how it goes!
I'll be happy to share my Grafana dashboard with you for the community when I'm done.
Sent from my Galaxy
-------- Original message -------- From: Jasper @.> Date: 1/1/24 06:26 (GMT+10:00) To: jvde-github/AIS-catcher @.> Cc: Alan Johnson @.>, Author @.> Subject: Re: [jvde-github/AIS-catcher] Feature Request - Current counts of vessels, SAR, Base stations etc. published for Prometheus consumption (Issue #214)
I have added something, but cannot fully test it. The metrics output now includes moving and stationary ships:
ais_stat_ship_moving 0
ais_stat_ship_stationary 2
and a counter per ship class:
ais_stat_count_shipclass_0 0
ais_stat_count_shipclass_1 2
Etc.
This uses the following classification:
CLASS_OTHER = 0,
CLASS_UNKNOWN = 1,
CLASS_CARGO = 2,
CLASS_B = 3,
CLASS_PASSENGER = 4,
CLASS_SPECIAL = 5,
CLASS_TANKER = 6,
CLASS_HIGHSPEED = 7,
CLASS_FISHING = 8,
CLASS_PLANE = 9,
CLASS_HELICOPTER = 10,
CLASS_STATION = 11,
CLASS_ATON = 12,
CLASS_SARTEPIRB = 13
Please have a look and see if this works. It contains all the information you were looking for.
— Reply to this email directly, view it on GitHubhttps://github.com/jvde-github/AIS-catcher/issues/214#issuecomment-1873032776, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH5TB4T5MHHAYOINXQRAN6LYMHDABAVCNFSM6AAAAABBGLKOP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGAZTENZXGY. You are receiving this because you authored the thread.Message ID: @.***>
Just installed and ran a quick test. Doesn't appear to be doing what's intended.
I've attached 2 screenshots - one is the output from /metrics and the other from the UI. Totals don't line up.
Took a few samples in this screenshot. Looks like it's continuously adding up.
It should be monotonically increasing as it is a counter, but your right it there is a subtle difference with the table and you cannot approximately reproduce the table from this.
Let me try to be more clear on what the output is.
What is on the screen is the number of vessels (which is essentially all MMSIs that have been sending in the last 30 minutes). Prometheus input (/metrics) counts the number of messages of a particular ship class type we have heard at the last pull (over the lifetime).
If there is just one vessel, a "passenger ship", broadcasting every minute. Then the UI table would show 1 as it is the vessel count at that point in time on screen. The counter and Grafana will show that we receive 1 msg per minute from the class "passenger ship".
Maybe we need to pivot.
I think you can calculate in PROMQL the number of MMSIs picked up in the last 2 minutes with (note the UI shows for 30m by default):
count(sum(count_over_time(ais_msg_ppm[2m])) by (mmsi))
I have just added speed and shipclass to the ais_msg_ppm gauge, this should allow us to show the number of ships we heard from in the last 2 minutes per shipclass:
count(sum(count_over_time(ais_msg_ppm[2m])) by (mmsi,shipclass)) by (shipclass)
or per speed:
count(sum(count_over_time(ais_msg_ppm[2m])) by (mmsi,speed)) by (speed)
and combined:
count(sum(count_over_time(ais_msg_ppm[2m])) by (mmsi,speed,shipclass)) by (speed,shipclass)
Does this help?
Btw, this is not 100% aligned either as the shipclass and speed can change over time when we pick up more information on the vessel. Not sure how to best solve this without too much work.
Hi Jasper,
Thanks for the advice and info.
I've had a fiddle in Grafana and came up with figures closely matching the UI.
I removed the other code with the counters (saves some cpu cycles). The small double count in case a shipclass or speed label changes still annoys me but has to wait until another time.
This is merely a feature request to make counts of sender type available to Prometheus.
This info is available in the UI and would be useful to consume via Prometheus into Grafana.