kinduff / csgo_exporter

A Prometheus exporter for Counter-Strike: Global Offensive.
Apache License 2.0
19 stars 3 forks source link

An error has occurred during retrieving statistics <nil> #21

Closed simonszu closed 3 years ago

simonszu commented 3 years ago

Hi, apparently since the 1.0.0 release the exporter is crashing regularly for me. This is the log file i get for one execution:

time="2021-06-04T10:07:12Z" level=info msg="============================================="
time="2021-06-04T10:07:12Z" level=info msg="         CSGO Exporter Configuration         "
time="2021-06-04T10:07:12Z" level=info msg="============================================="
time="2021-06-04T10:07:12Z" level=info msg="HTTPPort: 9617"
time="2021-06-04T10:07:12Z" level=info msg="SteamAPIKey: [FILTERED]"
time="2021-06-04T10:07:12Z" level=info msg="SteamID: 76561197996581872"
time="2021-06-04T10:07:12Z" level=info msg="FetchInventory: true"
time="2021-06-04T10:07:12Z" level=info msg="Currency: EUR"
time="2021-06-04T10:07:12Z" level=info msg="ScrapeInterval: 30s"
time="2021-06-04T10:07:12Z" level=info msg="============================================="
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: stats"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: last_match"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: total_shots"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: total_kills"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: achievements"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: playtime"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: news"
time="2021-06-04T10:07:12Z" level=info msg="New Prometheus metric registered: user_inventory"
time="2021-06-04T10:07:12Z" level=info msg="Starting HTTP server on http://localhost:9617"
time="2021-06-04T10:07:42Z" level=info msg="Sending HTTP request to https://steamcommunity.com/inventory/76561197996581872/730/2"
time="2021-06-04T10:07:42Z" level=info msg="Sending HTTP request to https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002?appid=730&key=[FILTERED]&steamid=76561197996581872"
time="2021-06-04T10:07:42Z" level=info msg="Sending HTTP request to https://api.steampowered.com/IPlayerService/GetOwnedGames/v1?appid=730&appids_filter%5B0%5D=730&key=[FILTERED]&steamid=76561197996581872"
time="2021-06-04T10:07:42Z" level=info msg="Sending HTTP request to https://api.steampowered.com/ISteamNews/GetNewsForApp/v0002?appid=730&key=[FILTERED]&maxlength=240"
time="2021-06-04T10:07:42Z" level=info msg="Sending HTTP request to https://steamcommunity.com/profiles/76561197996581872/stats/CSGO?xml=1"
time="2021-06-04T10:07:43Z" level=fatal msg="An error has occurred during retrieving statistics <nil>"

I am starting the container basically with this configuration:

- name: Start docker container
  docker_container:
    name: csgo-exporter
    image: kinduff/csgo_exporter:latest
    restart_policy: always
    ports:
    - "7355:7355"
    env:
      STEAM_API_KEY: "supersecretkey"
      STEAM_ID: "76561197996581872"
      FETCH_INVENTORY: "true"
      CURRENCY: "EUR"
    networks:
      - name: backend
  become: yes

Maybe it could be beneficial to see what error exactly has occured, How could i achieve that? Also i am a bit confused why the log says that the web server is started on port 9617, although i have specified it to run on 7355.

kinduff commented 3 years ago

@simonszu Sorry about this, I didn't add to the README or rescue the error in the code when a profile inventory is set to private. Please set FETCH_INVENTORY to false in order to skip that request, as a workaround for now.

I will add support to avoid this.

About the port, another typo I made by accident. Please set HTTP_PORT variable to 7355.

simonszu commented 3 years ago

Ah, that looks better now. Thanks, and i will set my inventory to public later on.

kinduff commented 3 years ago

@simonszu Going to reopen this so I can address it as a bug