NREL / api-umbrella

Open source API management platform
MIT License
2.01k stars 325 forks source link

Not working analytics when use docker image (0.12.0) #284

Closed shaliko closed 7 years ago

shaliko commented 8 years ago

When I start project as Docker container using instructions from http://api-umbrella.readthedocs.io/en/latest/getting-started.html#running-with-docker, the "Analytics" have empty charts. API works OK, but all charts empty. I not found any issue in logs.

My api-umbrella.yml file:

services:
  - general_db
  - log_db
  - router
  - web
web:
  admin:
    initial_superusers:
      - shaliko@ezid.ru
    auth_strategies:
      enabled:
        - github
        - google
        - persona
      github:
        client_id: xxx
        client_secret: xxx
      google:
        client_id:
        client_secret:
elasticsearch:
  hosts:
    - http://127.0.0.1:14002
mongodb:
  url: mongodb://127.0.0.1:14001/api_umbrella
nginx:
  workers: 4
gatekeeper:
  workers: 4
hosts:
  - hostname: apinf.usubov.com
    default: true

I can test my backend:

$ curl --insecure "https://apinf.usubov.com/maps/api/geocode/json?api_key=hwBrTpoJhHwMszx904lDOjKZgDoD1oAX5aTJNVEr&address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyDc97a13NBkefRoq6e5v2FpIyjEBS1rkl0"

Empty charts: api_umbrella_admin_and_heiaheia_ _-bash_ _127x34

I can test that Elasticsearch works:

root@c5378d2bcfc9:/# curl http://127.0.0.1:14002                         
{
  "status" : 200,
  "name" : "Lady Mastermind",
  "cluster_name" : "api-umbrella",
  "version" : {
    "number" : "1.7.5",
    "build_hash" : "00f95f4ffca6de89d68b7ccaf80d148f1f70e4d4",
    "build_timestamp" : "2016-02-02T09:55:30Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

Any advice where I should find issue?

brylie commented 8 years ago

Ping @GUI. We need a bit of support here, to figure out what to do.

Ping @bajiat, this issue is related to our analytics not working recently.

shaliko commented 8 years ago

@GUI I added debug code to Lua scripts, found that we successfully log data here https://github.com/NREL/api-umbrella/blob/master/src/api-umbrella/proxy/hooks/log_initial_proxy.lua#L276

But If I get ElasticSearch stats:

curl -XGET http://localhost:14002/_stats?pretty=true

     "api-umbrella-logs-v1-2016-08" : {
      "primaries" : {
        "docs" : {
          "count" : 0,
          "deleted" : 0
        },
        "store" : {
          "size_in_bytes" : 432,
          "throttle_time_in_millis" : 0
        },
        "indexing" : {
          "index_total" : 0,
          "index_time_in_millis" : 0,
          "index_current" : 0,
          "delete_total" : 0,
          "delete_time_in_millis" : 0,
          "delete_current" : 0,
          "noop_update_total" : 0,
          "is_throttled" : false,
          "throttle_time_in_millis" : 0
        },
        "get" : {
          "total" : 0,
          "time_in_millis" : 0,
          "exists_total" : 0,
          "exists_time_in_millis" : 0,
          "missing_total" : 0,
          "missing_time_in_millis" : 0,
          "current" : 0
        },
        "search" : {
          "open_contexts" : 0,
          "query_total" : 144,
          "query_time_in_millis" : 272,
          "query_current" : 0,
          "fetch_total" : 0,
          "fetch_time_in_millis" : 0,
          "fetch_current" : 0
        },
        "merges" : {
          "current" : 0,
          "current_docs" : 0,
          "current_size_in_bytes" : 0,
          "total" : 0,
          "total_time_in_millis" : 0,
          "total_docs" : 0,
          "total_size_in_bytes" : 0
        },
        "refresh" : {
          "total" : 3,
          "total_time_in_millis" : 0
        },
        "flush" : {
          "total" : 6,
          "total_time_in_millis" : 23
        },
        "warmer" : {
          "current" : 0,
          "total" : 6,
          "total_time_in_millis" : 15
        },
        "filter_cache" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0
        },
        "id_cache" : {
          "memory_size_in_bytes" : 0
        },
        "fielddata" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0
        },
        "percolate" : {
          "total" : 0,
          "time_in_millis" : 0,
          "current" : 0,
          "memory_size_in_bytes" : -1,
          "memory_size" : "-1b",
          "queries" : 0
        },
        "completion" : {
          "size_in_bytes" : 0
        },
        "segments" : {
          "count" : 0,
          "memory_in_bytes" : 0,
          "index_writer_memory_in_bytes" : 0,
          "index_writer_max_memory_in_bytes" : 1536000,
          "version_map_memory_in_bytes" : 0,
          "fixed_bit_set_memory_in_bytes" : 0
        },
        "translog" : {
          "operations" : 0,
          "size_in_bytes" : 17
        },
        "suggest" : {
          "total" : 0,
          "time_in_millis" : 0,
          "current" : 0
        },
        "query_cache" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0,
          "hit_count" : 0,
          "miss_count" : 0
        },
        "recovery" : {
          "current_as_source" : 0,
          "current_as_target" : 0,
          "throttle_time_in_millis" : 0
        }
      },
      "total" : {
        "docs" : {
          "count" : 0,
          "deleted" : 0
        },
        "store" : {
          "size_in_bytes" : 432,
          "throttle_time_in_millis" : 0
        },
        "indexing" : {
          "index_total" : 0,
          "index_time_in_millis" : 0,
          "index_current" : 0,
          "delete_total" : 0,
          "delete_time_in_millis" : 0,
          "delete_current" : 0,
          "noop_update_total" : 0,
          "is_throttled" : false,
          "throttle_time_in_millis" : 0
        },
        "get" : {
          "total" : 0,
          "time_in_millis" : 0,
          "exists_total" : 0,
          "exists_time_in_millis" : 0,
          "missing_total" : 0,
          "missing_time_in_millis" : 0,
          "current" : 0
        },
        "search" : {
          "open_contexts" : 0,
          "query_total" : 144,
          "query_time_in_millis" : 272,
          "query_current" : 0,
          "fetch_total" : 0,
          "fetch_time_in_millis" : 0,
          "fetch_current" : 0
        },
        "merges" : {
          "current" : 0,
          "current_docs" : 0,
          "current_size_in_bytes" : 0,
          "total" : 0,
          "total_time_in_millis" : 0,
          "total_docs" : 0,
          "total_size_in_bytes" : 0
        },
        "refresh" : {
          "total" : 3,
          "total_time_in_millis" : 0
        },
        "flush" : {
          "total" : 6,
          "total_time_in_millis" : 23
        },
        "warmer" : {
          "current" : 0,
          "total" : 6,
          "total_time_in_millis" : 15
        },
        "filter_cache" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0
        },
        "id_cache" : {
          "memory_size_in_bytes" : 0
        },
        "fielddata" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0
        },
        "percolate" : {
          "total" : 0,
          "time_in_millis" : 0,
          "current" : 0,
          "memory_size_in_bytes" : -1,
          "memory_size" : "-1b",
          "queries" : 0
        },
        "completion" : {
          "size_in_bytes" : 0
        },
        "segments" : {
          "count" : 0,
          "memory_in_bytes" : 0,
          "index_writer_memory_in_bytes" : 0,
          "index_writer_max_memory_in_bytes" : 1536000,
          "version_map_memory_in_bytes" : 0,
          "fixed_bit_set_memory_in_bytes" : 0
        },
        "translog" : {
          "operations" : 0,
          "size_in_bytes" : 17
        },
        "suggest" : {
          "total" : 0,
          "time_in_millis" : 0,
          "current" : 0
        },
        "query_cache" : {
          "memory_size_in_bytes" : 0,
          "evictions" : 0,
          "hit_count" : 0,
          "miss_count" : 0
        },
        "recovery" : {
          "current_as_source" : 0,
          "current_as_target" : 0,
          "throttle_time_in_millis" : 0
        }
shaliko commented 8 years ago

@GUI Fixed issue by drop ElasticSearch data

curl -XDELETE 'http://localhost:14002/_all'

After that it stars works correctly and I see data on Analytics page.

Now prepare new installation from scratch and will provide for you more debug info.

shaliko commented 8 years ago

I tried enable DEBUG level in ElasticSearch conf (logging.yml.mustache), enabled error_log for Nginx and added debug code in Lua scripts, but not found root case yet.

Delete ElasticSearch data after docker container start fix issue.

curl -XDELETE 'http://localhost:14002/_all'
rabanian commented 8 years ago

hey guys, I have the same issue but @shaliko solution doesn't seem to solve it.. 13.0 installed, getting this error after running the curl: image

shaliko commented 8 years ago

@ofirtwo Try restart docker containers.

docker-compose restart
shaliko commented 8 years ago

@ofirtwo Actually later we found another issue. You need connect to you docker-container and install curl, the do restart.

docker exec -it CONTAINER_ID bash
apt-get update && apt-get install curl

Then from host machine:

docker restart CONTAINER_ID
rabanian commented 8 years ago

works now, thanks

GUI commented 7 years ago

This should be fixed in the v0.14.0 release.

marquicus commented 6 years ago

Version v0.14.4 same issue happens, the workaround doesn't work