Skip to content

Instantly share code, notes, and snippets.

View shairyar's full-sized avatar

shairyar shairyar

View GitHub Profile
@shairyar
shairyar / MetricKeysQuery.gql
Last active February 7, 2024 10:24
Fetch custom metric from AppSignal
query MetricKeysQuery {
app(id: "YOUR-APP-ID") {
metrics {
keys(name: "custom_exports.send") {
name
tags {
key
value
}
mutation updateIncidentMutation($appId: String!, $number: Int!, $state: IncidentStateEnum, $description: String, $notificationFrequency: IncidentNotificationFrequencyEnum, $severity: IncidentSeverityEnum, $assigneeIds: [String!], $notificationThreshold: Int) {
updateIncident(
appId: $appId
number: $number
state: $state
description: $description
notificationFrequency: $notificationFrequency
notificationThreshold: $notificationThreshold
severity: $severity
assigneeIds: $assigneeIds
@shairyar
shairyar / appsignal.yml
Created December 1, 2023 05:55
AppSignal configuration file
default: &defaults
push_api_key: "PUSH-API-KEY"
request_headers:
- HTTP_ACCEPT
- HTTP_ACCEPT_CHARSET
- HTTP_ACCEPT_ENCODING
- HTTP_ACCEPT_LANGUAGE
- HTTP_CACHE_CONTROL
- HTTP_CONNECTION
@shairyar
shairyar / fetch_incident.gql
Last active July 21, 2023 07:51
GraphQL query to fetch incidents logged in AppSignal
query PaginatedExceptionIncidentsQuery($appId: String!, $namespaces: [String], $markerId: String, $limit: Int, $offset: Int, $state: IncidentStateEnum, $order: IncidentOrderEnum) {
app(id: $appId) {
id
paginatedExceptionIncidents(
namespaces: $namespaces
marker: $markerId
limit: $limit
state: $state
offset: $offset
order: $order
@shairyar
shairyar / uptime_monitor.gql
Last active May 17, 2023 12:21
Create uptime monitor in AppSignal using GraphQL API
mutation createUptimeMonitorMutation($appId: String!, $uptimeMonitor: UptimeMonitorInput!) {
createUptimeMonitor(appId: $appId, uptimeMonitor: $uptimeMonitor) {
...UptimeMonitor
__typename
}
}
fragment UptimeMonitor on UptimeMonitor {
id
name
@shairyar
shairyar / CustomMetricsDashboardsDefinitionQuery.gql
Created April 13, 2023 08:37
Export AppSignal dashboard metrics
query CustomMetricsDashboardsDefinitionQuery($appId: String!) {
app(id: $appId) {
id
dashboards {
...Dashboard
__typename
}
__typename
}
}
query PaginatedMetricsListQuery($appId: String!, $start: DateTime, $end: DateTime, $timeframe: TimeframeEnum, $query: [MetricAggregation!]!) {
app(id: $appId) {
id
metrics {
list(start: $start, end: $end, timeframe: $timeframe, query: $query) {
start
end
rows {
name
tags {
@shairyar
shairyar / transaction_allocation_count.gql
Created July 25, 2022 12:43
Query to help fetch object count for each action
query PaginatedMetricsListQuery(
$appId: String!,
$start: DateTime,
$end: DateTime,
$timeframe: TimeframeEnum,
$query: [MetricAggregation!]!
$limit: Int,
$offset: Int
){
app(id: $appId) {
query IncidentQuery($appId: String!, $incidentNumber: Int!, $sampleId: String, $timestamp: String, $timerange: [DateTime]) {
app(id: $appId) {
id
incident(incidentNumber: $incidentNumber) {
... on ExceptionIncident {
...ExceptionIncident
logbook {
...Logbook
__typename
}
@shairyar
shairyar / appsignal.rb
Last active December 24, 2021 06:36
Sending error to AppSignal using the frontend API
# https://docs.appsignal.com/api/public-endpoint/errors.html#body-parameters
require "uri"
require "json"
require "net/http"
url = URI("https://appsignal-endpoint.net/errors?api_key=FRONTEND-API-KEY")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true