How to format grafana Alert on teams via webhooks - azure

when the alert is sent to my team’s channel, the pipeline name is truncated [see image below]
alert on teams triggerd on grafana
I would like to know if there is anything I can do to make the entire variable name appear
I’m using grafana v7.5 and my data comes from Azure logs
{
"firing": true,
"state": "pending",
"conditionEvals": "true = true",
"timeMs": "430.287ms",
"matches": [
{
"metric": "n {PipelineName=PPLCRGLOADORLTOAPOSENTEVT}",
"value": 11
}
],
"logs": [
{
"message": "Condition[0]: Query",
"data": {
"from":number,
"queries": [
{
"refId": "A",
"model": {
"appInsights": {
"dimension": [],
"metricName": "select",
"timeGrain": "auto"
},
"azureLogAnalytics": {
"query": "ADFActivityRun\r\n| where (Status == 'Failed') and (substring(ResourceId,135,3) == 'PRD') and TimeGenerated > ago(8h)\r\n| summarize n=count() by bin(TimeGenerated, 5min),PipelineName\r\n\r\n| project n,TimeGenerated,PipelineName",
"resultFormat": "time_series",
"workspace": "workspace"
},
"azureMonitor": {
"aggOptions": [],
"dimensionFilter": "*",
"dimensionFilters": [],
"metricDefinition": "select",
"metricName": "select",
"metricNamespace": "select",
"resourceGroup": "select",
"resourceName": "select",
"timeGrain": "auto",
"timeGrains": [],
"top": "10"
},
"insightsAnalytics": {
"query": "",
"resultFormat": "time_series"
},
"queryType": "Azure Log Analytics",
"refId": "A",
"subscription": "subscription"
},
"datasource": {
"id": 3,
"name": "LA-DATAANALYTICS-PRD"
},
"maxDataPoints": 0,
"intervalMs": 0
}
],
"to": #number
}
},
{
"message": "Condition[0]: Query Result",
"data": {
"fromDataframe": true,
"series": [
{
"name": "n {PipelineName=PPLCRGLOADORLTOAPOSENTEVT}",
"points": [
[
1,
1628064600000
],
[
1,
1628064900000
],
[
1,
1628065200000
],
[
1,
1628065500000
],
[
1,
1628065800000
],
[
1,
1628066100000
],
[
1,
1628066700000
],
[
1,
1628067000000
],
[
1,
1628067300000
],
[
1,
1628067600000
],
[
2,
1628067900000
]
],
"tags": {
"PipelineName": "PPLCRGLOADORLTOAPOSENTEVT"
}
}
]
}
},
{
"message": "Condition[0]: Eval: true, Metric: n {PipelineName=PPLCRGLOADORLTOAPOSENTEVT}, Value: 11.000",
"data": null
}
]
}
Here is the JSON generated by test rule
And the length of pipeline name is something like 25 chars
(PPLCRGLOADORLTOAPOSENTEVT)

Related

Shopware 6 API Create a Product with Variants

I created my products with the API and all is ok. But we have some products with variants. These looking good in the backend, but in the frontend shopware doesn't display the product. Where is my error in the payload?
Thank you for helping me!
Here is my code:
{
"write-product":
{
"entity": "product",
"action": "upsert",
"payload": [
{
"id": "17cf3bac8966cc4de52aa557f59e5fd3",
"active": true,
"deliveryTimeId": "1e04777cb17d4396b424129b2d8e3a79",
"description": "Produktbeschreibung",
"ean": null,
"featureSetId": null,
"manufacturerId": null,
"manufacturerNumber": null,
"minPurchase": 1,
"name": "Produktname",
"productNumber": "Nummer",
"releaseDate": "2022-09-28T14:12:18.03",
"stock": 999999,
"taxId": "2842fd17d5a7424795853e7fe7072448",
"price":[
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 13.77,
"gross": 16.39,
"linked": false
}
],
"categories":[
{
"id":"648875017ed54637a41c8c1f972c239f",
"name":"Kategoriename"
}
],
"configuratorSettings": [
{
"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
"optionId": "2ab9df7d2dd94ad38eb53cf7dcf16e56"
},
{
"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
"optionId": "0fcf784970ea448bac1f7db542df9b86"
},
{
"productId": "17cf3bac8966cc4de52aa557f59e5fd3",
"optionId": "0014aa7dc0b644b78cd4b39193f580b4"
}
],
"properties": [
{
"groupId":"ca74efd59b5545f2b4e4f532c217b2ce",
"name": "1,0 m"
},
{
"groupId":"fa7f63d697d44684a5bb74ba5a73d3c7",
"name": "2,0 mm"
},
{
"groupId":"a431bc98fe0149c3bf3ececf629e9740",
"name": "Material"
}
],
"visibilities": [
{
"id": "17cf3bac8966cc4de52aa557f59e5fd3",
"salesChannelId": "840a0403b56240b6a11502af1d46521e",
"visibility": 30
}
],
"coverId": "0f9ab99638bd0ea5e907234bf425819e",
"cover":
{
"mediaId": "0f9ab99638bd0ea5e907234bf425819e"
},
"media": [
{
"media":
{
"id": "0f9ab99638bd0ea5e907234bf425819e",
"position": 0,
"mediaFolderId": "d8f460870e454c0bbca540614ca30029",
"alt": "Bildname",
"description": "Bildbeschreibung",
"title": "Bildtitel"
}
}
],
"children": [
{
"id": "25c8876fb7577cad78df7539737d25ce",
"active": true,
"deliveryTimeId": "1e04777cb17d4396b424129b2d8e3a79",
"description": "Beschreibung Kindelement",
"ean": null,
"featureSetId": null,
"manufacturerId": null,
"manufacturerNumber": null,
"minPurchase": 1,
"name": "Name Kindelement",
"productNumber": "Nummer Kindelement",
"releaseDate": "2022-09-16T14:14:31.41",
"stock": 999999,
"taxId": "2842fd17d5a7424795853e7fe7072448",
"price":[
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 82.63,
"gross": 98.33,
"linked": false
}
],
"categories":[
{
"id":"648875017ed54637a41c8c1f972c239f",
"name":"Kategoriename"
}
],
"configuratorSettings": [
{
"productId": "25c8876fb7577cad78df7539737d25ce",
"optionId": "b224173313cb4f8da03578ef83702751"
},
{
"productId": "25c8876fb7577cad78df7539737d25ce",
"optionId": "0fcf784970ea448bac1f7db542df9b86"
},
{
"productId": "25c8876fb7577cad78df7539737d25ce",
"optionId": "0014aa7dc0b644b78cd4b39193f580b4"
}
],
"properties": [
{
"groupId":"ca74efd59b5545f2b4e4f532c217b2ce",
"name": "6,0 m"
},
{
"groupId":"fa7f63d697d44684a5bb74ba5a73d3c7",
"name": "2,0 mm"
},
{
"groupId":"a431bc98fe0149c3bf3ececf629e9740",
"name": "Material"
}
],
"parentId": "17cf3bac8966cc4de52aa557f59e5fd3",
"options": [
{
"id":"b224173313cb4f8da03578ef83702751",
"group": {
"id":"ca74efd59b5545f2b4e4f532c217b2ce"}
},
{
"id":"0fcf784970ea448bac1f7db542df9b86",
"group": {
"id":"fa7f63d697d44684a5bb74ba5a73d3c7"}
},
{
"id":"0014aa7dc0b644b78cd4b39193f580b4",
"group": {
"id":"a431bc98fe0149c3bf3ececf629e9740"
}
}
],
"visibilities": [
{
"id": "25c8876fb7577cad78df7539737d25ce",
"salesChannelId": "840a0403b56240b6a11502af1d46521e",
"visibility": 30
}
],
"media": [
{
"media": {
"id": "fba6e74294488b554aa88f7dcf6f38f2",
"position": 0,
"mediaFolderId": "d8f460870e454c0bbca540614ca30029",
"alt": "Bildname Kindelement",
"description": "Beschreibung Kindelement",
"title": "Bildtitel Kindelement"
}
}
]
}
]
}
]
}
}
I'm searching in different boards and looking in the API Browser, Using swagger for the api and so on. No result. I need the main-product and the variants be visible in the frontend. At the moment all products with variants are invisible in the frontend.
Double check your Visibility & Categories. It could be them. Also, maybe you need to re-index after creation?
You have way too much stuff going on at the moment for us to help you out.
Try to split your calls into smaller chunks (for us). Also start with less data when creating a product. With every step check the frontend. Can you even create a simple product & display it on the frontend? Yes? Then try create the most basic child that inherits most of the visible parent.
For a child you do not need much data, e.g.
{
"write-product": {
"entity": "product",
"action": "upsert",
"payload": [
{
"parentId": "",
"options": [
{
"id": ""
}
],
"price": [
{
"currencyId": "{{gen_salesChannel_currency_id}}",
"gross": 0.0,
"net": 0.0,
"linked": false
}
]
"productNumber": "",
"stock": 999
}
]
}
}
Another tip is to use the network tab in the admin to see how it creates these relationships. Here is an image of how it looks like:

Filter by Product Properties with Store API

For the store API endpoint /store-api/product is it possible to filter on the properties of a product? Not the defaults such as whether it's active or stock levels, but the properties we've defined on the product, for example colour or farbe? For the search endpoint it supports passing in a list of properties ID's which this one does not.
None of the below queries work, and return the various errors below or Call to a member function buildAccessor() on null.
{
"limit": 40,
"filter": [
{
"type": "contains",
"field": "Farbe",
"value": "red"
}
]
}
"Field \"Farbe\" in entity \"product\" was not found."
{
"limit": 40,
"filter": [
{
"type": "contains",
"field": "properties.Farbe",
"value": "red"
}
]
}
"Field \"Farbe\" in entity \"property_group_option\" was not found."
You can combine filters for the name of the property value and their respective group in a multi filter. The following example will only give you products that have the "shoe-color" property with the value "coral".
{
"limit": 1,
"includes": {
"product": ["id", "productNumber", "properties"],
"property_group_option": ["name", "group"],
"property_group": ["name"]
},
"associations": {
"properties": {
"associations": {
"group": []
}
}
},
"filter": [
{
"type": "multi",
"operator": "and",
"queries": [
{
"type": "equals",
"field": "properties.group.name",
"value": "shoe-color"
},
{
"type": "equals",
"field": "properties.name",
"value": "coral"
}
]
}
]
}
Example response:
{
"entity": "product",
"total": 1,
"aggregations": [],
"page": 1,
"limit": 1,
"elements": [
{
"productNumber": "6bbfe1f608504c9b9a7bf92d6a071734",
"properties": [
{
"name": "coral",
"group": {
"name": "shoe-color",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
},
{
"name": "cotton",
"group": {
"name": "textile",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
}
],
"id": "062ba988aa1840fa84371c9c43b2f838",
"apiAlias": "product"
}
],
"states": [],
"apiAlias": "dal_entity_search_result"
}

How do I send customer data from twilio to stripe?

I'm using Twilio to allow my customers to pay automatically over the phone via to stripe. I followed this tutorial: Is there a way to enter dollars/cents via DTMF?
The issue I'm running into is how do I send the "phone number" as a "customer" into stripe? The reason I want this is to be able to see who bought what and how many times etc. Currently, they are all coming into stripe as unknown/guest.
My only success has been (I'm using the studio) entering {{trigger.call.From}} into the "payment description". That still doesn't solve the issue fully though.
Any help would be greatly appreciated!
Here is my flow code:
{
"description": "A New Flow",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"next": "received_message_forward",
"event": "incomingMessage"
},
{
"next": "gather_1",
"event": "incomingCall"
},
{
"event": "incomingConversationMessage"
},
{
"event": "incomingRequest"
},
{
"event": "incomingParent"
}
],
"properties": {
"offset": {
"x": 0,
"y": 0
}
}
},
{
"name": "gather_1",
"type": "gather-input-on-call",
"transitions": [
{
"next": "function_1",
"event": "keypress"
},
{
"event": "speech"
},
{
"next": "gather_1",
"event": "timeout"
}
],
"properties": {
"voice": "man",
"speech_timeout": "auto",
"offset": {
"x": 30,
"y": 270
},
"loop": 1,
"finish_on_key": "#",
"say": "Welcome and thank you for calling the donation line. Please enter the amount you wish to donate, then press pound. To enter with cents use the star key. for example to enter $18.50, press one eight star five zero.",
"language": "en-US",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "function_1",
"type": "run-function",
"transitions": [
{
"next": "confirm_donation_amount",
"event": "success"
},
{
"event": "fail"
}
],
"properties": {
"offset": {
"x": -60,
"y": 530
},
"parameters": [
{
"value": "{{widgets.gather_1.Digits}}",
"key": "amount"
}
],
"url": "https://sand-pointer-5043.twil.io/pay_from_exchange"
}
},
{
"name": "say_play_2",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": -60,
"y": 840
},
"loop": 1,
"say": "You entered ${{widgets.function_1.body}}",
"language": "en-US"
}
},
{
"name": "pay_1",
"type": "capture-payments",
"transitions": [
{
"next": "say_play_3",
"event": "success"
},
{
"next": "say_play_4",
"event": "maxFailedAttempts"
},
{
"next": "say_play_4",
"event": "providerError"
},
{
"next": "say_play_4",
"event": "payInterrupted"
},
{
"next": "say_play_4",
"event": "hangup"
},
{
"next": "say_play_4",
"event": "validationError"
}
],
"properties": {
"security_code": true,
"offset": {
"x": -70,
"y": 1140
},
"max_attempts": 2,
"payment_connector": "",
"payment_amount": "{{widgets.function_1.body}}",
"description": "{{trigger.call.From}} via Twilio",
"currency": "usd",
"language": "en-US",
"postal_code": "false",
"payment_token_type": "reusable",
"timeout": 5,
"valid_card_types": [
"visa",
"master-card",
"amex",
"discover"
]
}
},
{
"name": "say_play_3",
"type": "say-play",
"transitions": [
{
"next": "send_success_message_1",
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": -185,
"y": 1433
},
"loop": 1,
"say": "Your donation of ${{widgets.function_1.body}} was successful, Thank you.",
"language": "en-US"
}
},
{
"name": "say_play_4",
"type": "say-play",
"transitions": [
{
"next": "send_fail_message_1",
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": 190,
"y": 1456
},
"loop": 1,
"say": "There was an error with your donation. Please verify your details and call back to try again. Thanks!",
"language": "en-US"
}
},
{
"name": "send_success_message_1",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": -100,
"y": 1700
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "Your donation of ${{widgets.function_1.body}} was successful, Thank you!."
}
},
{
"name": "send_fail_message_1",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": 250,
"y": 1700
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "There was an error with your donation. Please verify your details and call back to try again. Thanks!"
}
},
{
"name": "confirm_donation_amount",
"type": "gather-input-on-call",
"transitions": [
{
"next": "split_2",
"event": "keypress"
},
{
"event": "speech"
},
{
"next": "confirm_donation_amount",
"event": "timeout"
}
],
"properties": {
"number_of_digits": 1,
"speech_timeout": "auto",
"offset": {
"x": 420,
"y": 530
},
"loop": 1,
"finish_on_key": "#",
"say": "You entered ${{widgets.function_1.body}}. Press 1 to confirm, or press 2 to enter a different amount.",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "split_2",
"type": "split-based-on",
"transitions": [
{
"next": "confirm_donation_amount",
"event": "noMatch"
},
{
"next": "pay_1",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to 1",
"arguments": [
"{{widgets.confirm_donation_amount.Digits}}"
],
"type": "equal_to",
"value": "1"
}
]
},
{
"next": "gather_1",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to 2",
"arguments": [
"{{widgets.confirm_donation_amount.Digits}}"
],
"type": "equal_to",
"value": "2"
}
]
}
],
"properties": {
"input": "{{widgets.confirm_donation_amount.Digits}}",
"offset": {
"x": 430,
"y": 800
}
}
},
{
"name": "received_message_forward",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": -300,
"y": 250
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "Thanks for texting the Donation line. To donate, please call us on this same number. We do not accept donations via text."
}
}
],
"initial_state": "Trigger",
"flags": {
"allow_concurrent_calls": true
}
}
Here is the function:
exports.handler = function(context, event, callback) {
const amount = event.amount;
const convert = amount.replace('*', '.');
callback(null, convert);
};

Json array iteration in futon

I am using CocuhDB I have this document structure
{"master": false,
"type": "a",
"company": 9,
"products": [
{
"unit": {
"id": 9,
"isMp": false,
"_id": "40109daadce8d3671a1aeca35bbb1438"
},
"article": {
"id": 1132,
"id_provider": 0,
"isMp": false,
"id_unit": 9,
"weight": 0,
"_id": "eb1718f96375b01af5552cf3f4c2d86b",
"code": "ME021",
"type_article": 2
},
"order": 1,
"warehouse_company": {
"id": 9,
"_id": "ebce7557ff95203ac5d03f294381d6ed"
},
"article_code": "ME021",
"provider": {
"id": 2313,
"isMp": false
},
"qty": 20.5,
"warehouse": {
"id": 18,
"isMp": false
}
}, {
"unit": {
"id": 9,
"isMp": false,
"_id": "40109daadce8d3671a1aeca35bbb1438"
},
"article": {
"id": 1132,
"id_provider": 0,
"isMp": false,
"id_unit": 9,
"weight": 0,
"_id": "eb1718f96375b01af5552cf3f4c2d86b",
"code": "ME099",
"type_article": 2
},
"order": 1,
"warehouse_company": {
"id": 9,
"isMp": false
},
"article_code": "ME021",
"provider": {
"id": 2313,
"isMp": false,
"_id": "657abbdfb4c713a9baa1ffd7329319c0"
},
"qty": 20.5,
"warehouse": {
"id": 18,
"isMp": false,
"_id": "9f70abb04a0243a1cd997b6430fb2207"
}
}
]
}
products field coulb be one or ten.
I need to find all the documents where
doc.products[n].warehouse.id == 18
But I dont know how to do it using Futon.
I am trying something like :
function(doc) {
var product, value;
if (doc.type != master && doc.type == "a" && doc.company == 9) {
for (product in doc.products) {
value= doc.prices[producto];
emit(value, doc );
}
}
}
But It does not work .
What I am doing wrong?
You can use view like this. This is an example. Not a solution
function(doc) {
var product, value;
if (doc.type != "master" && doc.type == "a" && doc.company == 9 && doc.products && Array.isArray(doc.products)) {
doc.products.forEach(function(product) {
Object.keys(product).forEach(function(key) {
emit([key, product[key].id]);
});
});
}
}
Will create output like
{
"total_rows": 16,
"offset": 0,
"rows": [
{
"key": [
"article",
1132
],
"id": "check",
"value": null
},
{
"key": [
"article",
1132
],
"id": "check",
"value": null
},
{
"key": [
"article_code",
null
],
"id": "check",
"value": null
},
{
"key": [
"article_code",
null
],
"id": "check",
"value": null
},
{
"key": [
"order",
null
],
"id": "check",
"value": null
},
{
"key": [
"order",
null
],
"id": "check",
"value": null
},
{
"key": [
"provider",
2313
],
"id": "check",
"value": null
},
{
"key": [
"provider",
2313
],
"id": "check",
"value": null
},
{
"key": [
"qty",
null
],
"id": "check",
"value": null
},
{
"key": [
"qty",
null
],
"id": "check",
"value": null
},
{
"key": [
"unit",
9
],
"id": "check",
"value": null
},
{
"key": [
"unit",
9
],
"id": "check",
"value": null
},
{
"key": [
"warehouse",
18
],
"id": "check",
"value": null
},
{
"key": [
"warehouse",
18
],
"id": "check",
"value": null
},
{
"key": [
"warehouse_company",
9
],
"id": "check",
"value": null
},
{
"key": [
"warehouse_company",
9
],
"id": "check",
"value": null
}
]
}
You can search for " warehouse" with id 18 like
using key=["warehouse",18]

