Configuring Open telemetry with Quarkus native and Skywalking for checking traces and metrics

66 Views Asked by At

I am working on a POC where i want to run open telemetry with Quarkus native and use Skywalking for traces and metrics. I have checked Quarkus native with Jager. it works. but i am not sure how to do it with Skywalking. With java agent i am able to see the trace but for that i have to make non-native Quarkus application. Requirement is to use Quarkus native image with Skywalking on Kubernetes

As Skywalking java agent do not support GrallVM, i am not able to use it with Quarkus native. So at last what i did for trial.

Added open telemetry dependency in quarkus application

   <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-opentelemetry</artifactId>
    </dependency>

application.properties

quarkus.otel.exporter.otlp.traces.endpoint=http://skywalking-otel-collector-service.default.svc.cluster.local:4317
quarkus.otel.traces.enabled=true
quarkus.otel.exporter.otlp.enabled=true
quarkus.http.access-log.pattern="...traceId=%{X,traceId} spanId=%{X,spanId}" 

Generated quarkus native image using command

./mvnw package -Dnative -Dquarkus.native.container-build=true

then deployed a otel-collector.

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: skywalking-otel-collector
  labels:
    name: skywalking-otel-collector

spec:
  revisionHistoryLimit: 2
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 100%
      maxUnavailable: 0
  selector:
    matchLabels:
      name: skywalking-otel-collector
  template:
    metadata:
      labels:
        name: skywalking-otel-collector
    spec:
      containers:
        - command:
            - "./otelcol-contrib"
            - "--config=/config/otel/otel-collector-config.yaml"
          image: otel/opentelemetry-collector-contrib
          name: otel-collector
          resources:
            limits:
              cpu: 300m
              memory: 1Gi
            requests:
              cpu: 300m
              memory: 1Gi
          ports:
            - containerPort: 55679 # Default endpoint for ZPages.
            - containerPort: 4317  # Default endpoint for OpenTelemetry receiver.
            - containerPort: 4318  # Http receiver
            - containerPort: 8888  # Default endpoint for querying metrics.
          env:
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
          volumeMounts:
            - name: otel-collector-configs
              mountPath: /config/otel
      volumes:
        - name: otel-collector-configs
          configMap:
            name: otel-collector-configmap
            items:
              - key: otel-collector-config
                path: otel-collector-config.yaml

configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: otel-collector-configmap
data:
  otel-collector-config: |
    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    processors:
      batch:
    exporters:
      logging:
        loglevel: info
      otlp:
        endpoint: skywalking-skywalking-helm-oap.skywalking.svc.cluster.local:11800
        tls:
          insecure: true
    extensions:
      health_check:
    service:
      extensions: [health_check]
      pipelines:
        metrics:
          receivers: [otlp]
          processors: [batch]
          exporters: [logging, otlp]
        traces:
          receivers: [otlp]
          processors: [batch]
          exporters: [logging,otlp]
        logs:
          receivers: [otlp]
          processors: [batch]
          exporters: [otlp]

service

apiVersion: v1
kind: Service
metadata:
  name: skywalking-otel-collector-service
spec:
  ports:
    - name: grpc
      port: 4317
      protocol: TCP
      targetPort: 4317
    - name: http
      port: 4318
      protocol: TCP
      targetPort: 4318
  selector:
    name: skywalking-otel-collector
  type: NodePort

I have already installed skywalking using helm on my machine

helm install "${SKYWALKING_RELEASE_NAME}" \
  skywalking-helm \
  --version "${SKYWALKING_RELEASE_VERSION}" \
  -n "${SKYWALKING_RELEASE_NAMESPACE}" \
  --set oap.image.tag=9.2.0 \
  --set oap.storageType=elasticsearch \
  --set ui.image.tag=9.2.0

It is not working. No service is listed in my skywalking ui. Not able to see any trace. My requirement is to work with native quarkus and use skywalking.

Any help will be appriciated

1

There are 1 best solutions below

0
On

OpenTelemetry trace could be supported on SkyWalking, and only queriable on LensUI or SkyWalking's host Lens widget. https://skywalking.apache.org/docs/main/latest/en/setup/backend/otlp-trace/

About lens UI, it is bundled in the SkyWalking UI, you could add it like a widget, https://skywalking.apache.org/docs/main/latest/en/setup/backend/zipkin-trace/#lens-ui or access upstream Zipkin UI site.

screenshot from demo.skywalking.apache.org

This is a screenshot from demo.skywalking.apache.org, which shows how a bundled Zipkin lens UI looks like.

Meanwhile no service would be listed from the trace.

If you want to add new metrics work, you need to learn MAL(Meter Analysis Language) and activate scripts.