# Scraping Error after retrieving metrics via browser / curl

**URL:** <https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251>\
**Category:** Exporters and Metrics\
**Created:** [April 24, 2024, 10:37am UTC](https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251 "2024-04-24T10:37:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![securom87](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@securom87](https://discuss.prometheus.io/u/securom87)\
**Post date:** [April 24, 2024, 10:37am UTC](https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251/1 "2024-04-24T10:37:22Z")

</div>

Hello together!  
a couple of days i am trying to figure out a problem dealing with .NET Metrics scraped by Prometheus and delivered to Grafana with a project which should be eneabled to send OpenTelemetry Data.

Moving from my project to a general [ASP.NET](http://ASP.NET) Core Otel-Example ([opentelemetry-dotnet/examples/AspNetCore at main · open-telemetry/opentelemetry-dotnet · GitHub](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/examples/AspNetCore)) which is configured the same as my project  
i tried the mentioned example, and configured prometheus as follows:

```auto
- job_name: 'OpenTelemetry_OriginalTestProjekt'
    scrape_interval: 5s
    scheme: https
    static_configs:
      - targets: ['localhost:5001']

```

Releasing some GET-Requests via Swagger, metrics are created, scraped by prometheus and shown in Grafana.

**BUT:**

Issueing a request to see the scraped data that also prometheus sees results in an error message:

```auto
ts=2024-04-24T09:49:10.481Z caller=scrape.go:1345 level=debug component="scrape manager" scrape_pool=OpenTelemetry_OriginalTestProjekt target=https://localhost:5001/metrics msg="Append failed" err="expected label value, got \"#\" (\"INVALID\") while parsing: \"kestrel_active_connections{otel_scope_name=\\\"Microsoft.AspNetCore.Server.Kestrel\\\",network_transport=\\\"tcp\\\",network_type=#\""

```

Afterwards the errormessage appears again and again and no more metrics are scraped anymore. As a consequence no new data is povided to grafana.

After reopening the Example prometheus reconnects and scrapes again data.

What is the problem here or what is the reason prometheus is delivering this error and stops scraping?

---

<div class="post-metadata">

**Author:** ![salessandri](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/salessandri/32/814_2.png) [@salessandri](https://discuss.prometheus.io/u/salessandri)\
**Post date:** [April 24, 2024, 8:46pm UTC](https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251/2 "2024-04-24T20:46:28Z")

</div>

The error is caused by the fact that the format is not what prometheus is expecting that each label withing the curly braces is in the form `label_name="<text>"`, but for network type that is not the case. It is seeing a hash rather than double quotes: `network_type=#`.

What is causing that to be the case, I cannot tell you though. Do you have the whole line being parsed?

---

<div class="post-metadata">

**Author:** ![securom87](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@securom87](https://discuss.prometheus.io/u/securom87)\
**Post date:** [April 25, 2024, 7:48am UTC](https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251/3 "2024-04-25T07:48:12Z")

</div>

Hi, thanks for replying!

The line which should be parsed by prometheus is the following:

```auto
# TYPE kestrel_active_connections gauge
# HELP kestrel_active_connections Number of connections that are currently active on the server.
kestrel_active_connections{otel_scope_name="Microsoft.AspNetCore.Server.Kestrel",network_transport="tcp",network_type="ipv6",server_address="::1",server_port="5174"} 4 1714031208626

```

According to the message there is something wrong parsing the ipv6 part. But why?

---

<div class="post-metadata">

**Author:** ![slayersfest](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@slayersfest](https://discuss.prometheus.io/u/slayersfest)\
**Post date:** [October 11, 2024, 4:17pm UTC](https://discuss.prometheus.io/t/scraping-error-after-retrieving-metrics-via-browser-curl/2251/4 "2024-10-11T16:17:40Z")

</div>

Hi @securom87

Did you manged to resolved this issue? As i am experiencing the exact same error as you.
