beam-telemetry / telemetry_metrics_prometheus_core

Core Prometheus Telemetry.Metrics Reporter package for telemetry_metrics_prometheus
Apache License 2.0
35 stars 30 forks source link

Issues with ~S sigil on Elixir main branch #59

Closed IvanIvanoff closed 8 months ago

IvanIvanoff commented 8 months ago

I have issues compiling this part: https://github.com/beam-telemetry/telemetry_metrics_prometheus_core/blob/a0e82acd27b65e518c6feee578626fef626b4415/lib/core/exporter.ex#L108-L121 using Elixir's main branch.

Using git bisect I narrowed down the issue to this commit: https://github.com/elixir-lang/elixir/commit/51d23cbba8199936101bda9d57b341105a9efc14

It looks like now ~S does not work as it did before and some reworks are needed to avoid compile-time errors:

== Compilation error in file lib/core/exporter.ex ==
** (MismatchedDelimiterError) mismatched delimiter found on lib/core/exporter.ex:116:3:
     error: unexpected reserved word: end
     │
 114 │     |> String.replace(~S(\\), ~S(\\\\))
     │                      └ unclosed delimiter
 115 │     |> String.replace(~S(\n), ~S(\\n))
 116 │   end
     │   └ mismatched closing delimiter (expected ")")
bryannaegele commented 8 months ago

@IvanIvanoff I do not see this compilation issue you are describing with 1.16.0. Are you seeing this with a released version of Elixir?

IvanIvanoff commented 8 months ago

@bryannaegele It's in the main branch and it is not part of a released version yet. Given that this is breaking some existing code, I assume it will be part of 1.17 and not some of the 1.16.x versions.

IvanIvanoff commented 8 months ago

@bryannaegele Seems like someone encountered the issue here as well and reported to the Elixir Issues and they reverted the change on the main branch. I no longer think this issue is relevant and I'll close it and the PR as well. Ref: https://github.com/elixir-lang/elixir/issues/13262

bryannaegele commented 8 months ago

Ok. Thanks for the follow-up @IvanIvanoff !