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

Is there a way to close request traces export in provider? #30

Closed
langker opened this issue Nov 30, 2023 · 5 comments
Closed

Is there a way to close request traces export in provider? #30

langker opened this issue Nov 30, 2023 · 5 comments

Comments

@langker
Copy link

langker commented Nov 30, 2023

I read the following website to use hertz with opentelemetry:
https://www.cloudwego.io/zh/docs/hertz/tutorials/observability/open-telemetry/

when I run the demo below in my local:
https://github.com/cloudwego/hertz-examples/blob/main/opentelemetry/hertz/server/main.go

Each time I request the server, I found there will always be a error like below:
2023/11/30 10:43:58 traces export: context deadline exceeded: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:4317: connect: connection refused"

In my case, I just need a trace_id and span_id to generate, but not care about whether request traces export in provider, so is there a way to close it?

@li-jin-gou
Copy link
Contributor

cc @rogerogers

@rogerogers
Copy link
Collaborator

Based on your description, I think you can use NoopExporter.

package main

import (
	"context"

	"github.com/hertz-contrib/obs-opentelemetry/provider"
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
	"go.opentelemetry.io/otel/sdk/trace/tracetest"
)

func main() {
	traceExporter := tracetest.NewNoopExporter()

	p := provider.NewOpenTelemetryProvider(
		provider.WithSdkTracerProvider(sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sdktrace.NewSimpleSpanProcessor(traceExporter)))),
		provider.WithEnableMetrics(false),
	)
	defer p.Shutdown(context.Background())
}

Just curious, if you don't care about uploading, maybe I can understand why you need a trace ID, but what is the purpose of the span ID?

@langker
Copy link
Author

langker commented Nov 30, 2023

will span_id depend on uploading?

in our case, we will output the trace_id and span_id through log, there will be another program to deal the log.

Actually I am not understanding what upload does? Is it collect the data and show it, like grafana?

@rogerogers
Copy link
Collaborator

Link tracking roughly determines link sequence based on SpanId and ParentSpanId. If there is only SpanId, it seems to have no meaning.

@langker langker closed this as completed Nov 30, 2023
@li-jin-gou
Copy link
Contributor

Can work with https://www.volcengine.com/docs/6431/158278

li-jin-gou pushed a commit to li-jin-gou/obs-opentelemetry that referenced this issue Jan 15, 2024
fix[logging/zap]:Modify span status judgment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants