Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions deployment/ds-hostnet-split/02-statsd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: envoy-statsd
namespace: heptio-contour
data:
statsd.yaml: |2-
mappings:
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.upstream_cx_connect_ms'
match_type: regex
name: "envoy_cluster_upstream_cx_connect_time"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.upstream_cx_length_ms'
match_type: regex
name: "envoy_cluster_upstream_cx_length"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.upstream_rq_time'
match_type: regex
name: "envoy_cluster_upstream_rq_time"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.internal.upstream_rq_time'
match_type: regex
name: "envoy_cluster_internal_upstream_rq_time"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.external.upstream_rq_time'
match_type: regex
name: "envoy_cluster_external_upstream_rq_time"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'cluster\.(.+?)_(.+?)_(.+?)\.canary.upstream_rq_time'
match_type: regex
name: "envoy_cluster_canary_upstream_rq_time"
timer_type: 'histogram'
labels:
cluster_name: "$1/$2/$3"
namespace: "$1"
service: "$2"
port: "$3"
- match: 'envoy.http.*.downstream_cx_length_ms'
name: "envoy_http_downstream_cx_length"
timer_type: 'histogram'
labels:
http_conn_manager_prefix: "$1"
- match: 'envoy.http.*.downstream_rq_time'
name: "envoy_http_downstream_rq_time"
timer_type: 'histogram'
labels:
http_conn_manager_prefix: "$1"
- match: '.'
match_type: 'regex'
action: 'drop'
name: 'dropped'
23 changes: 20 additions & 3 deletions deployment/ds-hostnet-split/03-envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ spec:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8002"
prometheus.io/path: "/stats"
prometheus.io/format: "prometheus"
prometheus.io/statsdport: "9102"
prometheus.io/path: "/stats/prometheus"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something or this will scrape only envoy metrics? stastd, I think, will gather only envoy and so will port 8002. Right?

I think metrics for the contour container (on endpoint /metrics and port 8000) are not gathered by this. Am I missing something? Hopefully I am :)

I will try to create a cluster and see if those are missing or not, it's too late here now to try this :-(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rata Contour metrics are scraped on the Contour deployment. This example is applied to the split model where Contour & Envoy are not colocated in the same pod.

Copy link
Contributor

@rata rata Apr 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, I see. Silly me, it was not obvious just looking quickly at the diff. Thanks! :)

labels:
app: envoy
spec:
Expand Down Expand Up @@ -57,7 +57,20 @@ spec:
lifecycle:
preStop:
exec:
command: ["wget", "-qO-", "http://localhost:9001/healthcheck/fail"]
command: ["wget", "-qO-", "http://localhost:9001/healthcheck/fail"]
- name: statsd-sink
image: prom/statsd-exporter:v0.6.0
command:
- "/bin/statsd_exporter"
Copy link
Contributor

@rata rata Apr 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: envoy 1.10.0 has just been released (like 2 hours ago) and supports histograms in prometheus export now (envoyproxy/envoy#5601 you shared it on slack a few days ago, so I understand you are aware :-D) . Does the sidecar add more metrics if envoy 1.10 is used?

I guess the answer is yes, as you shared that link on slack, but I really don't know and would like to understand if it doesn't bother you :). Also, I'm not sure when contour plans to upgrade to envoy 1.10, so even if the sidecar does not add more metrics, this of course can be totally relevant :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rata yes Envoy v1.10 has Histograms enabled so we can remove the statsd forwarder bit. I'm not sure when we'll upgrade to v1.10, we typically wait a bit to let any issues shake out. I'd like to still merge this for v1.9.1 and then we'll update with a future PR once we move to envoy v1.10

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the info! :)

args:
- "-statsd.mapping-config=/etc/statsd/statsd.yaml"
ports:
- containerPort: 9102
protocol: TCP
name: metrics
volumeMounts:
- name: statsd
mountPath: /etc/statsd
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
initContainers:
Expand All @@ -68,6 +81,7 @@ spec:
- $(CONTOUR_SERVICE_HOST)
- --xds-port
- $(CONTOUR_SERVICE_PORT)
- --statsd-enabled
command:
- contour
image: gcr.io/heptio-images/contour:master
Expand All @@ -80,4 +94,7 @@ spec:
volumes:
- name: contour-config
emptyDir: {}
- name: statsd
configMap:
name: envoy-statsd
restartPolicy: Always
6 changes: 6 additions & 0 deletions deployment/grafana/01-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: contour-monitoring
labels:
app: contour-monitoring
Loading