-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new modules with import and declare keywords.
- Loading branch information
Showing
60 changed files
with
3,357 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
declare "myModule" { | ||
argument "scrape_endpoint" {} | ||
|
||
argument "forward_to" {} | ||
|
||
argument "scrape_interval" { | ||
optional = true | ||
default = "1s" | ||
} | ||
|
||
prometheus.scrape "scrape_prom_metrics_module_file" { | ||
targets = [ | ||
{"__address__" = argument.scrape_endpoint.value}, | ||
] | ||
forward_to = argument.forward_to.value | ||
scrape_classic_histograms = true | ||
enable_protobuf_negotiation = true | ||
scrape_interval = argument.scrape_interval.value | ||
scrape_timeout = "500ms" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import.file "import_loki" { | ||
filename = "loki.river" | ||
} | ||
|
||
import_loki.loki "loki" {} | ||
|
||
import.file "import_prom_scrape" { | ||
filename = "prom-scrape.river" | ||
} | ||
|
||
declare "target" { | ||
export "output" { | ||
value = "localhost:9001" | ||
} | ||
} | ||
|
||
target "promTarget" {} | ||
|
||
import_prom_scrape.scrape "promScraper" { | ||
scrape_endpoint = target.promTarget.output | ||
forward_to = [prometheus.remote_write.module_file.receiver] | ||
} | ||
|
||
prometheus.remote_write "module_file" { | ||
endpoint { | ||
url = "http://localhost:9009/api/v1/push" | ||
send_native_histograms = true | ||
metadata_config { | ||
send_interval = "1s" | ||
} | ||
queue_config { | ||
max_samples_per_send = 100 | ||
} | ||
} | ||
external_labels = { | ||
test_name = "module_file", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare "getLogFile" { | ||
export "output" { | ||
value = [{__path__ = "logs.txt"}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[2023-10-02 14:25:43] INFO: Starting the web application... | ||
[2023-10-02 14:25:45] DEBUG: Database connection established. | ||
[2023-10-02 14:26:01] INFO: User 'john_doe' logged in. | ||
[2023-10-02 14:26:05] WARNING: User 'john_doe' attempted to access restricted area. | ||
[2023-10-02 14:26:10] ERROR: Failed to retrieve data for item ID: 1234. | ||
[2023-10-02 14:26:15] INFO: User 'john_doe' logged out. | ||
[2023-10-02 14:27:00] INFO: User 'admin' logged in. | ||
[2023-10-02 14:27:05] INFO: Data backup started. | ||
[2023-10-02 14:30:00] INFO: Data backup completed successfully. | ||
[2023-10-02 14:31:23] ERROR: Database connection lost. Retrying in 5 seconds... | ||
[2023-10-02 14:31:28] INFO: Database reconnected. | ||
[2023-10-02 14:32:00] INFO: User 'admin' logged out. | ||
[2023-10-02 14:32:05] INFO: Shutting down the web application... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import.file "logTarget" { | ||
filename = "logfile.river" | ||
} | ||
|
||
import.file "write" { | ||
filename = "loki_write.river" | ||
} | ||
|
||
declare "loki" { | ||
logTarget.getLogFile "logFile" {} | ||
loki.source.file "test" { | ||
targets = logTarget.getLogFile.logFile.output | ||
forward_to = [write.loki_write.default.receiver] | ||
} | ||
write.loki_write "default" {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
declare "loki_write" { | ||
loki.write "test" { | ||
endpoint { | ||
url = "http://localhost:3100/loki/api/v1/push" | ||
} | ||
external_labels = { | ||
test_name = "module_file", | ||
} | ||
} | ||
export "receiver" { | ||
value = loki.write.test.receiver | ||
} | ||
} |
Oops, something went wrong.