Is it possible to get open and closed HTTP connection metrics

I deployed Istio 1.3.0 in my K8s cluster with helm/tiller from this Site . Firstly, I am unable to see tcp_connection_opened_total and tcp_connection_closed_total. I have these metrics defined in instances, rules and handler but after port-forward prometheus I’m unable to see those metrics.

However, what I really wanted to see was the total number of http connections opened and closed ,so I created instance, rule and hander. for http connections closed. However I am unable to see this value as well. Could anyone help me out.

Instance
apiVersion: config.istio.io/v1alpha2
kind: instance
metadata:
  creationTimestamp: "2019-09-30T05:23:22Z"
  generation: 1
  labels:
    app: mixer
    chart: mixer
    heritage: Tiller
    release: istio
  name: requestcountclosed
  namespace: istio-system
  resourceVersion: "1510658"
  selfLink: /apis/config.istio.io/v1alpha2/namespaces/istio-system/instances/requestcount
  uid: 6b8946f2-e342-11e9-a337-42010af0016c
spec:
  compiledTemplate: metric
  params:
    dimensions:
      connection_security_policy: conditional((context.reporter.kind | "inbound")
        == "outbound", "unknown", conditional(connection.mtls | false, "mutual_tls",
        "none"))
      destination_app: destination.labels["app"] | "unknown"
      destination_principal: destination.principal | "unknown"
      destination_service: destination.service.host | "unknown"
      destination_service_name: destination.service.name | "unknown"
      destination_service_namespace: destination.service.namespace | "unknown"
      destination_version: destination.labels["version"] | "unknown"
      destination_workload: destination.workload.name | "unknown"
      destination_workload_namespace: destination.workload.namespace | "unknown"
      permissive_response_code: rbac.permissive.response_code | "none"
      permissive_response_policyid: rbac.permissive.effective_policy_id | "none"
      reporter: conditional((context.reporter.kind | "inbound") == "outbound", "source",
        "destination")
      request_protocol: api.protocol | context.protocol | "unknown"
      response_code: response.code | 200
      response_flags: context.proxy_error_code | "-"
      source_app: source.labels["app"] | "unknown"
      source_principal: source.principal | "unknown"
      source_version: source.labels["version"] | "unknown"
      source_workload: source.workload.name | "unknown"
      source_workload_namespace: source.workload.namespace | "unknown"
    monitored_resource_type: '"UNSPECIFIED"'
    value: "1"
Rule
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
  creationTimestamp: "2019-09-30T05:23:22Z"
  generation: 1
  labels:
    app: mixer
    chart: mixer
    heritage: Tiller
    release: istio
  name: promhttpclosed
  namespace: istio-system
  resourceVersion: "1510662"
  selfLink: /apis/config.istio.io/v1alpha2/namespaces/istio-system/rules/promhttp
  uid: 6b8c6b3a-e342-11e9-a337-42010af0016c
spec:
  actions:
  - handler: prometheus
    instances:
    - requestcountclosed
  match: (context.protocol == "http" || context.protocol == "grpc") && (match((request.useragent
    | "-"), "kube-probe*") == false) && (match((request.useragent | "-"), "Prometheus*")
    == false) && ((connection.event | "na") == "close") 
Handler
apiVersion: config.istio.io/v1alpha2
kind: handler
metadata:
  creationTimestamp: "2019-09-30T05:23:22Z"
  generation: 1
  labels:
    app: mixer
    chart: mixer
    heritage: Tiller
    release: istio
  name: prometheus
  namespace: istio-system
  resourceVersion: "1510650"
  selfLink: /apis/config.istio.io/v1alpha2/namespaces/istio-system/handlers/prometheus
  uid: 6b801e56-e342-11e9-a337-42010af0016c
spec:
  compiledAdapter: prometheus
  params:
    metrics:
    - instance_name: requestcount.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - request_protocol
      - response_code
      - response_flags
      - permissive_response_code
      - permissive_response_policyid
      - connection_security_policy
      name: requests_total
    - buckets:
        explicit_buckets:
          bounds:
          - 0.005
          - 0.01
          - 0.025
          - 0.05
          - 0.1
          - 0.25
          - 0.5
          - 1
          - 2.5
          - 5
          - 10
      instance_name: requestduration.instance.istio-system
      kind: DISTRIBUTION
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - request_protocol
      - response_code
      - response_flags
      - permissive_response_code
      - permissive_response_policyid
      - connection_security_policy
      name: request_duration_seconds
    - buckets:
        exponentialBuckets:
          growthFactor: 10
          numFiniteBuckets: 8
          scale: 1
      instance_name: requestsize.instance.istio-system
      kind: DISTRIBUTION
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - request_protocol
      - response_code
      - response_flags
      - permissive_response_code
      - permissive_response_policyid
      - connection_security_policy
      name: request_bytes
    - buckets:
        exponentialBuckets:
          growthFactor: 10
          numFiniteBuckets: 8
          scale: 1
      instance_name: responsesize.instance.istio-system
      kind: DISTRIBUTION
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - request_protocol
      - response_code
      - response_flags
      - permissive_response_code
      - permissive_response_policyid
      - connection_security_policy
      name: response_bytes
    - instance_name: tcpbytesent.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - connection_security_policy
      - response_flags
      name: tcp_sent_bytes_total
    - instance_name: tcpbytereceived.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - connection_security_policy
      - response_flags
      name: tcp_received_bytes_total
    - instance_name: tcpconnectionsopened.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - connection_security_policy
      - response_flags
      name: tcp_connections_opened_total
    - instance_name: tcpconnectionsclosed.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - connection_security_policy
      - response_flags
      name: tcp_connections_closed_total
    - instance_name: requestcountclosed.instance.istio-system
      kind: COUNTER
      label_names:
      - reporter
      - source_app
      - source_principal
      - source_workload
      - source_workload_namespace
      - source_version
      - destination_app
      - destination_principal
      - destination_workload
      - destination_workload_namespace
      - destination_version
      - destination_service
      - destination_service_name
      - destination_service_namespace
      - connection_security_policy
      - response_flags
      name: http_connections_closed_total
    metricsExpirationPolicy:
      metricsExpiryDuration: 10m

TCP attributes aren’t generated for situations in which the traffic can be identified as HTTP (and likewise the TCP metrics aren’t generated for HTTP traffic). So, attributes like connection.event won’t be available.

Thanks. I wanted to get number of http connections opened and closed but I guess it isn’t possible using istio. :frowning_face: