Skip to content

feat: receive-otlp relation for OTLP logs#95

Draft
MichaelThamm wants to merge 5 commits intomainfrom
feat/otlp-lib
Draft

feat: receive-otlp relation for OTLP logs#95
MichaelThamm wants to merge 5 commits intomainfrom
feat/otlp-lib

Conversation

@MichaelThamm
Copy link
Contributor

@MichaelThamm MichaelThamm commented Oct 9, 2025

Checklist

  • PR title makes an appropriate release note and follows conventional commits syntax.
  • Merge target is the correct branch, and relevant tandem backport PRs opened.
  • mention to IS about the potential for scaled otelcol not loadbalancing with ingress. Let us know if so

Issue

We need a receive-otlp integration so we can receive OTLP LogRecords.

Solution

Loki supports logs at LOKI:3100/otlp.

Building on the work (AKA copying over the code) done in:

requires these changes to Loki:

  1. Update the nginx.conf so that
location = /otlp/v1/logs {
    set $backend http://write;
    proxy_pass $backend;
    proxy_connect_timeout 5s;
}
  1. Implement the library
self._otlp = OtlpProvider(self)
self._otlp.add_endpoint(ProtocolType.http, f"{self.external_url}/otlp", [TelemetryType.logs])
self._otlp.publish()

Testing Instructions

image
  1. terraform apply Loki standalone
terraform {
  required_version = ">= 1.5"
  required_providers {
    juju = {
      source  = "juju/juju"
      version = "~> 1.0"
    }
  }
}

resource "juju_model" "coordinated-worker" {
  name = "loki-standalone"
}

module "loki" {
  source            = "git::https://github.com/canonical/observability-stack//terraform/loki"
  model_uuid        = juju_model.coordinated-worker.uuid
  channel           = "dev/edge"
  s3_endpoint       = "http://S3_ENDPOINT:8333" # Seaweed
  s3_secret_key     = "placeholder"
  s3_access_key     = "placeholder"
  coordinator_units = 1
  backend_units     = 1
  read_units        = 1
  write_units       = 1
}
  1. charmcraft pack loki-coordinator
  2. juju refresh loki --path ./loki-coordinator-k8s_ubuntu@24.04-amd64.charm
  3. jd opentelemetry-collector-k8s --trust --channel "dev/edge" otelcol (assuming it has the OTLP feature)
  4. jd traefik-k8s traefik --trust --channel latest/edge
  5. jd grafana-k8s grafana --trust --channel dev/edge
  6. jrel otelcol loki:receive-otlp
  7. jrel traefik otelcol:ingress
  8. jrel grafana loki:grafana-source
  9. Check logs in Grafana from opentelemetry-collector charm
image

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.

2 participants