String Split function in MQL

33 views
Skip to first unread message

Chavya Khanna

unread,
May 20, 2022, 7:28:51 PM5/20/22
to Google Stackdriver Discussion Forum
Hello All,

Was hoping if someone could assist if there's a feature by which we can use String Split function within MQL.

Use case which i have is to Display Payload data into Multiple fields based on the delimiter:

[{"storeKey":12965,"routeKey":80,"statusFlag":"\u0000","insertTimestamp":null,"updateTimestamp":null,"userName":"Yin Lam Tze Ting","route":{"routeKey":80,"cfLocationKey":1,"name":"GTA Fedex","courierName":"Fedex","statusFlag":"Y","type":"R","holidayKey":null,"effStartTimestamp":1614630157000,"effEndTimestamp":1614630050000,"insertTimestamp":1614612050000,"updateTimestamp":1617994801000,"userName":null},"store":{"storeKey":12965,"storeId":"2965","divisionCd":null,"tradeName":"No Name 2965","legalName":null,"status":null,"concept":null,"addrLineOne":"2965 ave","addrLineTwo":null,"city":"Vancouver","postalCd":"T3R 1T8","provinceCd":"QC","countryCd":"CA","phoneNum":"587-619-0000","faxNum":"587-619-0894","email":"2965@ google .ca","uri":null,"preferredLang":null,"contactName":"Hello 2965","contactPosition":"ASSOCIATE","userName":null,"timeZone":"Canada/Eastern","insertTimestamp":1634256973000,"updateTimestamp":1634256973000,"businessHours":null}},{"storeKey":12965,"routeKey":85,"statusFlag":"\u0000","insertTimestamp":null,"updateTimestamp":null,"userName":"Yin Lam Tze Ting","route":{"routeKey":85,"cfLocationKey":1,"name":"GTA Speedia","courierName":"Speedia","statusFlag":"Y","type":"R","holidayKey":null,"effStartTimestamp":1619471901000,"effEndTimestamp":1619471901000,"insertTimestamp":null,"updateTimestamp":1619457502000,"userName":"Ankita Sharman"},"store":{"storeKey":12965,"storeId":"2965","divisionCd":null,"tradeName":" No Name   2965","legalName":null,"status":null,"concept":null,"addrLineOne":"2965 ave","addrLineTwo":null,"city":"Toronto","postalCd":"T3R 1T8","provinceCd":"QC","countryCd":"CA","phoneNum":"587-619-0000","faxNum":"587-619-0000","email":"29...@google.ca","uri":null,"preferredLang":null,"contactName":"Hello 2965","contactPosition":"ASSOCIATE","userName":null,"timeZone":"Canada/Eastern","insertTimestamp":1634256973000,"updateTimestamp":1634256973000,"businessHours":null}},{"storeKey":12965,"routeKey":115,"statusFlag":"\u0000","insertTimestamp":null,"updateTimestamp":null,"userName":"Yin Lam Tze Ting","route":{"routeKey":115,"cfLocationKey":1,"name":"Hebria Route","courierName":"Hebridex","statusFlag":"Y","type":"R","holidayKey":null,"effStartTimestamp":1618964113000,"effEndTimestamp":1618964113000,"insertTimestamp":1618949714000,"updateTimestamp":1618949714000,"userName":"Hello World"},"store":{"storeKey":12965,"storeId":"2965","divisionCd":null,"tradeName":" No Name  2965","legalName":null,"status":null,"concept":null,"addrLineOne":"2965 ave","addrLineTwo":null,"city":"Toronto","postalCd":"T3R 1T8","provinceCd":"QC","countryCd":"CA","phoneNum":"587-619-0843","faxNum":"587-619-0000","email":"2965@ google.ca","uri":null,"preferredLang":null,"contactName":"Hello 0000","contactPosition":"ASSOCIATE","userName":null,"timeZone":"Canada/Eastern","insertTimestamp":1634256973000,"updateTimestamp":1634256973000,"businessHours":null}},{"storeKey":12965,"routeKey":167,"statusFlag":"\u0000","insertTimestamp":null,"updateTimestamp":null,"userName":"Yin Lam Tze Ting","route":{"routeKey":167,"cfLocationKey":1,"name":"GKE test","courierName":"UPC","statusFlag":"Y","type":"R","holidayKey":null,"effStartTimestamp":1652130945000,"effEndTimestamp":1652130945000,"insertTimestamp":1652116546000,"updateTimestamp":1652116546000,"userName":"Runaz Kabira"},"store":{"storeKey":12965,"storeId":"2965","divisionCd":null,"tradeName":"No Name 2965","legalName":null,"status":null,"concept":null,"addrLineOne":"2965 ave","addrLineTwo":null,"city":"Toronto","postalCd":"T3R 1T8","provinceCd":"QC","countryCd":"CA","phoneNum":"587-619-0000","faxNum":"587-619-0000","email":"2965@ google.ca","uri":null,"preferredLang":null,"contactName":"Hello 2965","contactPosition":"ASSOCIATE","userName":null,"timeZone":"Canada/Eastern","insertTimestamp":1634256973000,"updateTimestamp":1634256973000,"businessHours":null}}]"}


If i am not wrong MQL does not accept Standard Sql formats? If so then do we have some examples on how  Standard SQL Is being used in MQL

Regards,


Igor Peshansky

unread,
May 20, 2022, 7:41:19 PM5/20/22
to Chavya Khanna, Google Stackdriver Discussion Forum
This looks like structured JSON data (with some extra characters at the end). In general, you cannot split nested data like this using regular expressions, which is the most that MQL would offer you. Can you give an example of the fields you'd want to extract from your payload, and where they would appear in your metrics? Also, MQL is for querying the Monitoring API — how does this payload get propagated into the Monitoring API anyway?
        Igor

--
© 2021 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/7f09ca61-f2c1-43b6-bae2-73231234043an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages