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

feat: augment metrics with cid and cid+path counters #1429

Closed
wants to merge 1 commit into from

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Feb 21, 2022

As part of nftstorage/nftstorage.link#18 this PR augments metrics with query type counter. Prometheus metrics look as follows:


# HELP nftgateway_responses_by_query_type_total total of responses by query status. Either CID or CID+PATH.
# TYPE nftgateway_responses_by_query_type_total counter
nftgateway_responses_by_query_type_total{env="test",type="CID"} 1
nftgateway_responses_by_query_type_total{env="test",type="CID+PATH"} 1

@vasco-santos vasco-santos changed the title Feat/augment metrics mime type feat: augment metrics mime type Feb 21, 2022
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 21, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6afa2b7
Status: ✅  Deploy successful!
Preview URL: https://80632ea2.nft-storage-1at.pages.dev

View logs

@vasco-santos vasco-santos force-pushed the feat/augment-metrics-mime-type branch 4 times, most recently from 530da8a to ea58d1f Compare February 22, 2022 15:43
@vasco-santos vasco-santos changed the title feat: augment metrics mime type feat: augment metrics with mime type and query type Feb 22, 2022
@vasco-santos vasco-santos force-pushed the feat/augment-metrics-mime-type branch from ea58d1f to 6c30005 Compare February 22, 2022 18:07
@vasco-santos
Copy link
Contributor Author

Any suggestions for better naming for query type would be appreciated. Not super fan of it

@olizilla
Copy link
Contributor

📎 It looks like we are trying to use prometheus to do the job of http access logs We should explore https://www.cloudflare.com/en-gb/products/cloudflare-logs/ and a http access log summary tool.

@vasco-santos
Copy link
Contributor Author

📎 It looks like we are trying to use prometheus to do the job of http access logs

Thanks for the feedback. I actually understood that I could get part of this metrics with Cloudflare Analytics. Currently using Cloudflare Analytics to obtain content type using https://github.com/nftstorage/cloudflare-analytics-prometheus-exporter/ and this PR will simply focus on query type.

We already have a storage service for logs setup with Logtail and all the Logs go there. Sadly, they don't seem to offer any way of listening to the logtail source and parse inputs so that we can track metrics with a different app that exposes metrics to our Prometheus. They actually have a Grafana dashboard within Logtail, but we need to interact with the logs with SQL and it is quite complex to graph there rates of requests (for subdomain only) that are either CID or CID+Path format. Also, I would prefer to have everything in the same Grafana dashboard and just tracking here seems better than maintaining other service anyway.

@vasco-santos vasco-santos force-pushed the feat/augment-metrics-mime-type branch 5 times, most recently from e884f4c to 2f2d3c8 Compare March 31, 2022 09:54

histogramCandidates.forEach((candidate) => {
tmpHistogram[candidate] += 1
function getUpdatedHistogram(histogramData, histogramBuckets, value) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies for adding this refactor here 😬 I did the code because this PR already had MimeTypes histogram, but now I think we should keep it as it simplifies current histograms and if we add more in the future

@vasco-santos vasco-santos changed the title feat: augment metrics with mime type and query type feat: augment metrics with cid and cid+path counters Mar 31, 2022
@vasco-santos vasco-santos marked this pull request as ready for review March 31, 2022 09:58
@vasco-santos vasco-santos force-pushed the feat/augment-metrics-mime-type branch from 2f2d3c8 to 6afa2b7 Compare March 31, 2022 12:08
@vasco-santos
Copy link
Contributor Author

Closed in favour of nftstorage/nftstorage.link#15 as we moved gateway to new repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants