JOLT Flatten Unnamed nested array and Split function - jolt

Working on transformation and created spec for the input. The output is nested array but I am expecting flattened array.
2. Need to split the string and get the first element. split function doesn't seems to be working.
Please find the input, spec , output and expected output below.
Input
[
{
"tables": [
{
"columns": [
{
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"generated": false,
"dataType": "VARCHAR",
"name": "firstname",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
},
{
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"generated": false,
"dataType": "VARCHAR",
"name": "lastname",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
],
"name": "authors",
"fullName": "books.authors",
"type": "table",
"triggers": [],
"tableConstraints": [],
"remarks": "Contact details for book authors",
"primaryKey": {
"columns": {
"sortSequence": "ascending",
"name": "id"
},
"unique": true,
"name": "pk_authors",
"remarks": ""
}
},
{
"columns": [
{
"size": 10,
"nullable": true,
"databaseSpecificType": "int4",
"generated": false,
"dataType": "INTEGER",
"name": "id",
"width": "",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
],
"name": "authorslist",
"fullName": "books.authorslist",
"type": "view",
"triggers": [],
"tableConstraints": [],
"remarks": "",
"primaryKey": {}
}
],
"schemaCrawlerHeaderInfo": {
"crawlTimestamp": "2018-05-23 10:21:55",
"title": ""
}
}
]
Spec:
[{
"operation": "shift",
"spec": {
"*": {
"tables": {
"*": {
"columns": {
"*": {
"#(2,name)": "[&3].[&1].TABLE.tableName",
"#(2,fullName)": ["[&3].[&1].TABLE.fullName", "[&3].[&1].DB.fullName"],
"#(2,remarks)": "[&3].[&1].TABLE.tableDesc",
"name": "[&3].[&1].COLUMN.name",
"dataType": "[&3].[&1].COLUMN.dataType",
"size": "[&3].[&1].COLUMN.size",
"nullable": "[&3].[&1].COLUMN.nullable",
"databaseSpecificType": "[&3].[&1].COLUMN.databaseSpecificType",
"width": "[&3].[&1].COLUMN.width",
"decimalDigits": "[&3].[&1].COLUMN.decimalDigits",
"remarks": "[&3].[&1].COLUMN.remarks",
"autoIncremented": "[&3].[&1].COLUMN.autoIncremented"
}
}
}
}
}
}
}]
Output
[
[
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "firstname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
},
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "lastname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
}
],
[
{
"TABLE": {
"tableName": "authorslist",
"fullName": "books.authorslist",
"tableDesc": ""
},
"DB": {
"fullName": "books.authorslist"
},
"COLUMN": {
"name": "id",
"dataType": "INTEGER",
"size": 10,
"nullable": true,
"databaseSpecificType": "int4",
"width": "",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
}
]
]Iamexpectingtheflattenedoutputlikebelowinsinglearrayrathernestedarray.[
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "firstname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
},
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "lastname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
},
{
"TABLE": {
"tableName": "authorslist",
"fullName": "books.authorslist",
"tableDesc": ""
},
"DB": {
"fullName": "books.authorslist"
},
"COLUMN": {
"name": "id",
"dataType": "INTEGER",
"size": 10,
"nullable": true,
"databaseSpecificType": "int4",
"width": "",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
}
]
I am expecting the flattened output like below in single array rather nested array.
[
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "firstname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
},
{
"TABLE": {
"tableName": "authors",
"fullName": "books.authors",
"tableDesc": "Contact details for book authors"
},
"DB": {
"fullName": "books.authors"
},
"COLUMN": {
"name": "lastname",
"dataType": "VARCHAR",
"size": 20,
"nullable": false,
"databaseSpecificType": "varchar",
"width": "(20)",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
},
{
"TABLE": {
"tableName": "authorslist",
"fullName": "books.authorslist",
"tableDesc": ""
},
"DB": {
"fullName": "books.authorslist"
},
"COLUMN": {
"name": "id",
"dataType": "INTEGER",
"size": 10,
"nullable": true,
"databaseSpecificType": "int4",
"width": "",
"decimalDigits": 0,
"remarks": "",
"autoIncremented": false
}
}
]
And also tried split and firstelement function to get the dbname but split is not working.
"DB" : {
"fullName" : "books.authors"
}
"DB" : {
"fullName" : "books"
}
Any help on this would be great.

Have to do two shifts.
Spec and explaination
[
{
// Your input data is two nested arrays.
// Tables array, and its nested columns array.
// The number of elements in your output array is
// the total number of column elements in your input doc.
//
// Can't do it in a single shift.
// The sample input tables arrays is length 2
// The sample input columsn arrays are length 2 and 1.
// You want an output array of length 3, there is no "3"
// that can be referenced by the first shift operation.
//
// So first, "build" the final TABLE, COLUMN, DB format, by
// pushing table information down into the columns data, BUT
// keeping the same nested table and columns array structure.
"operation": "shift",
"spec": {
"0": {
"tables": {
"*": { // tables index
"columns": {
"*": { // columns index
// grabbing info off the "parent" table entry
"#(2,name)": "tables[&3].cols[&1].TABLE.tableName",
"#(2,fullName)": ["tables[&3].cols[&1].TABLE.fullName", "tables[&3].cols[&1].DB.fullName"],
"#(2,remarks)": "tables[&3].cols[&1].TABLE.tableDesc",
//
// handling all the column level data
"*": "tables[&3].cols[&1].COLUMN.&"
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"tables": {
"*": {
"cols": {
// now walk the nested tables and cols array
// and accumulate each "fully formatted"
// col entry, into the output top-level array
"*": "[]"
}
}
}
}
}
]

Related

How to add json data in ConfigMap creation in ArgoCD

I'm trying to create a ConfigMap with ArgoCD.
I've created a volumes.yaml file as such
---
apiVersion: v1
kind: ConfigMap
metadata:
name: persistent-volumes-argo
labels:
grafana_dashboard: "1"
project: "foo"
data:
kubernetes.json: |
{{ .Files.Get "dashboards/persistent-volumes.json" | indent 4 }}
But ArgoCD doesn't seem to be able to read the data, the way a standard Helm deployment would.
I've tried adding the data directly into the ConfigMap as such
(Data omitted for brevity)
---
apiVersion: v1
kind: ConfigMap
metadata:
name: persistent-volumes-argo
labels:
grafana_dashboard: "1"
project: "foo"
data:
kubernetes.json: |
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"limit": 100,
"name": "Annotations & Alerts",
"showIn": 0,
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": 13646,
"graphTooltip": 0,
"iteration": 1659421503107,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 26,
"panels": [],
"title": "Alerts",
"type": "row"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 0,
"y": 1
},
"id": 21,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"} ) and (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"} )) / (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"} )) >= (${warning_threshold} / 100)) or vector (0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs Above Warning Threshold",
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 8,
"y": 1
},
"id": 24,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count((kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=\"Pending\"}==1)) or vector(0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs in Pending State",
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 16,
"y": 1
},
"id": 23,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count((kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=\"Lost\"}==1)) or vector(0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs in Lost State",
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat"
},
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 5
},
"id": 17,
"panels": [],
"title": "Usage statistics",
"type": "row"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Used (%)"
},
"properties": [
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
},
{
"color": "semi-dark-yellow",
"value": 70
},
{
"color": "dark-red",
"value": 80
}
]
}
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "mappings",
"value": [
{
"options": {
"0": {
"text": "Bound"
},
"1": {
"text": "Pending"
},
"2": {
"text": "Lost"
}
},
"type": "value"
}
]
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
},
{
"color": "light-green",
"value": 0
},
{
"color": "semi-dark-orange",
"value": 1
},
{
"color": "semi-dark-red",
"value": 2
}
]
}
},
{
"id": "noValue",
"value": "--"
},
{
"id": "custom.align",
"value": "center"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Namespace"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Capacity (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Used (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Available (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "StorageClass"
},
"properties": [
{
"id": "custom.width",
"value": 150
}
]
},
{
"matcher": {
"id": "byName",
"options": "PersistentVolumeClaim"
},
"properties": [
{
"id": "custom.width",
"value": 370
}
]
}
]
},
"gridPos": {
"h": 12,
"w": 24,
"x": 0,
"y": 6
},
"id": 29,
"interval": "",
"options": {
"frameIndex": 2,
"showHeader": true,
"sortBy": [
{
"desc": false,
"displayName": "PersistentVolumeClaim"
}
]
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": " sum by (persistentvolumeclaim,namespace,storageclass,volumename) (kube_persistentvolumeclaim_info{namespace=~\"${k8s_namespace}\"})",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_available_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "D"
},
{
"expr": "sum(kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=~\"(Pending|Lost)\"}) by (persistentvolumeclaim) + sum(kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=~\"(Lost)\"}) by (persistentvolumeclaim)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "E"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}/kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"} * 100)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "F"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Persistent Volume Claim",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"byField": "persistentvolumeclaim"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Time 1": true,
"Time 2": true,
"Time 3": true,
"Time 4": true,
"Time 5": true,
"Time 6": true,
"Value #A": true
},
"indexByName": {},
"renameByName": {
"Time 1": "",
"Time 2": "",
"Time 3": "",
"Time 4": "",
"Time 5": "",
"Time 6": "",
"Value #A": "",
"Value #B": "Capacity (GiB)",
"Value #C": "Used (GiB)",
"Value #D": "Available (GiB)",
"Value #E": "Status",
"Value #F": "Used (%)",
"namespace": "Namespace",
"persistentvolumeclaim": "PersistentVolumeClaim",
"storageclass": "StorageClass",
"volumename": "PhysicalVolume"
}
}
}
],
"type": "table"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 24,
"x": 0,
"y": 18
},
"id": 7,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Status"
}
]
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "kube_storageclass_info",
"format": "table",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Storage Class",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": true,
"app_kubernetes_io_instance": true,
"app_kubernetes_io_name": true,
"instance": true,
"job": true,
"kubernetes_namespace": true,
"kubernetes_pod_name": true,
"pod_template_hash": true
},
"indexByName": {
"Time": 1,
"Value": 13,
"__name__": 2,
"app_kubernetes_io_instance": 3,
"app_kubernetes_io_name": 4,
"instance": 5,
"job": 6,
"kubernetes_namespace": 7,
"kubernetes_pod_name": 8,
"pod_template_hash": 9,
"provisioner": 10,
"reclaimPolicy": 11,
"storageclass": 0,
"volumeBindingMode": 12
},
"renameByName": {
"provisioner": "Provisioner",
"reclaimPolicy": "ReclaimPolicy",
"storageclass": "StorageClass",
"volumeBindingMode": "VolumeBindingMode"
}
}
},
{
"id": "groupBy",
"options": {
"fields": {
"Provisioner": {
"aggregations": [],
"operation": "groupby"
},
"ReclaimPolicy": {
"aggregations": [],
"operation": "groupby"
},
"StorageClass": {
"aggregations": [],
"operation": "groupby"
},
"VolumeBindingMode": {
"aggregations": [],
"operation": "groupby"
}
}
}
}
],
"type": "table"
},
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 23
},
"id": 15,
"panels": [],
"title": "Graphical usage data ",
"type": "row"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 12,
"w": 24,
"x": 0,
"y": 24
},
"hiddenSeries": false,
"id": 9,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.0.3",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "(max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}))",
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "All Running PVCs Used Bytes",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": true,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 36
},
"id": 19,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 41
},
"hiddenSeries": false,
"id": 11,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.2.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}[1h])",
"instant": false,
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Hourly Volume Usage Rate",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "binBps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 48
},
"hiddenSeries": false,
"id": 12,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.2.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}[1d])",
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Daily Volume Usage Rate",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "binBps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 55
},
"hiddenSeries": false,
"id": 13,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
}
}
But this errors with rpc error: code = FailedPrecondition desc = Failed to unmarshal "volumes.yaml": <nil>
Is there a way to pass in json data when creating a ConfigMap with ArgoCD, either as a template or by dumping the data in the file?
To create configmap with argocd and helm
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "helm-chart.fullname" . }}-configmap
data:
config.json : |
{{ toJson .Values.configmap | indent 4 }}
and the value file should be like this, which is our JSON but converted to YAML
configmap:
json:
- rigid
- better for data interchange
yaml:
- slim and flexible
- better for configuration
object:
key: value
array:
- null_value:
- boolean: true
- integer: 1
- alias: &example aliases are like variables
- alias: *example
paragraph: >
Blank lines denote
paragraph breaks
content: |-
Or we
can auto
convert line breaks
to save space
alias: &foo
bar: baz
alias_reuse: *foo
json2yaml
A complete demo app can be found here
A very quick way to create app with the above configmap and demo app
argocd app create demo-app --repo https://github.com/Adiii717/argocd-demo-app.git --path helm-chart --dest-namespace default --dest-server https://kubernetes.default.svc --helm-set replicaCount=2
Make sure you also set
export ARGOCD_AUTH_TOKEN="tokeh
export ARGOCD_OPTS="--grpc-web"
export ARGOCD_SERVER="argocd.example.com"
added section for the configmap

while consuming from kafka in druid, roll up merges two rows to 1 instead of adding them

I trying to use druid to consume events from kafka, however when I'm using roll-up to consume the data, the number of events seem to coming in wrong. without roll-up the numbers are accurate. I am using Druid 0.17.1.
i have observed that while roll up is happening instead of aggregating the events to n it aggregates to 1.
here is my ingestion spec
{
"dataSchema": {
"dataSource": "notificationstatus",
"timestampSpec": {
"column": "date",
"format": "yyyy-MM-dd-HH:mm:ss Z",
"missingValue": null
},
"dimensionsSpec": {
"dimensions": [{
"type": "string",
"name": "Process",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "Channel",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "Status",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "Message",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "CampaignID",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
},
{
"type": "string",
"name": "BannerID",
"multiValueHandling": "SORTED_ARRAY",
"createBitmapIndex": true
}
],
"dimensionExclusions": [
"date",
"count"
]
},
"metricsSpec": [{
"type": "count",
"name": "count"
}],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "HOUR",
"queryGranularity": "MINUTE",
"rollup": true,
"intervals": null
},
"transformSpec": {
"filter": {
"type": "not",
"field": {
"type": "like",
"dimension": "Status",
"pattern": "INFO",
"escape": null,
"extractionFn": null
}
},
"transforms": []
}
},
"ioConfig": {
"topic": "notificationstatus",
"inputFormat": {
"type": "tsv",
"columns": [
"source",
"ymd",
"date",
"Process",
"deviceID",
"Channel",
"CampaignID",
"BannerID",
"Status",
"Message",
"11",
"12"
],
"listDelimiter": null,
"delimiter": "\t",
"findColumnsFromHeader": false,
"skipHeaderRows": 0
},
"replicas": 1,
"taskCount": 1,
"taskDuration": "PT3600S",
"consumerProperties": {},
"pollTimeout": 100,
"startDelay": "PT5S",
"period": "PT30S",
"useEarliestOffset": false,
"completionTimeout": "PT1800S",
"lateMessageRejectionPeriod": null,
"earlyMessageRejectionPeriod": null,
"lateMessageRejectionStartDateTime": null,
"stream": "notificationstatus",
"useEarliestSequenceNumber": false,
"type": "kafka"
},
"tuningConfig": {
"type": "kafka",
"maxRowsInMemory": 1000000,
"maxBytesInMemory": 0,
"maxRowsPerSegment": 5000000,
"maxTotalRows": null,
"intermediatePersistPeriod": "PT10M",
"basePersistDirectory": "/home/akash/Downloads/druidVer/apache-druid-0.17.1/var/tmp/druid-realtime-persist622909873559398926",
"maxPendingPersists": 0,
"indexSpec": {
"bitmap": {
"type": "concise"
},
"dimensionCompression": "lz4",
"metricCompression": "lz4",
"longEncoding": "longs"
},
"indexSpecForIntermediatePersists": {
"bitmap": {
"type": "concise"
},
"dimensionCompression": "lz4",
"metricCompression": "lz4",
"longEncoding": "longs"
},
"buildV9Directly": true,
"reportParseExceptions": false,
"handoffConditionTimeout": 0,
"resetOffsetAutomatically": false,
"segmentWriteOutMediumFactory": null,
"workerThreads": null,
"chatThreads": null,
"chatRetries": 8,
"httpTimeout": "PT10S",
"shutdownTimeout": "PT80S",
"offsetFetchPeriod": "PT30S",
"intermediateHandoffPeriod": "P2147483647D",
"logParseExceptions": false,
"maxParseExceptions": 2147483647,
"maxSavedParseExceptions": 0,
"skipSequenceNumberAvailabilityCheck": false,
"repartitionTransitionDuration": "PT120S"
},
"type": "kafka"
}

