Skip to content

Commit 04d02f3

Browse files
committed
refactoring and add probe variants
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 1290431 commit 04d02f3

File tree

8 files changed

+429
-169
lines changed

8 files changed

+429
-169
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ RUN ./azure-loganalytics-exporter --help
2020
FROM gcr.io/distroless/static
2121
ENV LOG_JSON=1
2222
COPY --from=build /go/src/github.com/webdevops/azure-loganalytics-exporter/azure-loganalytics-exporter /
23-
USER 1000
23+
USER 1000:1000
2424
EXPOSE 8080
2525
ENTRYPOINT ["/azure-loganalytics-exporter"]

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Azure LogAnalytics exporter
55
[![DockerHub](https://img.shields.io/badge/DockerHub-webdevops%2Fazure--loganalytics--exporter-blue)](https://hub.docker.com/r/webdevops/azure-loganalytics-exporter/)
66
[![Quay.io](https://img.shields.io/badge/Quay.io-webdevops%2Fazure--loganalytics--exporter-blue)](https://quay.io/repository/webdevops/azure-loganalytics-exporter)
77

8-
Prometheus exporter for Azure LogAnalytics kusto queries with configurable fields and transformations.
8+
Prometheus exporter for Azure LogAnalytics Kusto queries with configurable fields and transformations.
99

1010
Usage
1111
-----
@@ -18,8 +18,10 @@ Application Options:
1818
--debug debug mode [$DEBUG]
1919
-v, --verbose verbose mode [$VERBOSE]
2020
--log.json Switch log output to json format [$LOG_JSON]
21-
--azure-environment= Azure environment name (default: AZUREPUBLICCLOUD) [$AZURE_ENVIRONMENT]
21+
--azure.environment= Azure environment name (default: AZUREPUBLICCLOUD) [$AZURE_ENVIRONMENT]
2222
--loganalytics.workspace= Loganalytics workspace IDs [$LOGANALYTICS_WORKSPACE]
23+
--loganalytics.parallel= Specifies how many workspaces should be queried in parallel (default: 5)
24+
[$LOGANALYTICS_PARALLEL]
2325
-c, --config= Config path [$CONFIG]
2426
--bind= Server address (default: :8080) [$SERVER_BIND]
2527
@@ -40,13 +42,43 @@ HTTP Endpoints
4042
| Endpoint | Description |
4143
|--------------------------------|-------------------------------------------------------------------------------------|
4244
| `/metrics` | Default prometheus golang metrics |
43-
| `/probe` | Execute loganalytics queries without set module name |
44-
| `/probe?module=xzy` | Execute loganalytics queries for module `xzy` |
45-
| `/probe?module=xzy&cache=2m` | Execute loganalytics queries for module `xzy` and enable caching for 2 minutes |
45+
| `/probe` | Execute loganalytics queries against workspaces (set on commandline/env var) |
46+
| `/probe/workspace` | Execute loganalytics queries against workspaces (defined as parameter) |
47+
| `/probe/subscription` | Execute loganalytics queries against workspaces (using servicediscovery) |
48+
49+
HINT: parameters of type `multiple` can be either specified multiple times and/or splits multiple values by comma.
50+
51+
#### /probe parameters
52+
53+
| GET parameter | Default | Required | Multiple | Description |
54+
|------------------------|---------------------------|----------|----------|----------------------------------------------------------------------|
55+
| `module` | | no | no | Filter queries by module name |
56+
| `cache` | | no | no | Use of internal metrics caching (time.Duration) |
57+
| `parallel` | `$LOGANALYTICS_PARALLEL` | no | no | Number (int) of how many workspaces can be queried at the same time |
58+
59+
#### /probe/workspace parameters
60+
61+
| GET parameter | Default | Required | Multiple | Description |
62+
|------------------------|---------------------------|----------|----------|----------------------------------------------------------------------|
63+
| `module` | | no | no | Filter queries by module name |
64+
| `workspace` | | **yes** | yes | Workspace IDs which are probed |
65+
| `cache` | | no | no | Use of internal metrics caching (time.Duration) |
66+
| `parallel` | `$LOGANALYTICS_PARALLEL` | no | no | Number (int) of how many workspaces can be queried at the same time |
67+
68+
#### /probe/subscription parameters
69+
70+
| GET parameter | Default | Required | Multiple | Description |
71+
|------------------------|---------------------------|----------|----------|----------------------------------------------------------------------|
72+
| `module` | | no | no | Filter queries by module name |
73+
| `subscription` | | **yes** | yes | Uses all workspaces inside subscription |
74+
| `cache` | | no | no | Use of internal metrics caching (time.Duration) |
75+
| `parallel` | `$LOGANALYTICS_PARALLEL` | no | no | Number (int) of how many workspaces can be queried at the same time |
4676

4777
Global metrics
4878
--------------
4979

80+
available on `/metrics`
81+
5082
| Metric | Description |
5183
|--------------------------------------|--------------------------------------------------------------------------------|
5284
| `azure_loganalytics_query_time` | Summary metric about query execution time (incl. all subqueries) |

config/opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type (
1616

1717
// azure
1818
Azure struct {
19-
Environment *string `long:"azure-environment" env:"AZURE_ENVIRONMENT" description:"Azure environment name" default:"AZUREPUBLICCLOUD"`
19+
Environment *string `long:"azure.environment" env:"AZURE_ENVIRONMENT" description:"Azure environment name" default:"AZUREPUBLICCLOUD"`
2020
}
2121

2222
Loganalytics struct {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/webdevops/azure-loganalytics-exporter
22

3-
go 1.15
3+
go 1.16
44

55
require (
66
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible

0 commit comments

Comments
 (0)