Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinbuss committed May 27, 2024
2 parents 6e42be4 + 464d6d7 commit 6c27455
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 12 deletions.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# timeseries-data-explorer
# Timeseries Data Explorer

## Instructions for deployment

### Prerequisites

Install the following tools on your device:

- Azure CLI
- Azure Subscription
- Terraform

### Azure CLI configuration

Configure Azure CLI on your device by runnin the follwing commands:

```sh
# Login to Azure
az login

# Set azure account
az account set --subscription "<your-subscription-id>"

# Configure CLI
az config set extension.use_dynamic_install=yes_without_prompt
```

### Update Variables

Open the [`code\infra\vars.tfvars`](code\infra\vars.tfvars) file and update the prefix and location parameters:

```hcl
location = "<your-location>"
environment = "dev"
prefix = "<your-prefix-value>"
tags = {}
...
```

### Terraform deployment (local backend)

Deploy the Terraform configuration using the following commands:

```sh
# Move terraform_override.tf file
move .\utilities\terraformConfigSamples\* .\code\infra\

# Change directory
cd .\code\infra\

# Terraform init
terraform init

# Terraform plan
terraform plan -var-file="vars.tfvars"

# Terraform apply
terraform apply -var-file="vars.tfvars"
```

You successfully deployed the setup!
20 changes: 10 additions & 10 deletions code/datamodel/operationaldb.kql
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@
)

// Create function
.create-or-alter function with (docstring = 'Function to get latest threshold value for named threshold', folder='thresholds') GetThreshold(valueName: string) {
toscalar(
thresholds
| where name == valueName
| order by timestamp desc
| limit 1
| summarize max(value)
)
}

.create-or-alter function with (docstring = 'Function to get average happiness scores for iptv data', folder='iptv') IptvGetAvgHappinessScore() {
let currentTimestamp = now();
let movingWindowInMinutes = GetThreshold('movingWindowInMinutes');
Expand Down Expand Up @@ -179,16 +189,6 @@
| project-away SumTotalHappiness
}

.create-or-alter function with (docstring = 'Function to get latest threshold value for named threshold', folder='thresholds') GetThreshold(valueName: string) {
toscalar(
thresholds
| where name == valueName
| order by timestamp desc
| limit 1
| summarize max(value)
)
}

////////////////////////////////////////////////
// Create materialized view and view for testing
////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion code/infra/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.103.1"
version = "3.105.0"
}
time = {
source = "hashicorp/time"
Expand Down

0 comments on commit 6c27455

Please sign in to comment.