Skip to content

Commit

Permalink
add VCL on Compute metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
leklund committed Apr 18, 2024
1 parent 2d2c4d0 commit 318b6de
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/realtime/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ type Metrics struct {
SynthsTotal *prometheus.CounterVec
TLSTotal *prometheus.CounterVec
UncacheableTotal *prometheus.CounterVec
VclOnComputeEdgeHitRequestsTotal *prometheus.CounterVec
VclOnComputeEdgeMissRequestsTotal *prometheus.CounterVec
VclOnComputeErrorRequestsTotal *prometheus.CounterVec
VclOnComputeHitRequestsTotal *prometheus.CounterVec
VclOnComputeMissRequestsTotal *prometheus.CounterVec
VclOnComputePassRequestsTotal *prometheus.CounterVec
VclOnComputeSynthRequestsTotal *prometheus.CounterVec
VideoTotal *prometheus.CounterVec
WAFBlockedTotal *prometheus.CounterVec
WAFLoggedTotal *prometheus.CounterVec
Expand Down Expand Up @@ -402,6 +409,13 @@ func NewMetrics(namespace, subsystem string, nameFilter filter.Filter, r prometh
SynthsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "synth_total", Help: "TODO"}, []string{"service_id", "service_name", "datacenter"}),
TLSTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "tls_total", Help: "Number of requests that were received over TLS."}, []string{"service_id", "service_name", "datacenter", "tls_version"}),
UncacheableTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "uncacheable_total", Help: "Number of requests that were designated uncachable."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeHitRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_hit_requests_total", Help: "Number of cache hits for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeMissRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_miss_requests_total", Help: "Number of cache misses for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputePassRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_pass_requests_total", Help: "Number of requests that passed through the CDN without being cached for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeErrorRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_error_requests_total", Help: "Number of cache errors for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeSynthRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_synth_requests_total", Help: "Number of requests that returned a synthetic response (i.e., response objects created with the synthetic VCL statement) for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeEdgeHitRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_edge_hit_requests_total", Help: "Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VclOnComputeEdgeMissRequestsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "vcl_on_compute_edge_miss_requests_total", Help: "Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute."}, []string{"service_id", "service_name", "datacenter"}),
VideoTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "video_total", Help: "Number of responses with the video segment or video manifest MIME type (i.e., application/x-mpegurl, application/vnd.apple.mpegurl, application/f4m, application/dash+xml, application/vnd.ms-sstr+xml, ideo/mp2t, audio/aac, video/f4f, video/x-flv, video/mp4, audio/mp4)."}, []string{"service_id", "service_name", "datacenter"}),
WAFBlockedTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "waf_blocked_total", Help: "Number of requests that triggered a WAF rule and were blocked."}, []string{"service_id", "service_name", "datacenter"}),
WAFLoggedTotal: prometheus.NewCounterVec(prometheus.CounterOpts{Namespace: namespace, Subsystem: subsystem, Name: "waf_logged_total", Help: "Number of requests that triggered a WAF rule and were logged."}, []string{"service_id", "service_name", "datacenter"}),
Expand Down
7 changes: 7 additions & 0 deletions pkg/realtime/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ func Process(response *Response, serviceID, serviceName, serviceVersion string,
m.TLSTotal.WithLabelValues(serviceID, serviceName, datacenter, "1.2").Add(float64(stats.TLSv12))
m.TLSTotal.WithLabelValues(serviceID, serviceName, datacenter, "1.3").Add(float64(stats.TLSv13))
m.UncacheableTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.Uncacheable))
m.VclOnComputeHitRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeHitRequests))
m.VclOnComputeMissRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeMissRequests))
m.VclOnComputePassRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputePassRequests))
m.VclOnComputeErrorRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeErrorRequests))
m.VclOnComputeSynthRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeSynthRequests))
m.VclOnComputeEdgeHitRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeEdgeHitRequests))
m.VclOnComputeEdgeMissRequestsTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.VclOnComputeEdgeMissRequests))
m.VideoTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.Video))
m.WAFBlockedTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.WAFBlocked))
m.WAFLoggedTotal.WithLabelValues(serviceID, serviceName, datacenter).Add(float64(stats.WAFLogged))
Expand Down
7 changes: 7 additions & 0 deletions pkg/realtime/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ type Datacenter struct {
TLSv12 uint64 `json:"tls_v12"`
TLSv13 uint64 `json:"tls_v13"`
Uncacheable uint64 `json:"uncacheable"`
VclOnComputeEdgeHitRequests uint64 `json:"vcl_on_compute_edge_hit_requests"`
VclOnComputeEdgeMissRequests uint64 `json:"vcl_on_compute_edge_miss_requests"`
VclOnComputeErrorRequests uint64 `json:"vcl_on_compute_error_requests"`
VclOnComputeHitRequests uint64 `json:"vcl_on_compute_hit_requests"`
VclOnComputeMissRequests uint64 `json:"vcl_on_compute_miss_requests"`
VclOnComputePassRequests uint64 `json:"vcl_on_compute_pass_requests"`
VclOnComputeSynthRequests uint64 `json:"vcl_on_compute_synth_requests"`
Video uint64 `json:"video"`
WAFBlocked uint64 `json:"waf_blocked"`
WAFLogged uint64 `json:"waf_logged"`
Expand Down
70 changes: 70 additions & 0 deletions pkg/rt/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4333,6 +4333,76 @@ var expectedRTMetricsOutputMap = map[string]float64{
`testspace_testsystem_uncacheable_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_uncacheable_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_uncacheable_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_hit_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_miss_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_pass_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_error_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_synth_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_hit_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="HHN",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="LGA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="SEA",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="SYD",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="TYO",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="YUL",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_vcl_on_compute_edge_miss_requests_total{datacenter="YYZ",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_video_total{datacenter="BUR",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_video_total{datacenter="BWI",service_id="my-service-id",service_name="my-service-name"}`: 0,
`testspace_testsystem_video_total{datacenter="FRA",service_id="my-service-id",service_name="my-service-name"}`: 0,
Expand Down

0 comments on commit 318b6de

Please sign in to comment.