adding metric pattern in cloudwatch dashboard json - amazon-cloudwatch

so I have created custom dashboard in AWS cloudwatch using json
{
"height": 6,
"width": 6,
"y": 54,
"x": 0,
"type": "metric",
"properties": {
"view": "timeSeries",
"stacked": false,
"metrics": [
[ "service-es-dashboard","fact-bulk-loader","service", "es-dashboard" ]
],
"region": "us-east-1",
"title": "ES-documents-count"
}
}
and my metric array has different metric names like fact-bulk-loader-1, fact-bulk-loader-2
now i want to add all the metric name present in the metric array in my widget in dashboard how do i do that ?
i can add a metric name and see but i want the process to be dynamic as every week new metrics gets added into the mertic array

You can use a search expression.
The metrics part would look something like this:
"metrics": [
[ { "expression": "SEARCH('{service-es-dashboard,service} service=\"es-dashboard\" MetricName=\"fact-bulk-loader', 'Average', 300)", "id": "e2", "period": 300 } ]
]

Related

Adobe Analytics - how to get report API 2.0 to get multi-level breakdown data using Java

I need help in getting adobe-analytics data when multiple IDs are passed for multi-level breakdown using API 2.0.
I am getting first level data for V124 ----
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/event113",
"sort": "desc"
}
]
},
"dimension": "variables/evar124",
but i want to use IDs returned in above call response to in second level breakdown of v124 to get v125 as---
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/event113",
"sort": "desc",
"filters": [
"0"
]
}
],
"metricFilters": [
{
"id": "0",
"type": "breakdown",
"dimension": "variables/evar124",
"itemId": "2629267831"
},
{
"id": "1",
"type": "breakdown",
"dimension": "variables/evar124",
"itemId": "2629267832"
}
]
},
"dimension": "variables/evar125",
This always returns data only for 2629267831 ID and not 2629267832.
I want to get data for thousands of IDs (returned from first API call) in a single API call. What am i doing wrong?

Prebid - Index video outstream configuration with multiple playerSize in bidders