Copyindex in deploying dashboard resources Azure ARM

I am deploying a custom Azure Dashboard with a tile that makes use of a resource.
To call the resource I use following code
"[resourceId(parameters('analysisServiceResourceGroup'), '/Microsoft.AnalysisServices/servers', parameters('analysisServiceName'))]"
But in one of the tiles I need multiple resources so I tried something out to make a parameter file with following value
"analysisService": {
"value": [
{
"ResourceGroup": "RG",
"Name": "analysis1",
"Color": "#47BDF5"
},
{
"ResourceGroup": "RG",
"Name": "analysis2",
"Color": "#7E58FF"
},
{
"ResourceGroup": "RG",
"Name": "analysis3",
"Color": "#EB9371"
}
]
},
In my dashboard template i use following code to get the name and resource group.
"resourceId": "[resourceId(parameters('analysisService')[copyIndex()].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex()].Name)]"
The problem I got at the moment my copy object is not placed in the right place. I got this error
'The template function 'copyIndex' is not expected at this location. The function can only be used in a resource with copy specified. Please see https://aka.ms/arm-copy for usage details.'"
This says that my copy index block is not used in the right resource bracelet but I don't know where i can place this copy Index , tried to put this in every possible place where the copy index can access this but nothing works does anyone know what I do wrong or what I do wrong. It may be possible that copyindex doesn't work inside a dashboard resource.
Code
"12": {
"position": {
"x": 12,
"y": 9,
"colSpan": 6,
"rowSpan": 4
},
"metadata": {
"inputs": [
{
"name": "sharedTimeRange",
"isOptional": true
},
{
"name": "options",
"value": {
"charts": [
{
"metrics": [
{
"name": "CurrentUserSessions",
"resourceMetadata": {
"resourceId": "[resourceId(parameters('analysisService')[copyIndex()].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex()].Name)]"
},
"aggregationType": 1,
"copy": {
"name": "AnalysisServiceCopy",
"count": "[length(parameters('analysisService'))]"
},
}
],
"title": "Avg Current User Sessions for analysis1, analysis1, and analysis1",
"visualization": {
"chartType": 2,
"legend": {
"isVisible": true,
"position": 2,
"hideSubtitle": false
},
"axis": {
"x": {
"isVisible": true,
"axisType": 2,
"min": 1546508634047,
"max": 1546595034047
},
"y": {
"isVisible": true,
"axisType": 1
}
},
"timeBrushEnable": false
},
"itemDataModel": {
"id": "3464BA29-9AF2-4EAE-9CF4-A246059DDF46",
"chartHeight": 1,
"metrics": [
{
"id": {
"resourceDefinition": {
"id": "[resourceId(parameters('analysisService')[copyIndex()].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex()].Name)]"
},
"name": {
"id": "CurrentUserSessions",
"displayName": "Current User Sessions"
},
"namespace": {
"name": "microsoft.analysisservices/servers"
}
},
"metricAggregation": 4,
"color": "[parameters('analysisService')[copyIndex()].Color]"
,
"copy": {
"name": "AnalysisServiceCopy",
"count": "[length(parameters('analysisService'))]"
},
}
],
"priorPeriod": false,
"horizontalBars": true,
"showOther": false,
"aggregation": 1,
"palette": "multiColor",
"jsonDefinitionId": "59DCE403-7D8D-4E9F-9CDA-7AE7AC9D9220",
"version": {
"major": 1,
"minor": 0,
"build": 0
},
"filters": {
"filterType": 0,
"id": "C81486BB-3934-48C7-9251-A4EE633DB2BB",
"OperandFilters": [],
"LogicalOperator": 0
},
"yAxisOptions": {
"options": 1
},
"title": "Avg Current User Sessions for analysis1, analysis1, and analysis1",
"titleKind": "Auto",
"visualization": {
"chartType": 2,
"legend": {
"isVisible": true,
"position": 2,
"hideSubtitle": false
},
"axis": {
"x": {
"isVisible": true,
"axisType": 2,
"min": 1546508634047,
"max": 1546595034047
},
"y": {
"isVisible": true,
"axisType": 1
}
},
"timeBrushEnable": false
}
}
}
],
"v2charts": true,
"version": 1
},
"isOptional": true
}
],
"type": "Extension/HubsExtension/PartType/MonitorChartPart",
"settings": {
"content": {
"options": {
"charts": [
{
"metrics": [
{
"name": "CurrentUserSessions",
"resourceMetadata": {
"resourceId": "[resourceId(parameters('analysisService')[copyIndex()].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex()].Name)]"
},
"aggregationType": 1
,
"copy": {
"name": "AnalysisServiceCopy",
"count": "[length(parameters('analysisService'))]"
},
}
],
"title": "Avg Current User Sessions for analysis1, analysis1, and analysis1",
"visualization": {
"chartType": 2,
"legend": {
"isVisible": true,
"position": 2,
"hideSubtitle": false
},
"axis": {
"x": {
"isVisible": true,
"axisType": 2,
"min": 1546508634047,
"max": 1546595034047
},
"y": {
"isVisible": true,
"axisType": 1
}
},
"timeBrushEnable": false
},
"itemDataModel": {
"id": "3464BA29-9AF2-4EAE-9CF4-A246059DDF46",
"chartHeight": 1,
"metrics": [
{
"id": {
"resourceDefinition": {
"id": "[resourceId(parameters('analysisService')[copyIndex()].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex()].Name)]"
},
"name": {
"id": "CurrentUserSessions",
"displayName": "Current User Sessions"
},
"namespace": {
"name": "microsoft.analysisservices/servers"
}
},
"metricAggregation": 4,
"color": "[parameters('analysisService')[copyIndex()].Color]"
,
"copy": {
"name": "AnalysisServiceCopy",
"count": "[length(parameters('analysisService'))]"
},
}
],
"priorPeriod": false,
"horizontalBars": true,
"showOther": false,
"aggregation": 1,
"palette": "multiColor",
"jsonDefinitionId": "59DCE403-7D8D-4E9F-9CDA-7AE7AC9D9220",
"version": {
"major": 1,
"minor": 0,
"build": 0
},
"filters": {
"filterType": 0,
"id": "C81486BB-3934-48C7-9251-A4EE633DB2BB",
"OperandFilters": [],
"LogicalOperator": 0
},
"yAxisOptions": {
"options": 1
},
"title": "Avg Current User Sessions for analysis1, analysis1, and analysis1",
"titleKind": "Auto",
"visualization": {
"chartType": 2,
"legend": {
"isVisible": true,
"position": 2,
"hideSubtitle": false
},
"axis": {
"x": {
"isVisible": true,
"axisType": 2,
"min": 1546508634047,
"max": 1546595034047
},
"y": {
"isVisible": true,
"axisType": 1
}
},
"timeBrushEnable": false
}
},
"disablePinning": true
}
],
"v2charts": true,
"version": 1
}
}
}
}
},
"copy": {
"name": "AnalysisServiceCopy",
"count": "[length(parameters('analysisService'))]"
},
so, as a general rule, you can only use copy loop to create arrays, not object, so to construct you metrics array you would do something like this:
"charts": [
{
"copy": [
{
"name": "metrics",
"count": "[length(parameters('analysisService'))]",
"input": {
"name": "CurrentUserSessions",
"resourceMetadata": {
"resourceId": "[resourceId(parameters('analysisService')[copyIndex('metrics')].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex('metrics')].Name)]"
},
"aggregationType": 1
}
}
],
"title": "Avg Current User Sessions for analysis1, analysis1, and analysis1",
"visualization": { redacted for brievity },
"itemDataModel": { redacted for brievity },
"disablePinning": true
}
],
you would need to do this everywhere you need to construct an array. as a workaround (if they are identical) you can use the same construct to create a variable and use that variable:
"variables": {
"copy": [
{
"name": "metrics",
"count": "[length(parameters('analysisService'))]",
"input": {
"name": "CurrentUserSessions",
"resourceMetadata": {
"resourceId": "[resourceId(parameters('analysisService')[copyIndex('metrics')].ResourceGroup, '/Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex('metrics')].Name)]"
},
"aggregationType": 1
}
}
],
}
the above will create a variable called "metrics" which you can use anywhere in the template like so:
"[variables('metrics')]"
#4c74356b41
I tried it like this , I directly get an green error line beneath copy that this varbiable never is used.
"variables": {
"copy": [
{
"name": "metrics",
"count": "[length(parameters('analysisService'))]",
"input": {
"name": "qpu_metric",
"resourceMetadata": {
"resourceId": "[resourceId(parameters('analysisService')[copyIndex('metrics')].ResourceGroup, 'Microsoft.AnalysisServices/servers', parameters('analysisService')[copyIndex('metrics')].Name)]"
},
"aggregationType": 1
}
}
]
},
In my code I call the variable like this
"charts": [
{
"metrics" : "[variables('metrics')]",
"title": "Avg QPU",
"visualization": {

Resources