- Running on Flink v1.13.2
- as a AWS Kinesis Data Analytics application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { visit, print } from 'graphql' | |
import { gql } from 'graphql-tag' | |
// import the models from the generated code | |
import { getStudent, getTeacher, getClass } from '../graphql/queries' | |
const getModelSelectionSet = modelDoc => | |
modelDoc.definitions[0].selectionSet.selections[0].selectionSet | |
const attachModelDoc = (doc, fieldName, childDoc) => | |
visit(doc, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dns = require('dns') | |
const https = require('https') | |
const url = 'https://example.com' | |
const { hostname } = new URL(url) | |
const doLookup = async () => new Promise(resolve => { | |
const start = new Date() | |
dns.lookup(hostname, () => { | |
console.log('dns.lookup', Date.now() - start) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dns = require('dns') | |
const https = require('https') | |
const url = 'https://example.com' | |
const { hostname } = new URL(url) | |
const doLookup = () => new Promise(resolve => { | |
dns.lookup(hostname, resolve) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const opentelemetry = require('@opentelemetry/sdk-node') | |
// const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node') | |
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns') | |
const { AwsLambdaInstrumentation } = require('@opentelemetry/instrumentation-aws-lambda') | |
const { AWSXRayIdGenerator } = require('@opentelemetry/id-generator-aws-xray') | |
const { AWSXRayPropagator } = require('@opentelemetry/propagator-aws-xray') | |
// const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http') | |
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-proto') | |
const CONSOLE_DEBUG = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
api: | |
build: | |
# ...snip... | |
awscollector: | |
image: public.ecr.aws/aws-observability/aws-otel-collector | |
ports: | |
- '4317:4317' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dlt | |
from pyspark.sql.functions import from_json, col, expr, transform_values, transform, coalesce | |
from pyspark.sql.types import * | |
nf_cdc_schema = StructType([ | |
StructField('eventName', StringType()), | |
StructField('dynamodb', StructType([ | |
StructField('ApproximateCreationDateTime', LongType()), | |
StructField('NewImage', StructType([ | |
StructField('service', StructType([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zlib | |
from datetime import datetime | |
import dpkt | |
def get_tcpip_frame(buf): | |
# standard pcap uses ethernet root layer | |
eth = dpkt.ethernet.Ethernet(buf) | |
if isinstance(eth.data, dpkt.ip6.IP6): | |
# print('Unexpected: IPv6 protocol') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { parse } from 'parse5' | |
import { adapter } from 'parse5-htmlparser2-tree-adapter' | |
import xpath from 'xpath' | |
const html = '...' | |
const selector = '...' | |
const doc = parse(html, { treeAdapter: adapter }) | |
const htmlEl = doc.childNodes.find(c => c.name === 'html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { visit, visitWithTypeInfo, TypeInfo, Kind } = require('graphql') | |
const { MapperKind, mapSchema, visitData } = require('@graphql-tools/utils') | |
const { GraphQLObjectType, GraphQLID } = require('graphql') | |
class Transform { | |
constructor(groupTypes, typeIdFields) { | |
this.groupTypes = groupTypes | |
this.typeIdFields = typeIdFields | |
} |