Skip to content

Commit c028225

Browse files
committed
final update - hurrah
1 parent 0b17cfc commit c028225

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed
88.6 KB
Loading
84.9 KB
Loading
97.5 KB
Loading
28 KB
Loading

articles/stream-analytics/stream-analytics-with-azure-functions.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Before you start, make sure you've completed the following steps:
130130
// Parse items and send to binding
131131
for (var i = 0; i < data.Count; i++)
132132
{
133-
string key = data[i].time + " - " + data[i].callingnum1;
133+
string key = data[i].Time + " - " + data[i].CallingNum1;
134134
135135
db.StringSet(key, data[i].ToString());
136136
log.LogInformation($"Object put in database. Key is {key} and value is {data[i].ToString()}");
@@ -194,18 +194,43 @@ Before you start, make sure you've completed the following steps:
194194
```
195195

196196
6. Start the Stream Analytics job.
197+
7. On the **Monitor** page for your Azure function, you see that the function is invoked.
198+
199+
:::image type="content" source="./media/stream-analytics-with-azure-functions/function-invocations.png" alt-text="Screenshot showing the Minitor page for Azure Functions with function invocations.":::
200+
1. On the **Azure Cache for Redis** page your cache, select **Metrics** on the left menu, add **Cache Write** metric, and set the duration to **last hour**. You see the chart similar to the following image.
201+
202+
:::image type="content" source="./media/stream-analytics-with-azure-functions/redis-cache-write-metric.png" alt-text="Screenshot showing the Metrics page for your Azure Cache for Redis.":::
197203

198204
## Check Azure Cache for Redis for results
199205

200-
1. Browse to the Azure portal, and find your Azure Cache for Redis. Select **Console**.
206+
### Get the key from Azure Functions logs
207+
First, get the key for a record inserted into Azure Cache for Redis. In the code, the key is calculated in the Azure function as shown in the following code snippet:
208+
209+
```csharp
210+
string key = data[i].Time + " - " + data[i].CallingNum1;
201211

202-
2. Use [Azure Cache for Redis commands](https://redis.io/commands) to verify that your data is in Azure Cache for Redis. (The command takes the format Get {key}.) For example:
212+
db.StringSet(key, data[i].ToString());
213+
log.LogInformation($"Object put in database. Key is {key} and value is {data[i].ToString()}");
214+
```
215+
1. Browse to the Azure portal, and find your Azure Functions app.
216+
1. Select **Functions** on the left menu.
217+
1. Select **HTTPTrigger1** from the list of functions.
218+
1. Select **Monitor** on the left menu.
219+
1. Switch to the **Logs** tab.
220+
1. Note down a key from the informational message as shown in the following screenshot. You use this key to find the value in Azure Cache for Redis.
221+
222+
:::image type="content" source="./media/stream-analytics-with-azure-functions/key-azure-functions-log.png" alt-text="Screenshot showing the Monitor Logs page for the Azure function. ":::
223+
224+
### Use the key to find the record in Azure Cache for Redis
225+
226+
1. Browse to the Azure portal, and find your Azure Cache for Redis. Select **Console**.
227+
2. Use [Azure Cache for Redis commands](https://redis.io/commands) to verify that your data is in Azure Cache for Redis. (The command takes the format Get {key}.) Use the key you copied from the Monitor logs for the Azure function (in the previous section).
203228

204-
**Get "12/19/2017 21:32:24 - 123414732"**
229+
**Get "KEY-FROM-THE-PREVIOUS-SECTION"**
205230

206231
This command should print the value for the specified key:
207232

208-
![Screenshot of Azure Cache for Redis output](./media/stream-analytics-with-azure-functions/image5.png)
233+
:::image type="content" source="./media/stream-analytics-with-azure-functions/redis-console.png" alt-text="Screenshot showing the Redit Cache console showing the output of the Get command.":::
209234

210235
## Error handling and retries
211236

0 commit comments

Comments
 (0)