添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
卖萌的米饭  ·  BizCover 条款和条件 - ...·  2 月前    · 
一直单身的桔子  ·  Butaanimeshop·  9 月前    · 

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 I've been trying to get the gRPC OTLP receiver to work with Grafana Cloud, but it doesn't seem to be accepting connections. The HTTP receiver works fine, as do the jaeger receivers.

Here's a minimal reproduction:

config.yaml

server:
  http_listen_port: 12345
  log_level: debug
traces:
  configs:
    - name: integrations
      receivers:
        otlp:
          protocols:
            grpc:
              endpoint: 0.0.0.0:4317
            http:
              endpoint: 0.0.0.0:4318
      remote_write:
        - endpoint: tempo-eu-west-0.grafana.net:443
          basic_auth:
            username: "censored"
            password: "censored"
docker run -it --rm -p 4317:4317 -p 4318:4318 -p 12345:12345 -v $(pwd):/cfg:ro grafana/agent:v0.24.1 -config.file=/cfg/config.yaml

Output:

ts=2022-04-25T07:48:19Z level=info caller=otlpreceiver/otlp.go:69 msg="Starting GRPC server on endpoint 0.0.0.0:4317" component=traces traces_config=integrations kind=receiver name=otlp ts=2022-04-25T07:48:19Z level=info caller=otlpreceiver/otlp.go:87 msg="Starting HTTP server on endpoint 0.0.0.0:4318" component=traces traces_config=integrations kind=receiver name=otlp ts=2022-04-25T07:48:19Z level=info caller=builder/receivers_builder.go:73 msg="Receiver started." component=traces traces_config=integrations kind=receiver name=otlp

However, sending traces does not work. cURL f.ex. just receives HTTP/0.9 when not allowed .
Here's my client code for reference. Any hints are appreciated.

client := otlptracegrpc.NewClient(
  otlptracegrpc.WithEndpoint("localhost:4317"),
  otlptracegrpc.WithInsecure(),
//client := otlptracehttp.NewClient(
//	otlptracehttp.WithEndpoint("localhost:4318"),
//	otlptracehttp.WithInsecure(),
exporter, err := otlptrace.New(ctx, client)
if err != nil {
  logger.Fatal("creating OTLP exporter", zap.Error(err))
//exporter, err := jaeger.New(jaeger.WithCollectorEndpoint())
//if err != nil {
//	logger.Fatal("creating jaeger exporter", zap.Error(err))
res := resource.NewWithAttributes(
  semconv.SchemaURL,
  semconv.ServiceNameKey.String(appName),
tracerProvider := sdktrace.NewTracerProvider(
  sdktrace.WithBatcher(exporter),
  sdktrace.WithResource(res),
otel.SetTracerProvider(tracerProvider)
otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) {
  logger.Error("Tracing error", zap.Error(err))
cleanup := func() {
  if err := tracerProvider.Shutdown(ctx); err != nil {
    logger.Error("Error stopping tracer provider", zap.Error(err))

The commented-out blocks show how I've (successfully) used OTLP HTTP, or jaeger. Just OTLP gRPC seems unusable.

Example error:

2022-04-25T10:09:12.772+0200    ERROR   tracing/opentelemetry.go:67     Tracing error   {"error": "max retry time elapsed: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp [::1]:4317: connect: connection refused\""}
          

Apologies, solved after some more trying.
Turns out you really have to use gRPC for testing a gRPC endpoint, or you'll get weird errors.
(Also I had been doing most of my testing without otlptracegrpc.WithInsecure(), which is necessary since I didn't bother to setup certificates yet.)

frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 22, 2024