Skip to content

Add complete array of tags to rx_bytes and tx_bytes container metrics #1114

@cweibel

Description

@cweibel

Current behavior

When the rx_bytes and tx_bytes container metrics are enabled, only the source_id and instance_id tags are made available.

For all other container metrics, these tags are made available:

  • app_name
  • instance_id
  • organization_id
  • organization_name
  • process_id
  • process_instance_id
  • process_type
  • source_id
  • space_id
  • space_name

The subset of tags is currently hard coded with https://github.com/cloudfoundry/diego-release/blob/develop/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/client.go#L274-L280

Notice that the other container metrics defined above this also include the loggregator.WithEnvelopeTags(m.Tags) while the rx_bytes and tx_bytes do not.

The tags can be seen by running:

  • cf nozzle --no-filter | grep cpu_entitlement - shows the tags for a regular container metric
  • cf nozzle --no-filter | grep rx_bytes - shows the tags for a rx_bytes container metric

Desired behavior

The desired behavior is to have rx_bytes and tx_bytes have the same tags all the other container metrics do.

It might be possible that this would add the additional tags:

	if m.RxBytes != nil && !contains(c.appMetricExclusionFilter, "rx_bytes") {
		c.client.EmitCounter("rx_bytes", loggregator.WithCounterSourceInfo(m.Tags["source_id"], m.Tags["instance_id"]), loggregator.WithTotal(*m.RxBytes), loggregator.WithEnvelopeTags(m.Tags))
	}

	if m.TxBytes != nil && !contains(c.appMetricExclusionFilter, "tx_bytes") {
		c.client.EmitCounter("tx_bytes", loggregator.WithCounterSourceInfo(m.Tags["source_id"], m.Tags["instance_id"]), loggregator.WithTotal(*m.TxBytes), loggregator.WithEnvelopeTags(m.Tags))
	}

Since this is adding tags I don't believe there would be any backwards compatibility issues and brings them to the same set of tags as all the other container metrics. Also wouldn't require updates to the documented metrics at https://docs.cloudfoundry.org/loggregator/container-metrics.html

Affected Version

Current develop branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions