is there a way to send traces to signoz from HTTP ...
# general
d
is there a way to send traces to signoz from HTTP API? my use case is that I want to check end-to-end latency from FE mobile applications. so FE will send time taken and API name from FE, and then BE will send to signoz using a HTTP API
open to suggestions if there is some other way to handle this
I tried sending on port 4318 directly, but it didn’t work
example request
Copy code
{
			name: '/v1/sys/health',
			context: {
				trace_id: '7bba9f33312b3dbb8b2c2c62bb7abe2d',
				span_id: '086e83747d0e381e',
			},
			parent_id: '',
			start_time: '2021-10-22 16:04:01.209458162 +0000 UTC',
			end_time: '2021-10-22 16:04:01.209514132 +0000 UTC',
			status_code: 'STATUS_CODE_OK',
			status_message: '',
			attributes: {
				'net.transport': 'IP.TCP',
				'net.peer.ip': '172.17.0.1',
				'net.peer.port': '51820',
				'net.host.ip': '10.177.2.152',
				'net.host.port': '26040',
				'http.method': 'GET',
				'http.target': '/v1/sys/health',
				'http.server_name': 'mortar-gateway',
				'http.route': '/v1/sys/health',
				'http.user_agent': 'Consul Health Check',
				'http.scheme': 'http',
				'http.host': '10.177.2.152:26040',
				'http.flavor': '1.1',
			},
			events: [
				{
					name: 'sad',
					message: 'OK',
					timestamp: '2021-10-22 16:04:01.209512872 +0000 UTC',
				},
			],
		}
@Srikanth Chekuri please check it once, when u get time
s
@Dhruv garg the format of json from to send to 4318 is not correct. The above is for troubleshooting. See the payload examples here https://github.com/open-telemetry/opentelemetry-proto/tree/main/examples
d
@Srikanth Chekuri I followed above link, and tried this request
Copy code
curl -X POST -H "Content-Type: application/json" -d @trace.json -i <http://9.9.9.9:4317/v1/traces>
but getting this error
Copy code
curl: (1) Received HTTP/0.9 when not allowed
when tried from postman
Copy code
Parse Error: The server returned a malformed response
s
It should be 4318 bro
d
I tried, but it was timing out
do I need to change otel configuration for this?
s
Did you enable the http receiver protocol for otlp and make sure it is reachable.
Copy code
receivers:
  otlp:
    protocols:
      grpc:
      http:
d
I am running it in k8s, in k describe otel-collector
Copy code
Port:              otlp  4317/TCP
TargetPort:        otlp/TCP
Endpoints:         10.0.139.186:4317
Port:              otlp-http  4318/TCP
TargetPort:        otlp-http/TCP
Endpoints:         10.0.139.186:4318
I can see these lines
trying with docker standalone once, give me 5 mins
I am able to make it work in docker standalone now, but not getting service name, only getting trace name in traces tab, and not in services tab, @Srikanth Chekuri can you tell me where I can see the JSON specification for all the fields available?
s
The protobuf messages are available in the same repo
d
Copy code
const span = tracer.startSpan(
			req.body.api + '_' + req.body.timezone,
			{
				startTime: req.body.startTime,
				kind: SpanKind.CLIENT,
				attributes: {
					platform: req.body.platform,
				},
			},
			trace.setSpan(context.active(), ctx.trace),
		);

		span.setStatus({ code: SpanStatusCode.OK });
		span.end(req.body.endTime);
I tried sending using @opentelemetry/api package, but this is not working, am I missing something? I am using same approach for other traces in codebase, and that is working fine
using
ConsoleExporter
I was able to log this
Copy code
{
  traceId: 'b7bbcdb0bb9a834517623a36f39790be',
  parentId: undefined,
  traceState: undefined,
  name: 'trackAsia/Kolkata',
  id: 'c113e856aef40ad0',
  kind: 2,
  timestamp: 1717493453000,
  duration: 500000,
  attributes: { platform: 4 },
  status: { code: 1 },
  events: [],
  links: []
}
but I am not getting this in signoz dashboard, how can we troubleshoot this @Srikanth Chekuri this is the code
Copy code
const frontendTraceProvider = new NodeTracerProvider({
	resource: new Resource({
		[SemanticResourceAttributes.SERVICE_NAME]: 'frontend-nudge',
		[SemanticResourceAttributes.SERVICE_VERSION]: '0.1',
	}),
});

	frontendTraceProvider.addSpanProcessor(
		new BatchSpanProcessor(new ConsoleSpanExporter(), {
			maxExportBatchSize: 512,
			maxQueueSize: 4096,
			scheduledDelayMillis: 3000,
			exportTimeoutMillis: 30000,
		}),
	);

const performanceTracer = frontendTraceProvider.getTracer('frontend-performance');

		const span = performanceTracer.startSpan(req.body.api + req.body.timezone, {
			startTime: req.body.startTime,
			kind: SpanKind.CLIENT,
			attributes: {
				platform: req.body.platform,
			},
		});

		span.setStatus({ code: SpanStatusCode.OK });
		span.end(req.body.endTime);