Get Backlog Level Work Item Types using C# (TFS 2017)

Is there a way to get backlog level work item types using C# (TFS 2017)
What I do right now is
TfsTeamProjectCollection teamProjectCollection = connectToTfs();
WorkItemStore workItemStore = teamProjectCollection.GetService<WorkItemStore>();
Project p = workItemStore.Projects[projectname];
List<WorkItemType> col = p.WorkItemTypes.Cast<WorkItemType>().ToList();
It gets all work item types but I need only existing backlog level work item types. To clarify what I mean by backlog level work item types here is the screen
You can call the BacklogConfiguration API to retrieve the Work Item Types and the default Work Item type for each backlog level.
See: https://learn.microsoft.com/en-us/rest/api/azure/devops/work/backlogconfiguration/get?view=azure-devops-rest-5.1
GET https://dev.azure.com/fabrikam/Fabrikam-Fiber/_apis/work/backlogconfiguration?api-version=5.1
{
"taskBacklog": {
"id": "Microsoft.TaskCategory",
"name": "Tasks",
"rank": 1,
"workItemCountLimit": 1000,
"addPanelFields": [
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
}
],
"columnFields": [
{
"columnFieldReference": {
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 400
},
{
"columnFieldReference": {
"referenceName": "System.State",
"name": "State",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.AssignedTo",
"name": "Assigned To",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Scheduling.RemainingWork",
"name": "Remaining Work",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
}
],
"workItemTypes": [
{
"name": "Task",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Task"
}
],
"defaultWorkItemType": {
"name": "Task",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Task"
},
"color": "F2CB1D"
},
"requirementBacklog": {
"id": "Microsoft.RequirementCategory",
"name": "Stories",
"rank": 2,
"workItemCountLimit": 1000,
"addPanelFields": [
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
}
],
"columnFields": [
{
"columnFieldReference": {
"referenceName": "System.WorkItemType",
"name": "Work Item Type",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 400
},
{
"columnFieldReference": {
"referenceName": "System.State",
"name": "State",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Scheduling.StoryPoints",
"name": "Story Points",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Common.ValueArea",
"name": "Value Area",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.IterationPath",
"name": "Iteration Path",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 200
},
{
"columnFieldReference": {
"referenceName": "System.Tags",
"name": "Tags",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 200
}
],
"workItemTypes": [
{
"name": "Ticket",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Ticket"
},
{
"name": "User Story",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/User%20Story"
}
],
"defaultWorkItemType": {
"name": "User Story",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/User%20Story"
},
"color": "009CCC"
},
"portfolioBacklogs": [
{
"id": "Microsoft.EpicCategory",
"name": "My level",
"rank": 4,
"workItemCountLimit": 1000,
"addPanelFields": [
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
}
],
"columnFields": [
{
"columnFieldReference": {
"referenceName": "System.WorkItemType",
"name": "Work Item Type",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 400
},
{
"columnFieldReference": {
"referenceName": "System.State",
"name": "State",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Scheduling.Effort",
"name": "Effort",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Common.BusinessValue",
"name": "Business Value",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Common.ValueArea",
"name": "Value Area",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.Tags",
"name": "Tags",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 200
}
],
"workItemTypes": [
{
"name": "Epic",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Epic"
}
],
"defaultWorkItemType": {
"name": "Epic",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Epic"
},
"color": "60af49"
},
{
"id": "Microsoft.FeatureCategory",
"name": "Features",
"rank": 3,
"workItemCountLimit": 1000,
"addPanelFields": [
{
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
}
],
"columnFields": [
{
"columnFieldReference": {
"referenceName": "System.WorkItemType",
"name": "Work Item Type",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.Title",
"name": "Title",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 400
},
{
"columnFieldReference": {
"referenceName": "System.State",
"name": "State",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Scheduling.Effort",
"name": "Effort",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Common.BusinessValue",
"name": "Business Value",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 50
},
{
"columnFieldReference": {
"referenceName": "Microsoft.VSTS.Common.ValueArea",
"name": "Value Area",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 100
},
{
"columnFieldReference": {
"referenceName": "System.Tags",
"name": "Tags",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields"
},
"width": 200
}
],
"workItemTypes": [
{
"name": "Feature",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Feature"
}
],
"defaultWorkItemType": {
"name": "Feature",
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/wit/workItemTypes/Feature"
},
"color": "773B93"
}
],
"workItemTypeMappedStates": [
{
"workItemTypeName": "User Story",
"states": {
"New": "Proposed",
"Active": "InProgress",
"Resolved": "InProgress",
"In Progress": "InProgress",
"Closed": "Completed"
}
},
{
"workItemTypeName": "Ticket",
"states": {
"New": "Proposed",
"Active": "InProgress",
"Closed": "Completed"
}
},
{
"workItemTypeName": "Feature",
"states": {
"New": "Proposed",
"Active": "InProgress",
"Resolved": "InProgress",
"Closed": "Completed"
}
},
{
"workItemTypeName": "Epic",
"states": {
"New": "Proposed",
"Active": "InProgress",
"Closed": "Completed"
}
},
{
"workItemTypeName": "Task",
"states": {
"New": "Proposed",
"Active": "InProgress",
"Closed": "Completed"
}
},
{
"workItemTypeName": "Bug",
"states": {
"Proposed": "Proposed",
"Testing": "InProgress",
"Resolved": "Resolved",
"Closed": "Completed"
}
}
],
"backlogFields": {
"typeFields": {
"Order": "Microsoft.VSTS.Common.StackRank",
"Effort": "Microsoft.VSTS.Scheduling.StoryPoints",
"RemainingWork": "Microsoft.VSTS.Scheduling.RemainingWork",
"Activity": "Microsoft.VSTS.Common.Activity"
}
},
"bugsBehavior": "asTasks",
"hiddenBacklogs": [
"Microsoft.EpicCategory"
],
"url": "https://dev.azure.com/fabrikam/c3b6da71-2b4a-497b-9137-ba8695203871/_apis/work/backlogconfiguration"
}

How to update a part of an array sub document in MongoDB

I have this document in my mongodb collection:
{
"_id": "YLRM9Wi7f6tp6qNbS",
"sessionId": "hLDkkJKR4Muik6tbe",
"userId": "ZYoG4cH8HcCDPMDGr",
"shopId": "J8Bhq3uTtdgwZx3rz",
"workflow": {
"status": "",
"workflow": ["String"]
},
"billing": [Object],
"discount": 0,
"tax": 0,
"items": [
{
"_id": "JwR233jD2c4HKeYKq",
"shopId": "J8Bhq3uTtdgwZx3rz",
"productId": "BCTMZ6HTxFSppJESk",
"quantity": 1,
"product": {
"_id": "BCTMZ6HTxFSppJESk",
"title": "Product",
"shopId": "J8Bhq3uTtdgwZx3rz",
"ancestors": [],
"createdAt": "2018-01-12T10:22:18.853Z",
"description": "",
"handle": "product",
"hashtags": [
"rpjCvTBGjhBi2xdro",
"cseCBSSrJ3t8HQSNP"
],
"price": {
"range": "12.99 - 19.99",
"min": 12.99,
"max": 19.99
},
"isVisible": true,
"isLowQuantity": false,
"isSoldOut": false,
"isBackorder": false,
"metafields": [
{
"key": "Material",
"value": "Cotton"
},
{
"key": "Quality",
"value": "Excellent"
}
],
"pageTitle": "",
"type": "simple",
"updatedAt": "2018-01-12T10:22:18.854Z",
"vendor": "Vendor_Name",
"originCountry": "country",
"requiresShipping": true,
"isDeleted": false,
"template": "productDetailSimple",
"workflow": {
"status": "new"
}
},
"variants": {},
"title": "Product",
"type": "simple",
"parcel": {
"weight": 25,
"height": 3,
"width": 10,
"length": 10
},
"shippingMethod": {
"shopId": "J8Bhq3uTtdgwZx3rz",
"shipmentQuotes": [Object],
"shipmentQuotesQueryStatus": {
"requestStatus": "success",
"numOfShippingMethodsFound": 11
},
"_id": "s3EJXrLsZe73RbLiD",
"address": {},
"shipmentMethod": {},
"paymentId": "nyybR5BNvDDrJrtwe",
"items": [
{
"_id": "JwR233jD2c4HKeYKq",
"productId": "BCTMZ6HTxFSppJESk",
"shopId": "J8Bhq3uTtdgwZx3rz",
"variantId": "CJoRBm9vRrorc9mxZ"
}
],
"workflow": {
"status": "new",
"workflow": ["String"]
}
},
"workflow": {
"status": "new",
"workflow": ["String"]
}
}
],
"shipping": [Object],
"email": "johndoe#mail.com",
"cartId": "L6sSGv4NR9rpbDbsd",
"createdAt": "2018-01-12T10:22:18.850Z"
}
The field items is an array of objects, I would like to update just a part of the object specifically the workflow field without touching other part of the objects in items array.
I was able to do this using a loop, but it caused some tests to fail. Is there a better of doing this with using a loop?
Thank you.
You can try findAndModify method.
Traverse to the workflow key ad try to set the value.
Hope this would help.

what is the date format from stash api?

In the below json response, what is the date format for createdDate and updatedDate? I am not sure how to work in reverse to find what format the api is using for date. I couldn't find this any where in the documentation.
{
"size": 1,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": 101,
"version": 1,
"title": "Talking Nerdy",
"description": "It’s a kludge, but put the tuple from the database in the cache.",
"state": "OPEN",
"open": true,
"closed": false,
"createdDate": 1359075920,
"updatedDate": 1359085920,
"fromRef": {
"id": "refs/heads/feature-ABC-123",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"toRef": {
"id": "refs/heads/master",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"locked": false,
"author": {
"user": {
"name": "tom",
"emailAddress": "tom#example.com",
"id": 115026,
"displayName": "Tom",
"active": true,
"slug": "tom",
"type": "NORMAL"
},
"role": "AUTHOR",
"approved": true
},
"reviewers": [
{
"user": {
"name": "jcitizen",
"emailAddress": "jane#example.com",
"id": 101,
"displayName": "Jane Citizen",
"active": true,
"slug": "jcitizen",
"type": "NORMAL"
},
"role": "REVIEWER",
"approved": true
}
],
"participants": [
{
"user": {
"name": "dick",
"emailAddress": "dick#example.com",
"id": 3083181,
"displayName": "Dick",
"active": true,
"slug": "dick",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": false
},
{
"user": {
"name": "harry",
"emailAddress": "harry#example.com",
"id": 99049120,
"displayName": "Harry",
"active": true,
"slug": "harry",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": true
}
],
"link": {
"url": "http://link/to/pullrequest",
"rel": "self"
},
"links": {
"self": [
{
"href": "http://link/to/pullrequest"
}
]
}
}
],
"start": 0
}
Just making a note that in my case, it is a UNIX timestamp, but I have to remove three trailing zeroes. E.g. the data looks like this:
"createdDate":1555621993000
If interpreted as a UNIX timestamp, that would be 09/12/51265 # 4:16am (UTC).
By removing the three trailing zeroes I get 1555621993, which is the correct time 04/18/2019 # 9:13pm (UTC)
Your mileage may vary but that was a key discovery for me :)
It looks like a UNIX timestamp.
https://en.wikipedia.org/wiki/Unix_time