8000 Add set_secure_random_hex by ckiickA · Pull Request #28 · openresty/set-misc-nginx-module · GitHub
[go: up one dir, main page]

Skip to content

Conversation

ckiickA
Copy link
@ckiickA ckiickA commented Nov 19, 2015

Create a random hexadecimal string. Very useful for making trace-ids in X-B3-* headers for zipkin.

@agentzh
Copy link
Member
agentzh commented Nov 23, 2015

@ckiickA Have you looked at the existing set_secure_random_* directives?

See https://github.com/openresty/set-misc-nginx-module#set_secure_random_alphanum for example.

@ckiickA
Copy link
Author
ckiickA commented Nov 23, 2015

I have. However, there's no way to restrict the string generated to just hex digits. The Zipkin spec says traceid's are random hexadecimal 64 bit numbers. I attempted to use get_random and hex_encode, but hex_encode just gives the ascii codes of the digits.

@agentzh
Copy link
Member
agentzh commented Nov 23, 2015

@ckiickA Hmm, maybe you should use the ngx_lua module for such special requirements instead. Otherwise this simple ngx_set_misc module would keep growing forever, which is a bad thing IMHO :)

@ckiickA
Copy link
Author
ckiickA commented Nov 23, 2015

Not an option for our environment. I can use a custom patch for now. Just
thought you might find it useful.
Producing a random hex string doesn't seem that much of a special
requirement to me. I was surprised that none of the existing modules could
do it.
Anyway, do what you want with the PR. Just trying to give back.

On Mon, Nov 23, 2015 at 9:29 AM, Yichun Zhang notifications@github.com
wrote:

@ckiickA https://github.com/ckiickA Hmm, maybe you should use the
ngx_lua module for such special requirements instead. Otherwise this simple
ngx_set_misc module would keep growing forever, which is a bad thing IMHO :)


Reply to this email directly or view it on GitHub
#28 (comment)
.

Chris J. Kiick
Senior Performance Engineer, Atlassian
ckiick@atlassian.com

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

0