ricardbejarano / graphql_exporter Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Prometheus exporter for GraphQL
License: MIT License
๐ฅ Prometheus exporter for GraphQL
License: MIT License
Hi, i am using Graphql exporter, I am unable to get all the responses into prometheus. example response from graphql:
{
"data": {
"data": [
{
"id": 1,
"name": "test",
"template": 1,
"nodes": [
{
"templateNode": {
"name": "EB",
"equipmentType": {
"name": "5216"
}
}
},
{
"templateNode": {
"name": "CT",
"equipmentType": {
"name": "CT"
}
}
},
{
"templateNode": {
"name": "RU",
"equipmentType": {
"name": "RRUS_11_B4"
}
}
},
{
"templateNode": {
"name": "RU-B7",
"equipmentType": {
"name": "RRUS_11_B7"
}
}
},
{
"templateNode": {
"name": "E500-1",
"equipmentType": {
"name": "E500"
}
}
},
{
"templateNode": {
"name": "UE-1",
"equipmentType": {
"name": "UE_QC_5605"
}
}
}
]
}
]
}
}
When I use promql query "query_data_nodes_templateNode_name" the response is:
query_data_nodes_templateNode_name{data="0", endpoint="http://127.0.0.1:8080/graphql", instance="127.0.0.1:9199", job="graphql-exporter", nodes="0", value="EB"}
As you can see in the response there is only EB returned but not CT and RU.
How to solve this issue? any suggestions?
Hi,
Is there any default grafana dashboard for graphql_exporter?
upon make command,
find . -name '*.go' -exec gofmt -e -s -w {} +
CGO_ENABLED=0 go build -o bin/graphql_exporter
query.go:14:2: cannot find package "github.com/prometheus/client_golang/prometheus" in any of:
/usr/lib/go-1.10/src/github.com/prometheus/client_golang/prometheus (from $GOROOT)
/root/go/src/github.com/prometheus/client_golang/prometheus (from $GOPATH)
main.go:9:2: cannot find package "github.com/prometheus/client_golang/prometheus/promhttp" in any of:
/usr/lib/go-1.10/src/github.com/prometheus/client_golang/prometheus/promhttp (from $GOROOT)
/root/go/src/github.com/prometheus/client_golang/prometheus/promhttp (from $GOPATH)
query.go:16:2: cannot find package "github.com/ricardbejarano/go-graphql" in any of:
/usr/lib/go-1.10/src/github.com/ricardbejarano/go-graphql (from $GOROOT)
/root/go/src/github.com/ricardbejarano/go-graphql (from $GOPATH)
main.go:10:2: cannot find package "github.com/usewormhol/env" in any of:
/usr/lib/go-1.10/src/github.com/usewormhol/env (from $GOROOT)
/root/go/src/github.com/usewormhol/env (from $GOPATH)
Makefile:7: recipe for target 'build' failed
make: *** [build] Error 1
any ideas?
Hi, I've got this exporter successfully querying against my GridQL endpoint, and it is returning the expected values, however, they arrive as a label rather than a value, and the metric value is always 1
:
curl -H 'Authorization: Token XXX' \
'https://my.server.com:9199/query?endpoint=https://my.api/v2/api/&query=<url_encoded_query>'
# HELP query_user_accounts_apps_logs_entries_data
# TYPE query_user_accounts_apps_logs_entries_data gauge
query_user_accounts_apps_logs_entries_data{accounts="0",apps="0",endpoint="https://my.api/v2/api/",entries="0",value="{\"data\": {\"latency\": 6226}, ...}}"} 1
This exporter seems to return the query results under the value
label, but it doesn't present them as an actual metric value per the Prometheus format: metric_name{metric_label1="abc",metric_label2="zxc"} 12345.34
I was able to use Prometheus' metric_relabel_configs
to extract the latency
from inside the value
label and put it into its own label, so now it looks like this in Prometheus:
query_user_accounts_apps_logs_entries_data{instance="localhost:9199", job="graphql_exporter", latency="6226", value="{"data": {"latency": 6226,...}}"}
However, I want to get the latency
value into proper Prometheus format like so:
query_user_accounts_apps_logs_entries_data{instance="localhost:9199", job="graphql_exporter"} 6226
Currently every metric value is just 1
so there's nothing useful to graph in Grafana. Am I missing something? Or is there a bug here? How do I get all the values out of the value
label and into actual metric values per Prometheus format? Thanks for your help!
Hi,
So I'm following the example listed as part of the prometheus.yml configuration.
{
viewer {
zones(filter: {zoneTag: "abc123"}) {
httpRequests1mGroups(limit: 1, filter: { datetime_gt: "2021-04-28T13:00:00Z", datetime_lt: "2021-04-28T14:01:00Z"}) {
dimensions {
datetime
}
sum {
bytes
}
}
}
}
}
Executing the above on a graphQL application, it works successfully and returns correct values, however as part of the prometheus configuration I'm getting error on graphql_exporter - error: queryHandler: no querying endpoint provided>
Can you kindly indicate me if i'm missing something
Per https://github.com/prometheus/prometheus/wiki/Default-port-allocations, port 9199
is reserved for the Cloudflare Exporter. This GraphQL Exporter should coordinate with Prometheus to reserve a unique port in order to avoid conflicts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.