This illustrates something unexpected about middleware with FastAPI and ddtrace. Below is are two examples of the log output from the minimal application provided here. The first being the log output when the decorator style middleware is added. The second when the decorator style middleware is removed, notice the trace and span ID values are 0. The question is, what is going such that the trace/span ID is only available in the ASGI spec when the decorator style is also applied.
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
declare module 'humio' { | |
interface Options { | |
ssl?: boolean; | |
host: string; | |
port: number; | |
basePath?: string; | |
dataspaceId?: string; | |
sessionId?: string; | |
includeClientMetadata?: boolean; | |
includeSessionId?: boolean; |
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
resource "aws_db_instance" "core" { | |
username = "postgres" | |
password = "changeme" | |
... | |
} | |
resource "null_resource" "master_password" { | |
triggers { | |
db_host = "${aws_db_instance.address}" | |
} |
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
#!/usr/bin/env python | |
import argparse | |
import sys | |
try: | |
import boto3 | |
except ImportError: | |
print('Please install boto3 to use this tool') | |
sys.exit(1) |
I hereby claim:
- I am mattupstate on github.
- I am mattupstate (https://keybase.io/mattupstate) on keybase.
- I have a public key whose fingerprint is 141F 4546 6A68 8F3D D2C7 0603 28D4 7F5D D3BC 77D5
To claim this, I am signing this object:
Timestamp: | 2015-05-19 23:11:38.372266224 +0000 UTC |
---|---|
Type: | heka.statmetric |
Hostname: | machine1 |
Pid: | 18895 |
Uuid: | f58719a6-999f-465b-8790-13fae230c0ca |
Logger: | users-frontend-stat-accum |
Payload: | users-frontend-machine1.counters.uwsgi.worker.1.delta_requests.rate 0.000000 1432077098 |
users-frontend-machine1.counters.uwsgi.worker.1.delta_requests.count 0 1432077098 users-frontend-machine1.counters.uwsgi.worker.2.delta_requests.rate 0.000000 1432077098 users-frontend-machine1.counters.uwsgi.worker.2.delta_requests.count 0 1432077098
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
try: | |
import boto | |
from boto import cloudformation | |
HAS_BOTO = True | |
except ImportError: | |
HAS_BOTO = 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
#!/usr/bin/env python3 | |
""" | |
Renders a partial SSH configuration file from Nodes and Services | |
located in a specified Consul catalog and then merges other partial | |
config files into the main ~/.ssh/config file. The Consul based SSH | |
config follows a convention for the SSH host:: | |
Host <consul-cluster-name>-<service-name>-<node-address> | |
User <ssh-user> | |
Hostname <consul-node-address> |
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
from dictalchemy import make_class_dictable | |
from flask import Flask, request, jsonify, json | |
from flask_sqlalchemy import SQLAlchemy | |
from jsonpatch import JsonPatch, JsonPatchException | |
app = Flask(__name__) | |
app.debug = True | |
db = SQLAlchemy(app) | |
make_class_dictable(db.Model) |
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 string | |
import uuid | |
alphabet = string.digits + string.ascii_letters | |
def base62_encode(n): | |
ret = '' | |
while n > 0: | |
ret = alphabet[n % 62] + ret | |
n /= 62 |
NewerOlder