Get the total amount of messages published on a vhost in RabbitMQ - rabbitmq

Is it possible to get the total amount of messages published to a vhost in RabbitMQ (during the last minute or something like that)? I have checked the RabbitMQ Management HTTP Stats documentation but it seems to work only for a specific object, such as queues/exchanges/channels.

In 3.6.10 I can see that http://localhost:15672/api/vhosts and http://localhost:15672/api/vhosts/${vhost} (e.g. %2F for /) do have:
message_stats: {
publish: 632,
publish_details: {
rate: 0
},
confirm: 0,
confirm_details: {
rate: 0
},
return_unroutable: 0,
return_unroutable_details: {
rate: 0
},
get: 0,
get_details: {
rate: 0
},
get_no_ack: 0,
get_no_ack_details: {
rate: 0
},
deliver: 998,
deliver_details: {
rate: 0
},
deliver_no_ack: 20,
deliver_no_ack_details: {
rate: 0
},
redeliver: 522,
redeliver_details: {
rate: 0
},
ack: 466,
ack_details: {
rate: 0
},
deliver_get: 1018,
deliver_get_details: {
rate: 0
}
}

Related

Mouseevent handler is not working in the vue-mapbox package

I am trying to make my map zoom in to a cluster when the user clicks the cluster. The map is built with mapbox gl and Vue-Mapbox. I understand I can use the getClusterExpansionZoom() method to do so, but the first step is detecting which cluster the user clicked on. My #click handler does not detect clicks. Why not? What must I change? Cheers
<template>
<div>
<MglMap>
<MglGeojsonLayer
class="mgl-clusters-layer"
layerId="clustersLayerId"
:layer="clustersLayer"
:source="clustersSource"
sourceId="clustersSourceId"
#click="clickedCluster()"
/>
</div>
</template>
These variations also do not work...
#click="clickedCluster"
#map-click="clickedCluster()"
#click.prevent="clickedCluster"
Here is my event handler...
methods: {
clickedCluster() {
console.log("clicked cluster");
}
}
Here is the definition of the clustersSource object
clustersSource: {
type: "geojson",
cluster: true,
clusterRadius: 25,
clusterProperties: { sum: ["+", ["get", "docCount"]] },
data: {
type: "FeatureCollection",
features: []
}
},
data.features array of simple geojson points
Here is the definition of clustersLayer...
clustersLayer: {
id: util.getRandomValue(),
type: "circle",
filter: ["has", "point_count"],
paint: {
"circle-color": "#6a0dad",
"circle-opacity": 0.4,
"circle-stroke-color": "#6a0dad",
"circle-stroke-width": 1,
"circle-radius": [
"step",
["get", "sum"],
8,
100,
10,
1000,
12,
10000,
14,
100000,
16,
1000000,
18
]
}
},
This works...
//Make map zoom to a districts cluster when user clicks the cluster
this.map.on("click", "clustersLayerId", function(e) {
var features = $this.map.queryRenderedFeatures(e.point, {
layers: ["clustersLayerId"]
});
$this.map.easeTo({
center: features[0].geometry.coordinates,
zoom: $this.map.getZoom() + 1
});
});
You also have to specify the id in the clustersLayer object...
clustersLayer: {
id: "clustersLayerId",
type: "circle",
filter: ["has", "point_count"],
paint: {
"circle-color": "#6a0dad",
"circle-opacity": 0.4,
"circle-stroke-color": "#6a0dad",
"circle-stroke-width": 1,
"circle-radius": [
"step",
["get", "sum"],
8,
100,
10,
1000,
12,
10000,
14,
100000,
16,
1000000,
18
]
}
},

Webpack 4 SplitChunkPlugin's maxSize vs maxInitialRequests

When setting maxSize to 100000 for example, I get more initial chunks than the value of maxInitialRequests. I get 7 (bootstrap, main + 5 vendor chunks) where as my maxInitialRequests is set to 3. My expectation is that total initial chunks should be capped at 3. Am I missing something here?
Here is my optimization configuration:
{
name: false,
chunks: 'all',
minChunks: 1,
minSize: 0,
maxSize: 10000,
maxInitialRequests: 3,
maxAsyncRequests: 5,
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'all',
test: /node_modules/,
priority: 1
},
common: {
name: 'common',
chunks: 'all',
minChunks: 2,
reuseExistingChunk: false,
priority: 2
},
default: false
}
}
According to the webpack docs
maxSize takes higher priority than maxInitialRequest/maxAsyncRequests.
Actual priority is maxInitialRequest/maxAsyncRequests < maxSize <
minSize.

