user82196: I bought an "off-brand" ESP32 board. I can upload blinky without a problem using platformio with the following platformio.ini file:
[env:humidious]
platform = espressif32
board = nodemcu-32s
framework = arduino

However, as soon as I add lib_deps = grafana/PrometheusArduino@^0.3.0 the compiler throws the following errors:
In file included from .pio/libdeps/humidious/WiFiNINA/src/WiFiStorage.h:23:0,
                 from .pio/libdeps/humidious/WiFiNINA/src/WiFi.h:38,
                 from .pio/libdeps/humidious/PromLokiTransport/src/clients/ESP32Client.h:7,
                 from .pio/libdeps/humidious/PromLokiTransport/src/PromLokiTransport.h:8,
                 from .pio/libdeps/humidious/PrometheusArduino/src/PromClient.h:4,
                 from .pio/libdeps/humidious/PrometheusArduino/src/PrometheusArduino.h:5,
                 from src/main.cpp:4:
.pio/libdeps/humidious/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);

It was suggested on another thread that the board was out of date, but updating this didn't help.
Adding typedef int PinStatus before #include <PrometheusArduino.h> didn't help either.

user4143: The problem here is that PlatformIO is picking up the wrong WiFi library. It has decided that the WiFi.h provided by WiFiNINA is the correct one to use, rather than the WiFi.h provided by the ESP32's bundled WiFi library.
You could try removing all traces of the WiFiNINA library from your PlatformIO installation, or maybe you need to manually specify which WiFi library should be used to preempt the autoselection routine.
I don't know how you do that in PlatformIO.

user82196: What Majeko said was correct. PIO was using WifiNINA instead of the ESP32's WiFi library. To solve this, I added lib_ignore = WiFiNINA to platformio.ini and #include <WiFi.h> before including the prometheus libraries in main.ino.
I tested this by pointing PrometheusArduino at my desktop with this example:
$ ncat -l 9090
POST /api/prom/push HTTP/1.1
Host: 192.168.0.45
Content-Type: application/x-protobuf
Content-Encoding: snappy
User-Agent: prom-arduino/0.2.2
Content-Length: 209

F

%
__name__uptime_milliseconds_total

job
esp32-test

hostD   @/@%@<@@/

heap_free_bytes
0


foobar
        0xA6..(0xA/


82196: <p>I bought an &quot;off-brand&quot; <a href="https://www.amazon.co.uk/gp/product/B07VJ34N2Q/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&amp;th=1" rel="nofollow noreferrer">ESP32 board</a>. I can upload blinky without a problem using platformio with the following <code>platformio.ini</code> file:</p>
<pre><code>[env:humidious]
platform = espressif32
board = nodemcu-32s
framework = arduino
</code></pre>
<p>However, as soon as I add <code>lib_deps = grafana/PrometheusArduino@^0.3.0</code> the compiler throws the following errors:</p>
<pre><code>In file included from .pio/libdeps/humidious/WiFiNINA/src/WiFiStorage.h:23:0,
                 from .pio/libdeps/humidious/WiFiNINA/src/WiFi.h:38,
                 from .pio/libdeps/humidious/PromLokiTransport/src/clients/ESP32Client.h:7,
                 from .pio/libdeps/humidious/PromLokiTransport/src/PromLokiTransport.h:8,
                 from .pio/libdeps/humidious/PrometheusArduino/src/PromClient.h:4,
                 from .pio/libdeps/humidious/PrometheusArduino/src/PrometheusArduino.h:5,
                 from src/main.cpp:4:
.pio/libdeps/humidious/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
</code></pre>
<p>It was suggested on another thread that the board was out of date, but updating this didn't help.</p>
<p>Adding <code>typedef int PinStatus</code> before <code>#include &lt;PrometheusArduino.h&gt;</code> didn't help either.</p>
 4143: <p>The problem here is that PlatformIO is picking up the wrong WiFi library. It has decided that the WiFi.h provided by WiFiNINA is the correct one to use, rather than the WiFi.h provided by the ESP32's bundled WiFi library.</p>
<p>You could try removing all traces of the WiFiNINA library from your PlatformIO installation, or maybe you need to manually specify which WiFi library should be used to preempt the autoselection routine.</p>
<p>I don't know how you do that in PlatformIO.</p>
 82196: <p>What Majeko said was correct. PIO was using WifiNINA instead of the ESP32's WiFi library. To solve this, I added <code>lib_ignore = WiFiNINA</code> to <code>platformio.ini</code> and <code>#include &lt;WiFi.h&gt;</code> before including the prometheus libraries in <code>main.ino</code>.</p>
<p>I tested this by pointing PrometheusArduino at my desktop with <a href="https://github.com/grafana/prometheus-arduino/blob/main/examples/prom_01_local/prom_01_local.ino" rel="nofollow noreferrer">this example</a>:</p>
<pre><code>$ ncat -l 9090
POST /api/prom/push HTTP/1.1
Host: 192.168.0.45
Content-Type: application/x-protobuf
Content-Encoding: snappy
User-Agent: prom-arduino/0.2.2
Content-Length: 209

F

%
__name__uptime_milliseconds_total

job
esp32-test

hostD   @/@%@&lt;@@/

heap_free_bytes
0


foobar
        0xA6..(0xA/
</code></pre>
