← Back to blog
Guide 4 min read 炬鲸团队

Connect OpenTelemetry to JuJing OBSERVE in 15 Minutes

A from-scratch guide to wiring the OpenTelemetry Collector into JuJing OBSERVE — agent deployment, config changes, and verifying metrics and traces — with copy-paste configuration.

Decide what to collect first

Before wiring anything up, answer three questions: which services' metrics and traces you need, roughly how much data that produces, and what sampling rate to use. Don't start at 100% sampling — set 10% for high-traffic services and adjust once you see where the bottleneck is. The sampling rate lives in config, which is far easier to change than code.

JuJing OBSERVE accepts data over OTLP on both port 4318 (HTTP) and 4317 (gRPC). Use gRPC in production; compression cuts transfer volume significantly.

Deploy the Collector

Start the Collector with containers:

docker run -d --name otel-collector \
  -v $(pwd)/otel-config.yaml:/etc/otelcol/config.yaml \
  otel/opentelemetry-collector-contrib:0.95.0

Put the Collector close to your apps — one per host, or one per cluster. Don't have all services reach a single central Collector across regions; network jitter will drop metric points.

Configure the exporter

Edit the exporter section of otel-config.yaml:

exporters:
  otlp/jjhub:
    endpoint: "ob.jjhub.cn:4317"
    headers:
      Authorization: "Bearer <your-token>"
    tls:
      insecure: false
service:
  pipelines:
    metrics:
      exporters: [otlp/jjhub]
    traces:
      exporters: [otlp/jjhub]

Create tokens in the JuJing console under "Access Management" — one per environment. Don't copy a production token into a test config and then share it around.

Three lines on the application side

Skip manual instrumentation when you can. Prefer auto-injection: -javaagent:opentelemetry-javaagent.jar for Java, opentelemetry-instrument for Python, --require @opentelemetry/auto-instrumentations-node/register for Node.

For Java, add to the startup args:

-javaagent:opentelemetry-javaagent.jar
-Dotel.exporter.otlp.endpoint=http://localhost:4318
-Dotel.resource.attributes=service.name=order-service,env=prod

Always set service.name, and agree on a naming convention across the team (say, order-service for the order service). Otherwise your traces and metrics fill up with unknown_service.

Verify data is flowing

Three checks confirm the pipeline works:

  1. Metrics: open "Metric Explorer", search service.name="order-service" — CPU or request counts should appear.
  2. Traces: fire a real request, then search its trace_id in "Trace Search" and confirm the call chain shows up.
  3. Fields: pick one span and check that service.name, trace_id, and span_kind are populated. Missing ones mean auto-injection didn't take effect.

Once data flows, set up sampling policy, alert thresholds, and dashboards in one pass. For the first two weeks, check the volume curve daily for spikes or gaps.