Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus Counter has 0 value in CW #576

Closed
vkuzniet opened this issue Jul 7, 2021 · 3 comments
Closed

Prometheus Counter has 0 value in CW #576

vkuzniet opened this issue Jul 7, 2021 · 3 comments
Labels
cloudwatch Cloudwatch related issues metrics Metrics related issue Prometheus Prometheus remote-write related issues

Comments

@vkuzniet
Copy link

vkuzniet commented Jul 7, 2021

I'm emitting a counter metric to count the number of bytes fetched for the container layer. If I call the prometheus metrics endpoint, I get the following:

# HELP stargz_fs_layer_fetched_size_bytes Total fetched size of the layer
# TYPE stargz_fs_layer_fetched_size_bytes counter
stargz_fs_layer_fetched_size_bytes{digest="sha256:b351995b18968208fc25eebd647205694d04876db60d4d79a67d1cc8ff50f4ff",mountpoint="/var/lib/containerd-stargz-grpc/snapshotter/snapshots/1/fs"} 775792
stargz_fs_layer_fetched_size_bytes{digest="sha256:c95ee4aba5b02db7bbf46410c26754b42ea8ce1cfbbdc40764f96fc6f044c30b",mountpoint="/var/lib/containerd-stargz-grpc/snapshotter/snapshots/2/fs"} 680

CW shows it as zero:

{
    "_aws": {
        "CloudWatchMetrics": [
            {
                "Namespace": "estargz_snapshotter",
                "Dimensions": [
                    [
                        "digest",
                        "mountpoint"
                    ],
                    [],
                    [
                        "digest"
                    ],
                    [
                        "mountpoint"
                    ]
                ],
                "Metrics": [
                    {
                        "Name": "stargz_fs_layer_fetched_size_bytes",
                        "Unit": "Bytes"
                    },
                    {
                        "Name": "stargz_fs_layer_size_bytes",
                        "Unit": "Bytes"
                    }
                ]
            }
        ],
        "Timestamp": 1625671639164
    },
    "digest": "sha256:b351995b18968208fc25eebd647205694d04876db60d4d79a67d1cc8ff50f4ff",
    "mountpoint": "/var/lib/containerd-stargz-grpc/snapshotter/snapshots/1/fs",
    "stargz_fs_layer_fetched_size_bytes": 0,
    "stargz_fs_layer_size_bytes": 0
}

Please see the Otel log and config files attached.

aws-otel-collector.log
aws-otel-collector.txt

@mxiamxia
Copy link
Member

mxiamxia commented Jul 8, 2021

The logs seems not bring any useful info. Does your counter metrics value generated in an incremental way? EMF Exporter currently calculate the delta (current value - previous value) for counter metrics. If you metrics values are not incremental, you could see negative or 0 in EMF logs.

Should the number of bytes fetched be sent as gauge metrics?

@vkuzniet
Copy link
Author

vkuzniet commented Jul 9, 2021

The way it is implemented in stargz snapshotter now is that layer fetch size and layer size are being exposed by implementing Collector interface and these are constant values per layer sha. See https://github.com/containerd/stargz-snapshotter/tree/main/fs/metrics/layer for more details. It was implemented as counter, since this seems to be the way it's done in containerd project as well.

I totally agree with the value going to 0 from timestamp 2 and going forward, however I'm having hard time to understand why there's no meaningful value for timestamp 1 (the first data point for that metric).

@alolita alolita added cloudwatch Cloudwatch related issues metrics Metrics related issue Prometheus Prometheus remote-write related issues labels Aug 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2022

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Jan 2, 2022
@alolita alolita removed the stale label Jan 3, 2022
@alolita alolita closed this as completed Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloudwatch Cloudwatch related issues metrics Metrics related issue Prometheus Prometheus remote-write related issues
Projects
None yet
Development

No branches or pull requests

3 participants