I would like to create an adUnit video outstream with multiple playserSizes for Index (documentation there
At first I thought to put the playerSize at the adUnit level, but because I want to define multiple playerSizes, I decided to move it at bidder level in params > video > playerSize. Nonetheless it does not work whereas in the documentation it is written
If you are using Index’s outstream player and have placed the video object at the bidder level, you must include the Index required parameters at the bidder level``` (link above)
Here is my prebid configuration
```javascript
{
"code": slotCode,
"sizes": [[1,1],[300,250],[160,600],[300,600],[640,360]],
"bids": [
{
"bidder": "criteo",
"params": {
"networkId": networkId,
"video": {
"playerSize": [640, 480],
"skip": 0,
"playbackmethod": 1,
"placement": 1,
"mimes": [
"video/mp4"
],
"maxduration": 30,
"api": [
1,
2
],
"protocols": [
2,
3
]
}
},
"userId": {...},
"userIdAsEids": [...],
"crumbs": {...}
},
{
"bidder": "index",
"params": {
"siteId": siteId,
"size": [
640,
360
],
"video": {
"playerSize": [640, 480],
"h": 640,
"w": 360,
"protocols": [
2,
3,
5,
6
],
"minduration": 5,
"maxduration": 30,
"mimes": [
"video/mp4",
"application/javascript"
],
"playerSize": [
640,
360
]
}
},
"userId": {... },
"userIdAsEids": [...],
"crumbs": {...}
}
],
"mediaTypes": {
"video": {
"context": "outstream"
}
},
"pubstack": {...}
}
If I use this configuration, I got this error
ERROR: IX Bid Adapter: bid size is not included in ad unit sizes or player size.
Even if my playerSize for index ([640, 360]) is in the adUnit sizes.
I wonder if it is possible for an adUnit to have multiple payerSizes?

Ramda - How to sort array with nested object with string to number conversion

I am trying to sort the array which looks like this:
const testArray = [
{
"id": "1",
"nodeLayout": {
"x": "12.0",
"y": "1.0",
"width": 200,
"height": 87
}
},
{
"id": "2",
"nodeLayout": {
"x": "1.0",
"y": "1.0",
"width": 200,
"height": 87
}
},
{
"id": "3",
"nodeLayout": {
"x": "0.0",
"y": "1.0",
"width": 200,
"height": 87
}
}
]
I was trying to sort it with this:
R.pipe(
R.pluck('nodeLayout'),
R.map(R.pipe(R.props(['x']), R.join(','))),
R.sortWith([R.ascend(parseFloat)])
)(testArray)
Which is working fine but I am getting only x values sorted and I am not able to fit this sort into this one:
R.pipe(
R.filter(
R.allPass([
R.pathEq(['nodeLayout', 'y'], '1.0'),
R.propEq('group', 4)
]
))
// I tried to add it here: R.sortBy(R.path(['nodeLayout', 'x'])) but I need to parse string first and I have no idea how to combine those
)(testArray)
To sum up, I am trying to get the whole object with all properties sorted.
Any help would be appreciated. Thank you
If you combine your two approaches, you should be able to achieve what you're wanting.
The main thing being that you can R.pipe the call to parseFloat after obtaining the value you'd like to sort with R.path. This piped function can be provided as the argument to R.sortBy.
R.pipe(
R.filter(
R.allPass([
R.pathEq(['nodeLayout', 'y'], '1.0'),
R.propEq('group', 4)
]
)),
R.sortBy(R.pipe(R.path(['nodeLayout', 'x']), parseFloat))
)(testArray)

Duplicate elements in AWS cloudwatch Embedded metrics

I am trying to log my service request.
First I try to get the service from my partner, upon failure I
try the same from my vendor, hence I need to add the same metrics under two different dimensions.
Following is my log structure, apparently, this is wrong as JSON does not support duplicate elements,
and AWS picks only the latest value in case of duplicates elements.
Kindly suggest the right way of doing this.
{
"_aws": {
"Timestamp": 1574109732004,
"CloudWatchMetrics": [{
"Namespace": "NameSpace1",
"Dimensions": [["Partner"]],
"Metrics": [{
"Name": "requestCount",
"Unit": "Count"
}, {
"Name": "requestFailure",
"Unit": "Count"
}, {
"Name": "responseTime",
"Unit": "Milliseconds"
}]
},
{
"Namespace": "NameSpace1",
"Dimensions": [["vendor"]],
"Metrics": [{
"Name": "requestCount",
"Unit": "Count"
}, {
"Name": "requestSuccess",
"Unit": "Count"
}, {
"Name": "responseTime",
"Unit": "Milliseconds"
}]
}]
},
"Partner": "partnerName",
"requestCount": 1,
"requestFailure": 1,
"responseTime": 1,
"vendor": "vendorName",
"requestCount": 2,
"requestSuccess": 2,
"responseTime": 2,
}
This will give you metrics separated by partner and vendor:
{
"Partner": "partnerName",
"vendor": "vendorName",
"_aws": {
"Timestamp": 1577179437354,
"CloudWatchMetrics": [
{
"Dimensions": [
[
"Partner"
],
[
"vendor"
]
],
"Metrics": [
{
"Name": "requestCount",
"Unit": "Count"
},
{
"Name": "requestFailure",
"Unit": "Count"
},
{
"Name": "requestSuccess",
"Unit": "Count"
},
{
"Name": "responseTime",
"Unit": "Milliseconds"
}
],
"Namespace": "NameSpace1"
}
]
},
"requestCount": 1,
"requestFailure": 1,
"requestSuccess": 1,
"responseTime": 2
}
Note that this will duplicate the metrics between the two dimensions (if partner registers failure it will be registered on the vendor failure metric also). If you need to avoid this, you can either:
have metric names specific to each type (like partnerRequestFailure and vendorRequestFailure)
or you need to publish separate json, one for partner and one for vendor.

How to decode JSON list using sql statements in AWS IoT core?

Here I have displayed the payload that I am trying to decode in AWS
IoT core rules to push that to AWS DynamoDB.
{
"adr": true,
"applicationID": "1",
"applicationName": "IOTAPPS",
"data": "AANl3AAAQT8AZA==",
"devEUI": "sadfgxvgsfxgs245",
"deviceName": "TRON002",
"fCnt": 0,
"fPort": 2,
"object": {
" A1": "NO",
"A10": "YES",
"A11": "YES",
"A12": "YES",
"EGHmpID": 222684,
"SelFFMac": 100,
"TOTAL_DATA": "100000100111111"
},
"rxInfo": [
{
"gatewayID": "FDFDFEF5584EDEef",
"location": {
"altitude": 0,
"latitude": 12.66885,
"longitude": 77.81253
},
"name": "IoTGateway",
"fddi": -94,
"time": "2019-11-18T09:02:08.895349Z"
}
],
"txInfo": {
"dr": 5,
"frequency": 898678700000
}
}
We are trying to fetch 'time' from 'rxInfo' list by using following sql statement.
SELECT deviceName,(SELECT VALUE time FROM rxInfo) AS time FROM "my/topic"
We are not getting the expected answer
Try this, it's tested on AWS IoT.
SELECT (SELECT time fROM rxInfo) AS time FROM "abc/cmd"
to generate this output:
{
"time": [
{
"time": "2019-11-18T09:02:08.895349Z"
}
]
}
cheers,
ram