Skip to content

Commit

Permalink
Add logging to LGTM container
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Feb 6, 2025
1 parent f47e0f5 commit 80eabdf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.Duration;

import io.quarkus.observability.common.ContainerConstants;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.smallrye.config.WithDefault;

Expand All @@ -23,7 +24,7 @@ public interface GrafanaConfig extends ContainerConfig {
/**
* The port of the Grafana container.
*/
@WithDefault("3000")
@WithDefault("" + ContainerConstants.GRAFANA_PORT)
int grafanaPort();

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.quarkus.observability.common.config;

public enum LgtmComponent {
GRAFANA,
LOKI,
PROMETHEUS,
TEMPO,
OTELCOL,
ALL
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public interface LgtmConfig extends GrafanaConfig {
// which is the default in OTEL exporter,
// where we want http as a default with LGTM

/**
* Set of components to log.
* Comma separated set of components whose container log we want to output.
*
* @return set of components to log
*/
Optional<Set<LgtmComponent>> logging();

/**
* The LGTM's OTLP protocol.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import io.quarkus.observability.common.ContainerConstants;
import io.quarkus.observability.common.config.AbstractGrafanaConfig;
import io.quarkus.observability.common.config.LgtmComponent;
import io.quarkus.observability.common.config.LgtmConfig;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.utilities.OS;
Expand Down Expand Up @@ -102,6 +103,9 @@ public LgtmContainer(LgtmConfig config, boolean scrapingRequired) {
// always expose both -- since the LGTM image already does that as well
addExposedPorts(ContainerConstants.OTEL_GRPC_EXPORTER_PORT, ContainerConstants.OTEL_HTTP_EXPORTER_PORT);

Optional<Set<LgtmComponent>> logging = config.logging();
logging.ifPresent(set -> set.forEach(l -> withEnv("ENABLE_LOGS_" + l.name(), "true")));

// Replacing bundled dashboards with our own
addFileToContainer(DASHBOARDS_CONFIG.getBytes(),
"/otel-lgtm/grafana/conf/provisioning/dashboards/grafana-dashboards.yaml");
Expand Down Expand Up @@ -202,6 +206,11 @@ public Optional<Set<String>> networkAliases() {
return Optional.of(Set.of("lgtm", LGTM_NETWORK_ALIAS));
}

@Override
public Optional<Set<LgtmComponent>> logging() {
return Optional.empty();
}

@Override
public String otlpProtocol() {
return ContainerConstants.OTEL_HTTP_PROTOCOL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ quarkus.micrometer.export.otlp.default-registry=true
%prod.quarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4318

#quarkus.observability.lgtm.image-name=grafana/otel-lgtm
#quarkus.observability.lgtm.logging=ALL

0 comments on commit 80eabdf

Please sign in to comment.