Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP receiver doesn't work #4094

Closed
IvanVan opened this issue Sep 23, 2021 · 3 comments
Closed

HTTP receiver doesn't work #4094

IvanVan opened this issue Sep 23, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@IvanVan
Copy link

IvanVan commented Sep 23, 2021

Describe the bug
Got the following message error when use http receiver

Sep 22, 2021 5:21:28 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog
WARNING: Failed to export spans. Server responded with HTTP status code 404. Error message: Unable to parse response body, HTTP status message: Not Found

Steps to reproduce
Run docker compose with the following docker-compose.yaml

version: "2"
services:

  zipkin-all-in-one:
    image: openzipkin/zipkin:latest
    ports:
      - "9411:9411"

  otel-collector:
    image: otel/opentelemetry-collector:latest
    command: ["--config=otel-local-config.yaml", "${OTELCOL_ARGS}"]
    volumes:
      - ${PWD}/config.yaml:/otel-local-config.yaml
    ports:
      - "4318:4318"

and config.yaml

receivers:
  otlp:
    protocols:
      http:

exporters:
  zipkin:
    endpoint: "http://zipkin-all-in-one:9411/api/v2/spans"
    format: proto

  logging:

processors:
  batch:

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [logging, zipkin]

Run simple Java app:

import io.opentelemetry.sdk.autoconfigure.OpenTelemetrySdkAutoConfiguration;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.Tracer;
import java.util.Scanner;

public class Main
{
  public static void main(String[] args)
  {
    System.setProperty("otel.service.name", "Simple server");
    System.setProperty("otel.experimental.exporter.otlp.protocol", "http/protobuf");
    System.setProperty("otel.exporter.otlp.endpoint", "http://localhost:4318");

    OpenTelemetrySdkAutoConfiguration.initialize();

    while (true) {
      Scanner scanner = new Scanner(System.in);
      String in = scanner.nextLine();
      if (in.equals("exit")) {
        break;
      }
      Tracer tracer = GlobalOpenTelemetry.getTracer("Simple server");
      Span outGoing = tracer.spanBuilder("Simple server").setSpanKind(SpanKind.CLIENT).startSpan();
      outGoing.end();
    }
  }
}

What did you expect to see?
Expect to see spans in zipkin

What did you see instead?
Error message

What version did you use?
opentelemetry - 1.6.0
com.google.protobuf - protobuf-java - 3.17.3

@IvanVan IvanVan added the bug Something isn't working label Sep 23, 2021
@IvanVan
Copy link
Author

IvanVan commented Sep 23, 2021

@jack-berg Could you tell me please if you have any ideas why it happens?

@jack-berg
Copy link
Member

Hi @IvanVan. I believe this is related to this issue in opentelemetry-java.

Can you try adding /v1/traces to the the system property?

System.setProperty("otel.exporter.otlp.endpoint", "http://localhost:4318/v1/traces");
// or if you need metrics as well:
// System.setProperty("otel.exporter.otlp.traces.endpoint", "http://localhost:4318/v1/traces");

I'm working on getting a fix for this in opentelemetry-java, but for now you should be able to work around it.

@IvanVan
Copy link
Author

IvanVan commented Sep 23, 2021

Thank you so much @jack-berg for answering and such quick response!
Now it works as expected 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants