Skip to content

Instantly share code, notes, and snippets.

@arungpro
Last active May 11, 2023 11:48
Show Gist options
  • Save arungpro/ee12881f4b467e6ebe3bab33aa36056f to your computer and use it in GitHub Desktop.
Save arungpro/ee12881f4b467e6ebe3bab33aa36056f to your computer and use it in GitHub Desktop.
Otel collector connection verification

Otel collector connection verification

==============================================================

Regular

    curl -X POST \
    -H "Content-Type: application/json" \
    -d '<sample otel trace json>' \
    http://<collector_host>:<collector_http_port>/v1/traces -v
  • collector_host -> Server host on which opentelemetry collector is running.

  • collector_http_port -> Server port on which opentelemetry collector is listening at. By default http port is 4318.

    Example

   curl -X POST \
   -H "Content-Type: application/json" \
   -d '{"resourceSpans":[{"resource":{"attributes":[{"key":"resource-attr","value":{"stringValue":"resource-attr-val-  1"}}]},"scopeSpans":[{"scope":{},"spans":[{"traceId":"","spanId":"","parentSpanId":"","name":"operationA","startTimeUnixNano":"1581452772000000321","endTimeUnixNano":"1581452773000000789","droppedAttributesCount":1,"events":[{"timeUnixNano":"1581452773000000123","name":"event-with-attr","attributes":[{"key":"span-event-attr","value":{"stringValue":"span-event-attr-val"}}],"droppedAttributesCount":2},{"timeUnixNano":"1581452773000000123","name":"event","droppedAttributesCount":2}],"droppedEventsCount":1,"status":{"message":"status-cancelled","code":2}},{"traceId":"","spanId":"","parentSpanId":"","name":"operationB","startTimeUnixNano":"1581452772000000321","endTimeUnixNano":"1581452773000000789","links":[{"traceId":"","spanId":"","attributes":[{"key":"span-link-attr","value":{"stringValue":"span-link-attr-val"}}],"droppedAttributesCount":4},{"traceId":"","spanId":"","droppedAttributesCount":1}],"droppedLinksCount":3,"status":{}}]}]}]}' \
   http://localhost:4318/v1/traces -v

============================

With http_proxy Involved


Run curl with -x with verbose output

    curl -X POST \
    -x http://proxy_server:proxy_port \
    -H "Content-Type: application/json" \
    -d '<sample otel trace json>' \
    http://<collector_host>:<collector_http_port>/v1/traces -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment