user3310115
user3310115

Reputation: 1460

Docker port issue with prometheus+springboot

I'm trying to connect to get the endpoint metrics via a prometheus docker image. Below is my yml file. However I'm getting the error Get http://localhost:8080/assessments/metrics: dial tcp 127.0.0.1:8080: connect: connection refused from prometheus. It runs if I do it from the browser though. How can I map the port so that docker recognises it.

global:
  scrape_interval:     15s
  evaluation_interval: 15s

rule_files:
  # - "first.rules"
  # - "second.rules"

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'assessments'
    metrics_path: /assessments/metrics
    static_configs:
      - targets: ['localhost:8080']
~                                       

Upvotes: 2

Views: 987

Answers (1)

user3310115
user3310115

Reputation: 1460

I was able to fix this by modifying my yml with docker.for.mac.localhost:8080. This made it realise that it had to look for port 8080 in mac

Upvotes: 3

Related Questions