Using Custom Sort with Track Scores set to True is still showing score as null

So I'm setting a default query in my React Native app. Essentially I'm trying to set a sortOrder based on the elementOrder values. My partner used this same piece of code in his web app and it works for him. It doesn't seem to work on my end. The score exists if I remove the custom sort, which is normal due to what I've read in the docs. When I'm using a custom sort, then I should add track_scores: true. My score is still coming up as null.
I am not sure how to debug this situation. Can someone point me in the right direction? Thanks! Here's my code and let me know if you need to see anything. Unfortunately I don't have access to Kibana. I'm just console logging the list item and it's properties.
const defaultQueryConfig = {
track_scores: true,
sort: {
_script: {
type: 'number',
script: {
lang: 'painless',
source: `
int sortOrder = 0;
if (doc['elementOrder'].value == 1) {sortOrder = 3}
else if (doc['elementOrder'].value == 3) {sortOrder = 2}
else if (doc['elementOrder'].value == 2) {sortOrder = 1}
sortOrder;
`,
},
order: 'desc',
},
},
query: {
function_score: {
query: {
match_all: {},
},
functions: [
{
filter: {
match: {
categoryType: 'earth',
},
},
weight: 100,
},
{
filter: {
match: {
categoryType: 'water',
},
},
weight: 90,
},
{
filter: {
match: {
categoryType: 'fire',
},
},
weight: 80,
},
{
filter: {
match: {
thingExists: false,
},
},
weight: 2,
},
],
score_mode: 'multiply',
},
},
};

On-click event display data on heap map in highcharts

