Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imrpove Alloy integrations #102

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Imrpove Alloy integrations #102

merged 1 commit into from
Apr 15, 2024

Conversation

qclaogui
Copy link
Owner

@qclaogui qclaogui commented Apr 15, 2024

Imrpove Alloy integrations

Example alloy config: all-in-one.alloy

logging {
	level  = coalesce(env("ALLOY_LOG_LEVEL"), "info")
	format = "logfmt"
}

/********************************************
 * Grafana LGTMP Stack Receiver Provider
 ********************************************/
import.git "provider" {
 	repository     = "https://github.com/qclaogui/codelab-monitoring.git"
 	revision       = "main"
 	path           = "alloy-modules/provider"
 	pull_frequency = "24h"
}

// get self hosted receivers provider
provider.self_hosted_stack "compose" {
	logs_endpoint_url     = "http://gateway:3100/loki/api/v1/push"
	metrics_endpoint_url  = "http://gateway:8080/api/v1/push"
	traces_endpoint_url   = "http://gateway:4318"
	profiles_endpoint_url = "http://gateway:4040"
}

/********************************************
 * Metrics
 ********************************************/
import.file "metrics" {
	filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics"
}

metrics.labels_scrape "compose" {
	label_prefix    = "metrics.grafana.com"
	forward_to      = [provider.self_hosted_stack.compose.metrics_receiver]
	scrape_interval = "15s"
}

metrics.jobs_scrape "compose" {
	forward_to      = [provider.self_hosted_stack.compose.metrics_receiver]
	scrape_interval = "15s"
}

+metrics.integrations_scrape "compose" {
+	forward_to      = [provider.self_hosted_stack.compose.metrics_receiver]
+	scrape_interval = "15s"
+}

/********************************************
 * Logs
 ********************************************/
import.file "logs" {
	filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/logs"
}

logs.labels_scrape "compose" {
	label_prefix = "logs.grafana.com"
	forward_to   = [logs.keep_labels.compose.receiver]
}

// logs Processing And Transformation
logs.keep_labels "compose" {
	forward_to = [provider.self_hosted_stack.compose.logs_receiver]
}

/********************************************
 * Traces
 ********************************************/
import.file "traces" {
	filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/traces"
}

// traces Processing And Transformation process_and_transform
traces.process_and_transform "compose" {
	metrics_forward_to = [provider.self_hosted_stack.compose.metrics_receiver]
	logs_forward_to    = [provider.self_hosted_stack.compose.logs_receiver]
	traces_forward_to  = [provider.self_hosted_stack.compose.traces_receiver]
}

tracing {
	// Write all spans. Don't do this in production!
	sampling_fraction = 1

	// Forward Alloy internal spans to traces process.
	write_to = [traces.process_and_transform.compose.alloy_traces_input]
}

/********************************************
 * Profiles
 ********************************************/
import.file "profiles" {
	filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/profiles"
}

profiles.labels_scrape "compose" {
	label_prefix = "profiles.grafana.com"
	forward_to   = [provider.self_hosted_stack.compose.profiles_receiver]
}

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

Imrpove Alloy integrations

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

Imrpove Alloy integrations

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

Imrpove Alloy integrations

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

Imrpove Alloy integrations

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

Update all-in-one.alloy
@qclaogui qclaogui merged commit bea35b8 into main Apr 15, 2024
2 checks passed
@qclaogui qclaogui deleted the alloy-integrations branch April 15, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant