Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): correctly handle AUTHENTICATION_HEADER_VALUE_RE env variable #2257

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

prymitive
Copy link
Owner

SILENCEFORM_AUTHOR_POPULATE_FROM_HEADER_* env support was removed, but old code is still present, remove it.
Correctly parse AUTHENTICATION_HEADER_VALUE_RE env variable into authentication.header.value_re config option.

Fixes #2246

…iable

SILENCEFORM_AUTHOR_POPULATE_FROM_HEADER_* env support was removed, but old code is still present, remove it.
Correctly parse AUTHENTICATION_HEADER_VALUE_RE env variable into authentication.header.value_re config option.

Fixes #2246
case "SILENCEFORM_AUTHOR_POPULATE_FROM_HEADER_VALUE_RE":
return "silenceForm.author.populate_from_header.value_re"
case "AUTHENTICATION_HEADER_VALUE_RE":
return "authentication.header.value_re"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is AUTHENTICATION_HEADER_NAME needed here as well?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this whole section is only needed because all underscores are converted to dots. So AUTHENTICATION_HEADER_VALUE_RE becomes authentication.header.value.re while [...].value_re is needed.
A better naming convention would avoid this whole problem.

@prymitive
Copy link
Owner Author

Go benchmark diff

name                               old time/op        new time/op        delta
pkg:github.com/prymitive/karma/cmd/karma goos:linux goarch:amd64
Compress/Run-2                           4.97ms ± 1%        4.95ms ± 1%    ~     (p=0.079 n=9+10)
Decompress/Run-2                         3.34ms ± 1%        3.40ms ± 4%  +1.95%  (p=0.011 n=10+10)
CompressionAndDecompression/Run-2        8.62ms ± 2%        8.61ms ± 1%    ~     (p=0.684 n=10+10)
PullAlerts/0.19.0-2                      5.55ms ± 1%        5.61ms ± 1%  +1.11%  (p=0.001 n=8+10)
AlertsAPIMisses/0.19.0-2                 1.33ms ± 2%        1.33ms ± 1%    ~     (p=0.796 n=10+10)
AlertsAPIHits/0.19.0-2                    889µs ± 2%         886µs ± 1%    ~     (p=0.447 n=10+9)
pkg:github.com/prymitive/karma/internal/alertmanager goos:linux goarch:amd64
DedupAlerts/Run-2                         119µs ± 0%         119µs ± 2%    ~     (p=0.370 n=8+9)
DedupAutocomplete/Run-2                  55.4µs ± 1%        55.6µs ± 1%    ~     (p=0.243 n=9+10)
DedupColors/Run-2                        15.4µs ± 1%        15.6µs ± 1%  +1.43%  (p=0.000 n=9+9)

name                               old %/compression  new %/compression  delta
pkg:github.com/prymitive/karma/cmd/karma goos:linux goarch:amd64
Compress/Run-2                             0.04 ± 0%          0.04 ± 0%    ~     (all equal)

name                               old B/alloc        new B/alloc        delta
pkg:github.com/prymitive/karma/cmd/karma goos:linux goarch:amd64
Compress/Run-2                            4.99M ± 0%         4.99M ± 0%  -0.06%  (p=0.006 n=7+9)
Decompress/Run-2                          3.10M ± 0%         3.10M ± 0%  -0.15%  (p=0.001 n=10+10)
CompressionAndDecompression/Run-2         5.00M ± 0%         4.99M ± 0%  -0.12%  (p=0.000 n=10+9)
PullAlerts/0.19.0-2                       3.06M ± 0%         3.05M ± 0%  -0.13%  (p=0.000 n=8+10)
AlertsAPIMisses/0.19.0-2                  3.46M ± 0%         3.45M ± 0%  -0.04%  (p=0.000 n=9+9)
AlertsAPIHits/0.19.0-2                    3.42M ± 0%         3.42M ± 0%  -0.05%  (p=0.000 n=9+9)

name                               old alloc/op       new alloc/op       delta
pkg:github.com/prymitive/karma/cmd/karma goos:linux goarch:amd64
Compress/Run-2                           1.13MB ± 0%        1.13MB ± 0%    ~     (all equal)
Decompress/Run-2                         4.24MB ± 0%        4.24MB ± 0%    ~     (p=0.137 n=10+8)
CompressionAndDecompression/Run-2        5.38MB ± 0%        5.38MB ± 0%    ~     (all equal)
PullAlerts/0.19.0-2                      1.27MB ± 0%        1.27MB ± 0%    ~     (p=0.968 n=10+9)
AlertsAPIMisses/0.19.0-2                 1.29MB ± 0%        1.29MB ± 0%    ~     (p=0.089 n=10+10)
AlertsAPIHits/0.19.0-2                    317kB ± 1%         318kB ± 1%    ~     (p=0.353 n=10+10)
pkg:github.com/prymitive/karma/internal/alertmanager goos:linux goarch:amd64
DedupAlerts/Run-2                        73.7kB ± 0%        73.7kB ± 0%    ~     (p=0.586 n=10+10)
DedupAutocomplete/Run-2                  27.2kB ± 0%        27.2kB ± 0%    ~     (p=0.094 n=10+8)
DedupColors/Run-2                        7.36kB ± 0%        7.36kB ± 0%    ~     (p=0.087 n=10+10)

name                               old allocs/op      new allocs/op      delta
pkg:github.com/prymitive/karma/cmd/karma goos:linux goarch:amd64
Compress/Run-2                             31.0 ± 0%          31.0 ± 0%    ~     (all equal)
Decompress/Run-2                           80.0 ± 0%          80.0 ± 0%    ~     (all equal)
CompressionAndDecompression/Run-2           111 ± 0%           111 ± 0%    ~     (all equal)
PullAlerts/0.19.0-2                       22.5k ± 0%         22.5k ± 0%    ~     (all equal)
AlertsAPIMisses/0.19.0-2                  6.08k ± 0%         6.08k ± 0%    ~     (p=0.248 n=10+9)
AlertsAPIHits/0.19.0-2                    2.36k ± 0%         2.36k ± 0%    ~     (p=1.000 n=10+10)
pkg:github.com/prymitive/karma/internal/alertmanager goos:linux goarch:amd64
DedupAlerts/Run-2                           415 ± 0%           415 ± 0%    ~     (all equal)
DedupAutocomplete/Run-2                     114 ± 0%           114 ± 0%    ~     (all equal)
DedupColors/Run-2                          35.0 ± 0%          35.0 ± 0%    ~     (all equal)

@prymitive prymitive merged commit 54b475d into master Oct 6, 2020
@prymitive prymitive deleted the auth-env branch October 6, 2020 11:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

silenceForm.author.populate_from_header variables no longer needed?
2 participants