This image contains details about the number of projects was uploaded by the particular user
I am using heapmap highchart to display project details of a user.
on Y-axis => represents week of the days which ranges from 0 to 6
eg. Mon = 0, Tue= 1,....Sun=6
on X-axis => represents months, which ranges from 0 to 11
eg. Jan = 0, Feb = 1, ... Dec = 11
Data format
X Y Data
[0 ,1 , 3]
Suppose, 3 projects was uploaded by a user on monday in the month of January.
When I click on that 3 on heap map then it should display a pop box,
which should include project name,date and time
eg. Project Name : image recognition
Date : Uploaded on Jan 4,2019
Time : 10:04:00
In this I have hardcoded the data.
https://jsfiddle.net/k9hyfjmL/
This code retrieve data from mysql database and populates on heap map, which indicates number of projects was uploaded by a user.
$(document).on('click', '.click_once', function()
{
$.ajax(
{
url: '/profile/heap_map_data',
type: 'GET',
success: function(response)
{
var chart_data = [];
var skip_1st_data = 1;
var take_Data_upto = 0;
for (var i = 0, len = response.length; i < len; i++)
{ if(skip_1st_data == 1)
{
skip_1st_data = 2;
}
else{
take_Data_upto = take_Data_upto + 1;
chart_data.push(response[i]);
if(take_Data_upto == 31)
{
break;
}
}
}
console.log(chart_data)
Highcharts.chart('heap_map_chart',
{
chart:
{
type: 'heatmap',
marginTop: 40,
marginBottom: 80,
plotBorderWidth: 1,
},
title:
{
text: 'Project Details'
},
xAxis:
{
categories: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
},
yAxis:
{
categories: ['Mon','Tue','Wed','Thur','Fri','Sat','Sun'],
title: null
},
colorAxis:
{
min: 0,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
legend:
{
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 280
},
tooltip:
{
formatter: function ()
{
return + this.point.value + ' <b> project was uploaded on ' + this.series.xAxis.categories[this.point.x] + ' date, 2019' + '<br /> click to view more' ;
}
},
series: [
{
borderWidth: 1,
data: chart_data,
dataLabels:
{
enabled: true,
color: '#000000'
}
}]
});
},
error : function(jqXHR, textStatus, errorThrown)
{
console.log('jqXHR:');
console.log(jqXHR);
console.log('textStatus:');
console.log(textStatus);
console.log('errorThrown:');
console.log(errorThrown);
alert(errorThrown);
}
});
});
You can use point.events.click function to display some more information in another HTML element:
series: [{
point: {
events: {
click: function() {
document.getElementById('moreInfo').innerText =
'value: ' + this.value;
}
}
},
...
}]
Live demo: https://jsfiddle.net/BlackLabel/p261zg9d/
API Reference: https://api.highcharts.com/highcharts/series.heatmap.point.events.click

Openflow Swicth not pushing MPLS tag. (OpenDayLight)

I have the following linear SDN architecture with an ODL controller:
Host1 -- ZodiacFX1 -- ZodiacFX2 --- Host2
I am using 2 laptops as hosts and 2 ZodiacFX openflow switches.
I Want the ZodiacFX1 to push a MPLS tag to all the IP packets received from Host1 and the ZodiacFX2 to pop the MPLS tag and send the IP packets to the Host2.
I have added a flow for the MPLS push on the ZodiacFX1 and I can see the flow active in the ZodiacFX1 and also in the operational datastore of ODL. But if I ping h1->h2 there is no push.
The flow is this:
NOTE:(Host1 is conected to port 1 of ZodiacFX1 and ZodiacFX1 port2 is conected to ZodiacFX2 port1.)
GET http://192.168.21.147:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:123917682137538/table/2
{
"flow-node-inventory:table": [
{
"id": 2,
"opendaylight-flow-table-statistics:flow-table-statistics": {
"active-flows": 1,
"packets-looked-up": 0,
"packets-matched": 0
},
"flow": [
{
"id": "125",
"idle-timeout": 0,
"cookie": 401,
"flags": "",
"hard-timeout": 0,
"instructions": {
"instruction": [
{
"order": 0,
"apply-actions": {
"action": [
{
"order": 2,
"output-action": {
"output-node-connector": "2",
"max-length": 0
}
},
{
"order": 1,
"set-field": {
"protocol-match-fields": {
"mpls-label": 27
}
}
},
{
"order": 0,
"push-mpls-action": {
"ethernet-type": 34887
}
}
]
}
}
]
},
"cookie_mask": 0,
"opendaylight-flow-statistics:flow-statistics": {
"duration": {
"nanosecond": 0,
"second": 7
},
"byte-count": 0,
"packet-count": 0
},
"priority": 0,
"table_id": 2,
"match": {
"in-port": "1",
"ethernet-match": {
"ethernet-type": {
"type": 2048
}
}
}
},
{
"id": "124",
"idle-timeout": 0,
"cookie": 401,
"flags": "",
"hard-timeout": 0,
"instructions": {
"instruction": [
{
"order": 0,
"apply-actions": {
"action": [
{
"order": 2,
"output-action": {
"output-node-connector": "2",
"max-length": 0
}
},
{
"order": 1,
"set-field": {
"protocol-match-fields": {
"mpls-label": 27
}
}
},
{
"order": 0,
"push-mpls-action": {
"ethernet-type": 34887
}
}
]
}
}
]
},
"cookie_mask": 0,
"opendaylight-flow-statistics:flow-statistics": {
"duration": {
"nanosecond": 0,
"second": 180
},
"byte-count": 0,
"packet-count": 0
},
"priority": 8,
"table_id": 2,
"match": {
"in-port": "1",
"ethernet-match": {
"ethernet-type": {
"type": 2048
}
}
}
}
]
}
]
}
And I can see too in Zodiac console interface:
Flow 6
Match:
In Port: 1
ETH Type: IPv4
Attributes:
Table ID: 2 Cookie:0x191
Priority: 8 Duration: 247 secs
Hard Timeout: 0 secs Idle Timeout: 0 secs
Byte Count: 0 Packet Count: 0
Last Match: 00:04:07
Instructions:
Apply Actions:
Push MPLS tag
Set MPLS Label: 27
Output Port: 2
What can be the problem? I think that the main problem is that in this case Zodiac is following this flow, I have tried my flow with priority 0 too and there is no MPLS push.
Flow 5
Match:
In Port: 1
Attributes:
Table ID: 0 Cookie:0x2b00000000000008
Priority: 2 Duration: 2845 secs
Hard Timeout: 0 secs Idle Timeout: 0 secs
Byte Count: 576265 Packet Count: 5246
Last Match: 00:00:00
Instructions:
Apply Actions:
Output Port: 3
Output Port: 2
Output: CONTROLLER
it looks like you have some other application (maybe it's l2switch) pushing
flows to your switches as well. Maybe just install openflowplugin and try.
also, try putting your mpls flows in table 0 instead of table 2.