I was wondering if my scenario is possible with the Grafana extension JSON API.
I am displaying in my Grafana dashboard the result from my Application Insights kusto query. The table in my dashboard currently has two columns with timestamp and a serial number.
I would like to add a third column to my table e.g. name. I.e. I have to request an external API, use per row the serial number displayed there and wait for the result of the API request. In the return value of my API is my needed value for column 3.
Anyone here have experience with extending Grafana with JSON API to request values dynamically?
Related
I am using Grafana 9.3.1 for monitoring of our system. Among other things, I am trying to monitor the remaining FUP of a phone number for each unit we operate.
Basically, we intend to use two data sources.
Database mapping of the unit ID to its phone number (e.g. "unit_id=123, phone_number="00 123456789")
Prometheus time series remaining_fup{phone_number="00 123456789"}. However, remaining_fup is a 3rd party data and does not include unit_id.
In my unit-detail dashboard I have unit_id variable which indicates which unit FUP should be displayed (among other things depending on unit_id)
My original approach was this:
Create a mixed datasource dashboard
Add database datasource as data A. SELECT phone_number FROM units WHERE unit_id='$unit_id'
Add prometheus datasource remaining_fup and filter it based on A.phone_number: remaining_fup{phone_number="${A.phone_number}"}
Unfortunatelly such use of A isn't supported. I used to hope for applying some transformation like Merge or Join by field and then Filter but with no success. After a lot of googling and trying I feel hopeless.
Could you help please? Is such filter even possible? Thanks!
TL;DR: In grafana dashboard I want to query one datasource in order to obtain a value which I subsequently want to use in another datasource query.
1.) Create variable - name phone_number, type: Query and query your database datasource SELECT phone_number FROM units WHERE unit_id='$unit_id'. You can hide this variable if you don't want it to be visible for the dashboard users.
2.) Variable phone_number may have multiple values, so use advance variable formatting to create valid regex query syntax for your prometheus datasource, e.g.
remaining_fup{phone_number=~"${phone_number:pipe}"}
Of course this queries are just examples and they may need some (syntax) tweaking for the use case. Main idea: don't use 2 queries, but one variable and one query (where you use that variable).
So, I am creating a Copy activity that reads from SQL Server table and have to send the data to an API end point with the PATCH request.
API provider specified that the body must be in the form of
"updates":[{"key1":"value1","key2":"value2","key3":"value3" },
{"key1":"value1","key2":"value2","key3":"value3" }, ...
.... {"key1":"value1","key2":"value2","key3":"value3" }]
However, my sql table maps to json this way (without the wrapper 'updates:')
[{"key1":"value1","key2":"value2","key3":"value3" },
{"key1":"value1","key2":"value2","key3":"value3" }, ...
.... {"key1":"value1","key2":"value2","key3":"value3" }]
I use the copy activity with the sink data set being of type Rest ..
How can we modify the mapping, so that schema gets wrapped by "updates" object ?
Using copy data activity, there might not be any possibility to wrap the data (array of objects) to an updates key.
To do this, I have used a lookup activity to get the data, set variable activity to wrap the data with an updates object key and finally, use Web activity with PATCH method and above variable value as body to complete the activity.
The following is the sample data I have taken for my SQL server table.
Use look up activity to select the data from this table using table or query option (I used query option). The debug output would be as follows:
NOTE: If your data is not same as in sample table I have taken, try using the query option so the output would be something as shown below
In the set variable activity, I have used an array variable and used the following dynamic content to wrap the above array of objects with updates key.
#array(json(concat('{"updates":',string(activity('Lookup1').output.value),'}')))
Now in the Web activity, choose all the necessary settings (PATCH method, authorizations, headers, URL, etc.,) and give the body as follows (I used a fake REST api as a demo):
#variables('tp')[0]
Since I am using the Fake REST API, the activity succeeds, but checking the Web activity debug input shows what is the body that is being passed to the Rest API. The following is an image for reference:
I want to Extract tables in PDF file and insert that data into output sink ( CSV \ Azure SQL etc )
I have tried below things
Analyze custom pdf document using Form Recognizer General document as I just want to scrape Tables
Call "Get Analyze Result" REST API from ADF to get Table Array
Now I want to loop through every Table and Cells and insert data into Azure SQL table
How do I achieve this effectively ?
One way I see is , use JSON parsing along with Looping mechanism in ADF to transform Form Recognizer output row by row
Note : I have checked this post already
Extract PDF table data using Azure Form Recognizer
You should be able to achieve this using the cognitive services API with the external call transformation: https://youtu.be/r22nthp-f4g?t=400
I am using smartsheet as a database and I want to query the smartsheet by column name equals value like in sql db for example: To get the particular row of Employee sheet where salary equal to 10000. But documentation describes only how to get list of rows and how to update and delete rows by row id.
https://smartsheet-platform.github.io/api-docs/?java
What i want is to achieve without knowing id of the row. But I can do by search function by searching the salary of the employee
https://api.smartsheet.com/2.0/search?query=10000
and the response of above call will have row id and again i should make a call with rowid to get that row by below call which I don't want.
GET /sheets/{sheetId}/rows/{rowId}
Can anyone help me out?
Although some folks do try to use Smartsheet like a database, it's not really designed to be queried via API in the same way that you'd use transact SQL to query a SQL database.
I don't believe the scenario that you've described (i.e., using the Smartsheet API to retrieve row(s) in a sheet where [column value] = [specified value]) is possible. Instead, you'll have to use the API to get the data in the sheet (Get Sheet) and then in your code, query the data that you received in the API response (to identify the row(s) that match your query criteria).
I use Oracle RightNow via SOAP API.
Using QueryCSV option, I can get a lot of information (E.g.: about an incident SELECT * FROM Incident WHERE ...), but I don't know how to get information about Outreach Activity.
I saw on the RightNow forum that I could get this kind of information from ma_trans table, but I don't know how to select data from this table.
Outreach Activity tab that should show data from the ma_trans table
I tried different approaches, but I always get responses like this:
Request:
SELECT * FROM ma_trans
Response:
...
<n0:RequestErrorFault xmlns:n0="urn:faults.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<n0:exceptionCode>INVALID_REQUEST</n0:exceptionCode>
<n0:exceptionMessage>no such table: ma_trans</n0:exceptionMessage>
</n0:RequestErrorFault>
...
or
Request:
SELECT Contact.ma_trans FROM Contact
Response:
...
<n0:RequestErrorFault xmlns:n0="urn:faults.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<n0:exceptionCode>INVALID_REQUEST</n0:exceptionCode>
<n0:exceptionMessage>Non-existent column: 'ma_trans'</n0:exceptionMessage>
</n0:RequestErrorFault>
...
How can I get information about Outreach Activity and how can I get data from this ma_trans table?
The ma_trans table is not exposed through the Connect Object Model or ROQL. transactions is exposed through ROQL, as well as some of the other "managed tables", which you can view in any of the documentation for services that expose connect APIs (i.e. the PHP, SOAP, REST, etc. APIs).
You could get this data by creating a report to query for the data that you need, and then use the runAnalyticsReport method to get data from the report. But, since ma_trans can contain a lot of data, be sure that your report is filtered properly as to not extend beyond run time or data threshold limits.