imandra-ai / ocaml-opentelemetry

Instrumentation for https://opentelemetry.io
http://docs.imandra.ai/ocaml-opentelemetry/
33 stars 7 forks source link

remove trailing slash from url #38

Closed tatchi closed 1 year ago

tatchi commented 1 year ago

I hit the following error while testing the ocurl client

opentelemetry: send http POST to http://localhost:4318//v1/traces (216B)
error while sending:
  code=405
  (could not decode status)
raw bytes: 343035206d6574686f64206e6f7420616c6c6f7765642c20737570706f727465643a205b504f53545d

Until I realised the double // in the URL. This is because I passed http://localhost:4318/ (with the trailing slash) as URL config.

This PR should fix it by removing the potential trailing / from the config.url

note: I tested the same code withcohttp client, and it was even worse because it "failed" silently due to a 301 redirect response (I'll open a separate issue).

c-cube commented 1 year ago

Ah yeah the String function exists only since 4.13. We might need to vendor it.

tatchi commented 1 year ago

Ah yeah the String function exists only since 4.13. We might need to vendor it.

What would be the best way to vendor it? Should we create our own string.ml where we include Stdlib.String ?

c-cube commented 1 year ago

A local misc.ml module would do, I think. I'm kind of surprised there isn't one already!

c-cube commented 1 year ago

Continued and merged in #42 :)