Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ To enable [Grafana Cloud Application Observability](https://grafana.com/docs/gra
2. Click on **Enable metrics generation** to enable the usage of Application Observability.
3. Interact with the QuickPizza app to generate traffic. After a few minutes, the QuickPizza components will be automatically discovered and displayed in the UI.

![Application Observability](./docs/images/grafana-cloud-application-application-observability-quickpizza.png)
![Application Observability](./docs/images/grafana-cloud-application-observability.png)

![Application Observability - Public API Service](./docs/images/grafana-cloud-application-observability-public-api-svc.png)

To enable [Grafana Cloud Frontend Observability](https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/):

Expand Down
137 changes: 120 additions & 17 deletions alloy/cloud.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,140 @@ pyroscope.scrape "application_containers" {

// Traces
otelcol.receiver.otlp "default" {
grpc {
endpoint = "0.0.0.0:4317"
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/

// configures the default grpc endpoint "0.0.0.0:4317"
grpc { }
// configures the default http/protobuf endpoint "0.0.0.0:4318"
http { }

output {
metrics = [otelcol.processor.resourcedetection.default.input]
logs = [otelcol.processor.resourcedetection.default.input]
traces = [otelcol.processor.resourcedetection.default.input]
}

http {
endpoint = "0.0.0.0:4318"
}

otelcol.processor.resourcedetection "default" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.resourcedetection/
detectors = ["env", "system"] // add "gcp", "ec2", "ecs", "elastic_beanstalk", "eks", "lambda", "azure", "aks", "consul", "heroku" if you want to use cloud resource detection

system {
hostname_sources = ["os"]
}


output {
metrics = [otelcol.processor.transform.drop_unneeded_resource_attributes.input]
logs = [otelcol.processor.transform.drop_unneeded_resource_attributes.input]
traces = [otelcol.processor.transform.drop_unneeded_resource_attributes.input]
}
}

otelcol.processor.transform "drop_unneeded_resource_attributes" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/
error_mode = "ignore"

trace_statements {
context = "resource"
statements = [
"delete_key(attributes, \"k8s.pod.start_time\")",
"delete_key(attributes, \"os.description\")",
"delete_key(attributes, \"os.type\")",
"delete_key(attributes, \"process.command_args\")",
"delete_key(attributes, \"process.executable.path\")",
"delete_key(attributes, \"process.pid\")",
"delete_key(attributes, \"process.runtime.description\")",
"delete_key(attributes, \"process.runtime.name\")",
"delete_key(attributes, \"process.runtime.version\")",
]
}

metric_statements {
context = "resource"
statements = [
"delete_key(attributes, \"k8s.pod.start_time\")",
"delete_key(attributes, \"os.description\")",
"delete_key(attributes, \"os.type\")",
"delete_key(attributes, \"process.command_args\")",
"delete_key(attributes, \"process.executable.path\")",
"delete_key(attributes, \"process.pid\")",
"delete_key(attributes, \"process.runtime.description\")",
"delete_key(attributes, \"process.runtime.name\")",
"delete_key(attributes, \"process.runtime.version\")",
]
}

log_statements {
context = "resource"
statements = [
"delete_key(attributes, \"k8s.pod.start_time\")",
"delete_key(attributes, \"os.description\")",
"delete_key(attributes, \"os.type\")",
"delete_key(attributes, \"process.command_args\")",
"delete_key(attributes, \"process.executable.path\")",
"delete_key(attributes, \"process.pid\")",
"delete_key(attributes, \"process.runtime.description\")",
"delete_key(attributes, \"process.runtime.name\")",
"delete_key(attributes, \"process.runtime.version\")",
]
}

output {
metrics = [otelcol.processor.transform.add_resource_attributes_as_metric_attributes.input]
logs = [otelcol.processor.batch.default.input]
traces = [
otelcol.processor.batch.default.input,
otelcol.connector.host_info.default.input,
otelcol.processor.batch.default.input,
otelcol.connector.host_info.default.input,
]
}
}

otelcol.connector.host_info "default" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.connector.host_info/
host_identifiers = ["container.name", "container.id", "service.name"]
metrics_flush_interval = "10s"


output {
metrics = [otelcol.exporter.prometheus.otlp_metrics.input]
metrics = [otelcol.processor.batch.default.input]
}
}
otelcol.exporter.prometheus "otlp_metrics" {
forward_to = [
grafana_cloud.stack.receivers.metrics,
]

otelcol.processor.transform "add_resource_attributes_as_metric_attributes" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/
error_mode = "ignore"

metric_statements {
context = "datapoint"
statements = [
"set(attributes[\"deployment.environment\"], resource.attributes[\"deployment.environment\"])",
"set(attributes[\"service.version\"], resource.attributes[\"service.version\"])",
]
}

output {
metrics = [otelcol.processor.batch.default.input]
}
}

otelcol.processor.batch "default" {
// https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.batch/
output {
traces = [grafana_cloud.stack.receivers.traces]
metrics = [otelcol.exporter.otlphttp.otlpEndpoint.input]
logs = [otelcol.exporter.otlphttp.otlpEndpoint.input]
traces = [otelcol.exporter.otlphttp.otlpEndpoint.input]
}
}

otelcol.auth.basic "otlpEndpoint" {
// Grafana Cloud Instance ID.
username = grafana_cloud.stack.receivers.info["id"]
password = env("GRAFANA_CLOUD_TOKEN")
}

otelcol.exporter.otlphttp "otlpEndpoint" {
client {
// FR: gcom API to return the Grafana Cloud OTLP endpoint
endpoint = "https://otlp-gateway-"+ grafana_cloud.stack.receivers.info["regionSlug"] + ".grafana.net/otlp"
// https://github.com/grafana/beyla/blob/069049182455db603f3bda6865e7de13e45e038f/pkg/export/otel/common.go#L22
auth = otelcol.auth.basic.otlpEndpoint.handler
}
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ You should now be able to access the application on port `3333` in the IP addres

To collect telemetry data, use one of the following setups:

- Use [`kubernetes/cloud-stack`](./cloud-stack/) to send telemetry data to Grafana Cloud with a cloud access policy.
- Use [`kubernetes/cloud-otlp`](./cloud-otlp/) to send telemetry data to Grafana Cloud via the OTLP endpoint.
- Use [`kubernetes/cloud`](./cloud/) to send telemetry data to Grafana Cloud.
- Use [`kubernetes/cloud-testing`](./cloud-testing/) to implement your custom setup.

Before deployment:

Expand Down
163 changes: 0 additions & 163 deletions kubernetes/cloud-k8s-monitoring/config/config.alloy

This file was deleted.

34 changes: 0 additions & 34 deletions kubernetes/cloud-k8s-monitoring/kustomization.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions kubernetes/cloud-otlp/.env.local

This file was deleted.

Loading