Commit Graph

600 Commits

Author SHA1 Message Date
Stephan Renatus 36590cd766 deps: bump wasmtime-go v37 -> v39
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-11-26 11:26:48 +01:00
Anders Eknert 51a50ca042 Concurrent Rego parsing in bundle loader (#8067)
Parsing is generally fast, so this mainly improves performance
of creating big bundles with many Rego files in them. For Regal's
embedded bundle, loading it from memory would previously take 16
ms on my laptop, and now it takes 9 ms. There are other things
in this process that could be concurrent too, like JSON unmarshalling
of multiple data files. But starting with parsing modules.

This PR adds `errgroup` as a direct dependency (previously indirect)
as it is a nicer way to work with wait groups, and one that can be
useful elsewhere in the codebase (like in the compiler).

Also, and as usual, went off on a bit of a tangent refactoring code
related to the bundle build process, and made sure to use some common
helpers in code where available.

Signed-off-by: Anders Eknert <anders.eknert@apple.com>
2025-11-21 08:42:43 +01:00
Anders Eknert e03ac2f200 Bump golangci-lint, more gocritic linters (#8052)
- Bump golangci-lint -> 2.6.2
- Fix all `deprecatedComment` "notices should be in a dedicated paragraph, separated from the rest" reports
- Enable `appendCombine` and fix all "appendCombine: can combine chain of X appends into one" notices
- Enable `preferFprint` and fix the few reported issues
- Fix various issues reported only once or twice, like `zeroByteRepeat`

Signed-off-by: Anders Eknert <anders.eknert@apple.com>
2025-11-17 11:08:39 +01:00
Anders Eknert 30d3346fb4 New custom SemVer implementation (#8010)
This was something I originally intended to use in another project,
but since this turned out to be a better implementation (subject of
course to review!) in terms of both performance and simplicity, I
figured we might as well use it here too. Some changes include:

- `MustParse` to parse known valid versions
- Allocates nothing in any operations other than 1 alloc in `String()`
- Ignores empty `PreRelease` and `Metadata` fields in serialization
- `encoding.TextAppender` implementation to serialize without allocating
- A whole bunch of benchmarks

Signed-off-by: Anders Eknert <anders@eknert.com>
2025-11-04 09:09:50 +01:00
Johan Fylling e6865c4c9f Prepare v1.10.0 release (#8002)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-10-31 14:15:30 +01:00
Stephan Renatus 9a864c6398 compile: add support for "any value at all", as IS NOT NULL (#7998)
* compile: support "equal to whatever" as "IS NOT NULL"

Fixes https://github.com/open-policy-agent/opa/issues/7996.

This only deals with SQL targets for starters.

This issue also came out of the discussion with @huntkalio.

* compile: expand support for "_ = <unknown>" to prisma

It seems like the translation is pretty straightforward here, so
let's include it.

Reference: https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting#filter-for-non-null-fields

* docs/compile: mention fragment addition

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-10-29 13:38:28 +01:00
Anders Eknert f5eeb07bd2 Refactor hash key equality function (#7969)
This was previously done in several places in a somewhat convoluted way,
which probably made sense at some point. As expected however, a few small
local variations had emerged, and while nothing critical, this code wasn't
very nice to work with.

Some comments stated as the rationale for the design was avoiding allocations,
but those were nowhere to be seen when measured now, meaning there was no good
reason to have it remain this way! It was *quite* nice to be able to merge
the numbers comparsion functions (in particular) together into one!

We now have a unified way for comparing Number values throughout the AST package,
and as an added bonus, `1.0 == 1` is now true consistently for Rego.

See for example @srenatus example in https://github.com/open-policy-agent/opa/issues/4797

```
$ opa eval -fpretty 'count({1.0, 1})'
2
```

Doing the same now gives:
```
$ go run main.go eval -fpretty 'count({1.0, 1})'
1

$ go run main.go eval -fpretty 'count({1.0, 1, 1.000, 1.00000})'
1
```

What I have left out for now is however _presentation_. Meaning that
even though 1.0 and 1 is now treated as the same value, you may still
see either '1' or 1.0' (or whatever) displayed, depending on what was
parsed. Should be easy to fix, but could perhaps be perceived as
surprising... so holding off on that until we've had a discussion on
the topic.

Signed-off-by: Anders Eknert <anders@eknert.com>
2025-10-28 22:30:52 +01:00
Stephan Renatus d9ff3190d5 deps(build): bump wasmtime-go: v3 -> v37, crossbuild with zig
Due the way that wasmtime-go does its versioning, it seems to fly under
the radar of dependabot: that will never propose major version bumps, I
suppose.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-10-16 19:17:21 +02:00
Stephan Renatus 40ec031d5c build: bump golang for build: 1.25.1 -> 1.25.2
https://groups.google.com/g/golang-announce/c/4Emdl2iQ_bI

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-10-13 17:22:04 +02:00
Anders Eknert d3f34a3387 Modernize analyzer fixes (#7965)
Have done this some time in the past, but there was a few
new issues this would highlight now that we're on Go 1.24.

Mostly:
- Use `b.Loop()` in benchmarks
- Use `strings.SplitSeq` where possible
- Remove `omitempty` tag for types that can't be empty

Signed-off-by: Anders Eknert <anders@eknert.com>
2025-10-10 17:51:02 +02:00
Jacob Hochstetler 2cc948d872 TLM: Upgrade to v1 tablewriter (#7937)
- Updated test fixtures and various test fixes.

Signed-off-by: Jacob Hochstetler <jacob.hochstetler@gmail.com>
2025-10-01 10:44:42 +02:00
Anders Eknert e1e2bfb876 Some small improvements to inmem storage (#7944)
Mainly making transactions cheaper to create, and read transactions
much cheaper.

- Add exported RootPath shorthand var
- Don't return path on ParsePathEscaped failure
- Allocate nothing for read transactions, other than the transaction itself
- Lazy init of write update collections to avoid needless allocations
- Add benchmarks

**Before**
```
BenchmarkNewTransaction/Read-16                     26707234            44.78 ns/op      144 B/op          3 allocs/op
BenchmarkNewTransaction/Write-16                    20344212            59.44 ns/op      192 B/op          4 allocs/op
BenchmarkReadOne/Go_store_(roundtrip)-16            21963003            54.41 ns/op      144 B/op          3 allocs/op
BenchmarkReadOne/Go_store_(no_roundtrip)-16         22217593            54.18 ns/op      144 B/op          3 allocs/op
BenchmarkReadOne/AST_store_(roundtrip)-16           15626653            76.52 ns/op      160 B/op          4 allocs/op
BenchmarkReadOne/AST_store_(no_roundtrip)-16        15820837            76.15 ns/op      160 B/op          4 allocs/op
```

**After**
```
BenchmarkNewTransaction/Read-16                     68091271            17.37 ns/op       48 B/op          1 allocs/op
BenchmarkNewTransaction/Write-16                    24928028            47.68 ns/op      144 B/op          3 allocs/op
BenchmarkReadOne/Go_store_(roundtrip)-16            42967630            28.10 ns/op       48 B/op          1 allocs/op
BenchmarkReadOne/Go_store_(no_roundtrip)-16         43825009            27.63 ns/op       48 B/op          1 allocs/op
BenchmarkReadOne/AST_store_(roundtrip)-16           24885938            48.06 ns/op       64 B/op          2 allocs/op
BenchmarkReadOne/AST_store_(no_roundtrip)-16        25012396            47.96 ns/op       64 B/op          2 allocs/op
```

Signed-off-by: Anders Eknert <anders@eknert.com>
2025-09-30 00:00:39 +02:00
Stephan Renatus 85a0e2a28c Compile API: switch to compile annotation key (#7936)
* ast: add compile annotation key

This used to be

```
  custom:
    unknowns: [ ... ]
    mask_rule: ...
```

and now becomes
```
  compile:
    unknowns: [ ... ]
    mask_rule: ...
```

* server: adapt compile handler annotations processing

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-09-24 10:53:17 +02:00
Stephan Renatus cef6c430b1 build+ci: fix go versions
- build with 1.25.1 (.go-version)
- go-compat test run with 1.24.*
- adjust prometheus metrics test

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-09-22 13:44:51 +02:00
Stephan Renatus 4ab2ac0c61 Port Compile API extensions from EOPA (#7887)
* server: port compile API

Also adds e2e tests: These include coverage for ucast in the prisma
setting, and thus require some JS runtime.

* e2e: selectively skip e2e Compile API tests

...for macos runs, and for the go-compat suites.

* server: accept timer_rego_external_resolve_ns metrics with value 0

When running the tests in a loop for a while, I would see values of 0ns
for this metric. However, comparing with its non-zero values, which are
often 41 or 42ns, it seems like this is just not happening in this code
path. So if "almost nothing" actually goes below 1ns, it's OK.

* e2e: split dep-heavy e2e tests into their own go module
* Makefile: export DOCKER_RUNNING (make e2e read it)

---------

Co-authored-by: Philip Conrad <philip@chariot-chaser.net>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-09-22 12:11:06 +02:00
Sebastian Spaink d102e453e5 fix: print eval errors to stderr (#7880)
updated the presentation package print functions to accept a parameter to print to stderr.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2025-09-11 16:13:15 -05:00
Sebastian Spaink a558332b7d fix: only skip initializing file loader in bundle-mode (#7876)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2025-09-03 16:06:44 -05:00
Sebastian Spaink 8c0079f551 Bump golangci-lint to v2.4.0 (#7878)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2025-09-03 15:21:30 -05:00
Stephan Renatus cf305db318 internal/report: allow overriding GitHub repo
Previously, we've allowed overriding the GitHub API endpoint. Now, we
can also allow overriding the GitHub Repo slug used in the API call.

A concrete use is EOPA checking for new EOPA versions, as opposed to
comparing its version against OPA's version.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-08-28 14:54:08 +02:00
Ville Vesilehto f77322b3fb build: bump Go version requirement to 1.24 (#7839)
Go 1.23 is no longer supported as per Go release policy.

Changes:

- Use Go v1.24.6 as the project SDK requirement
- Apply lint fixes for Go 1.24
- Fix "non-constant format string in call" issues as seen in CI.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-24 09:02:09 +02:00
Johan Fylling 5ac310470e build: Bump go to 1.24.6 (1.23.12) (#7834)
Build version: from 1.24.4 to 1.24.6
SDK version: from 1.23.8 to 1.23.12

See: https://pkg.go.dev/vuln/GO-2025-3849

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-08-12 18:36:54 +02:00
Stephan Renatus 4a5d9735c8 config: accept env vars set to "", discern from unset
Fixes #7831 to a certain extent.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-08-11 21:03:00 +02:00
lestrrat b08a1df858 Upgrade interned jwx (0.9.x) with github.com/lestrrat-go/jwx/v3 (#7733)
Fixes: #7638

Signed-off-by: Daisuke Maki <lestrrat+github@gmail.com>
2025-08-04 16:41:09 +02:00
Stephan Renatus f78319008a internal/config: keep unknown env replacements
Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-07-23 18:55:43 +02:00
Teemu Koponen 2d014a89bb plugins/discovery: Replace environment variables after evaluation.
This allows simple setups -- those feeding the OPA discovery plugin with
a static JSON file -- to still do env variable replacements.

This should be possible already, by using a policy to construct the
disco config, but it becomes easier now.

Co-authored-by: Teemu Koponen <koponen@styra.com>
Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-07-23 17:09:41 +02:00
Philip Conrad 5a872a4166 bundle: Add support for bundle store and activation plugins. (#7771)
This commit adds support for changing out how bundle storage and
activation work. To allow swapping out bundle activation, two new
`bundle` package functions are provided:

 - `RegisterActivator`: Registers a bundle.Activator with a string ID.
 - `RegisterDefaultBundleActivator`: Sets the default bundle.Activator to
   use by ID.

Behind the scenes, a few new `bundle` package variables are used to
track what bundle activators are available, and which is the preferred
default.

This system allows registering many activators, and allows choosing the
bundle activator to use at activation time. The activator to use is
decided in the following order:

 - `(bundle.ActivateOpts).Plugin` is used when non-nil.
 - `bundle.bundleExtActivator` is used when an ID was set with
   `RegisterDefaultBundleActivator`.
 - The default/original bundle activator is used if no other selection
   was made.

To support swapping out bundle storage (useful when testing new bundle
designs), a new `bundle` package function is provided:

 - `RegisterStoreFunc`: Sets the function to use for creating bundle
   storage.

These two features together allow swapping out most of the bundle
activation flow, without requiring deep modification of the `bundle`
package. Lazy bundle loading mode is also enabled across many CLI
commands and other bundle loading points now when a non-default bundle
activator is set.

Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
Co-authored-by: Ashutosh Narkar <anarkar4387@gmail.com>
2025-07-17 17:23:12 +00:00
Stephan Renatus 3b5545ba1d server: ensure that wrapped middlewares all support http.Flusher
Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-07-15 18:09:16 +02:00
Philip Conrad 70e5ad126b loader+internal: Add bundle lazy loading mode across the runtime. (#7768)
This commit comprehensively plumbs in the bundle lazy loading mode
option in the compile, runtime, rego, and bundle packages. It also
includes the bare minimum plumbing to allow the path watcher utilities
to also toggle the option on.

In nearly all places where a default is expected, the lazy loading mode
is set to false (disabled) to avoid behavior changes.

Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
2025-07-11 20:18:18 +00:00
Johan Fylling 9a423eceab report: Fetching latest OPA release version from GH (#7756)
instead of telemetry server.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-07-08 13:19:40 +02:00
Anders Eknert 2963c82fde Use Regal for linting Rego (#7752)
Closing the circle here, or something.

Not a lot of Rego used in OPA yet, but some in examples and tests. The little
there is should be linted though, and it'd be good if any new addition of policies got
linted by default. But more than anything, the "ignore configuration" provided here
avoids having developers seeing thousands of issues reported by Regal when they
open the OPA project in VS Code or their editor of choice.

Someone might want to look into un-ignoring the doc directory at some point, as it's
probably a good idea to have the docs follow best practices.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-07-06 09:37:39 +00:00
Johan Fylling 3f857572a0 inspect: Fixing missing annotations location in opa inspect with JSON format (#7727)
Fixing: #7459

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-06-25 14:48:41 +02:00
Anders Eknert 78a5ca2ab4 Simplify interning (#7714)
Use a single generic entrypoint for obtaining interned
terms regardless of type.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-06-23 11:40:00 +02:00
Anders Eknert b1ce92c459 perf: more efficient data/v1 POST handler (#7673)
Since we don't use the HTTP API in Regal, I hadn't looked at this from
a performance POV before, and it was a fun side quest :)

A pretty decent reduction of the baseline cost for the most common
request type, v1/data POST. Changes:

- Add NoOp implementation of `Metrics` for when metrics aren't needed
- Cheaper `metrics.New` instantiation avoiding unnecessary lock
- Avoid cost of decision logging if decision logging isn't enabled
- Only call request.URL.Query() if URL.RawQuery isn't empty, avoiding
  allocating an empty map with each request

While the target was v1/data POST handling, some of the changes above
have a positive impact on all or most handlers. All changes have been
run through the existing tests, and a new benchmark to measure the impact
of the fixes have been added, showing:

```
13063 ns/op	   15162 B/op	     195 allocs/op - main
12796 ns/op	   14856 B/op	     189 allocs/op - avoid r.URL.Query() when no query provided
12541 ns/op	   14483 B/op	     187 allocs/op - decisionLogger.Log early exit if not enabled
12133 ns/op	   14235 B/op	     180 allocs/op - get revisions and init logger only if needed
11098 ns/op	   14207 B/op	     180 allocs/op - more efficient metrics.New() (without locking)
10683 ns/op	   13171 B/op	     169 allocs/op - use no-op metrics implementation when metrics aren't requested
```

Even if the impact is pretty good, it's worth noting that most of the improvements
above are only seen when decision logging is turned off. While this is the common case
for development, it's not in production. Getting the baseline cost down is important still
as there should be no cost paid for features unused.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-06-09 12:33:48 +02:00
Sebastian Spaink a55e1b54fa deps: use google.golang.org/protobuf (#7655)
Signed-off-by: sspaink <sspaink@styra.com>
2025-06-03 09:16:02 -05:00
Anders Eknert 20fe70e321 perf: more interning (#7636)
This PR adds interning of strings representing common integer values,
which greatly speeds up "to string" operations on numbers, and updates
some built-ins commonly used for this to make use of interned values
where possible.

This is "light" version of a previous PR that did this more aggressively,
but also came with more caveats. Importantly, interning of new strings is
now never done at "runtime", but only allowed at init time. The API for
interning is marked experimental and should not relied upon by anyone
who expects a stable API.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-05-28 23:19:31 +02:00
Anders Eknert 8ba08ac80c Apply modernize linter fixes (#7599)
Following up on #7566, and now applying the more exciting
modernizations. fmt.Appendf was new to me! But especially
the contains checks are so much better IMHO. I have reviewed
all changes myself and did a few manual changes where it
became obvious that things could be improved a little further.

(the modernize analyzer still has some issues running against
OPA, and I have manually worked around those for the time being)

Signed-off-by: Anders Eknert <anders@styra.com>
2025-05-20 23:12:13 +02:00
Anders Eknert ce9ee328b2 perf: faster object.get (#7593)
- Check for array without allocating error
- Pre-allocate array path for given length

Signed-off-by: Anders Eknert <anders@styra.com>
2025-05-19 11:43:34 +02:00
Stephan Renatus 0adc621b36 planner: deal with var-for-function replacement in indirect calls
This change still follows the approach thought up in #6996, but now does
it more consistently: the extra args accumulated through (multiple)
with-replacements using variables are now put into the funcstackj, and
consistently affect the planning of functions in "higher" gens.

Fixes #5311.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-05-16 19:41:47 +02:00
Anders Eknert e43ef0a979 Use any in place of interface{} (#7566)
Earlier this evening I tried to run the Go
[modernize](https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize)
analyzer on OPA. That didn't go as planned:

- https://github.com/golang/go/issues/73661
- https://github.com/golang/go/issues/73663

While we wait for that to be fixed, I figured an old-fashioned
search-and-replace across the repo may work for at least the
`interface{}` to `any` conversion. That should help make it easier
to see the other fixes as applied by the modernize tool once it has
had those issues resolved.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-05-12 13:57:48 +02:00
robmyersrobmyers 7dd0dceb6d refactor: Remove internal/gqlparser and use upstream instead. (#7538)
This updates gqlparser from version ~v2.5.1 and the June 2018 GraphQL spec to
v2.5.26 and the October 2021 GraphQL spec.

Signed-off-by: Rob Myers <1243316+robmyersrobmyers@users.noreply.github.com>
2025-05-05 11:11:27 -05:00
robmyersrobmyers 56c9aa5bbe gqlparser: Add JSON annotation in internal/gqlparser/ast to Position fields (#7509)
Annotate internal/gqlparser structs not to include Position when marshaled
to JSON.  This makes the JSON roundtrip succeed without allocating a ton of
memory for JSON fields that will be subsequently pruned.

Upstream PR: https://github.com/vektah/gqlparser/pull/364

$ time ./reproducer-pre-fix
Now passing 1262568 bytes to builtinGraphQLParseSchema() to reproduce the issue in ast.InterfaceToValue()
Alloc = 4159 MiB	TotalAlloc = 5625 MiB	Sys = 5584 MiB	NumGC = 18
Alloc = 8312 MiB	TotalAlloc = 11169 MiB	Sys = 11125 MiB	NumGC = 19
Alloc = 8312 MiB	TotalAlloc = 11169 MiB	Sys = 11125 MiB	NumGC = 19
Alloc = 16615 MiB	TotalAlloc = 22247 MiB	Sys = 22209 MiB	NumGC = 20
Alloc = 16615 MiB	TotalAlloc = 22247 MiB	Sys = 22209 MiB	NumGC = 20
Alloc = 16615 MiB	TotalAlloc = 22247 MiB	Sys = 22209 MiB	NumGC = 20
Alloc = 38765 MiB	TotalAlloc = 44397 MiB	Sys = 44377 MiB	NumGC = 20
Alloc = 33223 MiB	TotalAlloc = 44397 MiB	Sys = 44377 MiB	NumGC = 21

$ time ./reproducer-post-fix
Now passing 1262568 bytes to builtinGraphQLParseSchema() to reproduce the issue in ast.InterfaceToValue()

real	0m0.545s
user	0m0.201s
sys	0m0.028s

Signed-off-by: Rob Myers <1243316+robmyersrobmyers@users.noreply.github.com>
2025-04-16 17:57:31 +02:00
Shiqi Yang c8febc8625 feat: add more distributed tracing options (#7421)
Resolves: #7412

Signed-off-by: Shiqi Yang <syang482@bloomberg.net>
2025-03-24 19:29:00 +01:00
Anders Eknert bd5ceb5142 Enable unused-receiver linter (revive) (#7448)
Signed-off-by: Anders Eknert <anders@styra.com>
2025-03-14 11:41:25 +01:00
Stephan Renatus 7049966700 planner: address ref head issue, don't optimize if impossible (#7439)
When planning rules like these:

```
package authz

p.allow[action][resource] if { action := "list"; resource := "fruit" }

p.unrelated.eat.veggies if true

resp := p[input.rule][input.action][input.resource]
```

we ended up with a broken CallDynamic statement. Since the first ref
rule is planned as `g0.data.authz.p.allow` and builds an object return
value, and the second rule is planned as
`g0.data.authz.p.unrelated.eat.veggies` with a boolean return value, we cannot
dynamically dispatch their calls.

With this change, the previously existing "unbalanced ruletrie" check now
also hits before reaching the end of the ref. It'll catch this situation
and avoid optimizing the dispatch. We'll end up with a longer, less
efficient, but correct plan.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-03-12 19:18:21 +00:00
Stephan Renatus 63e7d35c4e planner: adjust check in ruletree scanning
The previous check there was running into false positives, as the added
test case showed. We should only count relevant ruletrie child nodes.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-03-10 16:09:06 +01:00
Anders Eknert afb30d3f9d Add gocritic linter, fix a bunch of stuff (#7377)
Brace yourselves! For there are many touched files here. No changes
in semantics however.

Spent a long time trying out the various optional rules gocritic
provides, and settled for a few of them. There are more I really
like, but that would take many hours to address across the codebase.

Perhaps others find gocritic too pedantic? If so, we can merge the
fixes without enabling the rule.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-24 16:28:41 +01:00
Anders Eknert 684ef8da7a Fix test failures with Go 1.24 (#7376)
CI build will have to determine whether they also work in Go 1.23 :)

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-20 18:34:51 +01:00
Anders Eknert 61d3b7b64d perf: cost of indexing greatly reduced (#7370)
And many smaller performance improvements. The indexer recycling results
is one of the most impactful performance improvements as of yet, and alone
saves more than 2 million allocations in the Regal lint benchmark. The indexer
is also more efficient, as `values` are no longer stored on the struct. Thanks
@tsandall for that code!

Also included a bunch of small improvements from my perf branches.

**Before**
```
1209043041 ns/op	3255157224 B/op	64026192 allocs/op
```

**After**
```
1197131792 ns/op	3194124864 B/op	61876276 allocs/op
```

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-19 11:09:27 +01:00
Anders Eknert acdf16291c Make oracle public under v1/ast/oracle (#7352)
I'll follow up with another PR to modify this to allow passing
a custom compiler, and whatever else we need in Regal. But moving
files *and* modifying them in the same change is rarely great for
reviewing. So this does nothing but move the package and adjust
the pointer to the package in cmd/oracle.

Fixes #7265

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-10 11:18:32 +01:00
Brian Cullen 08f98e9527 Add Additional Resource Attributes for OpenTelemetry
Adds the "deployment.environment" resource attribute to those that can
be configured for OpenTelemetry. This was done as some collectors,
including Datadog, require this value to properly classify traces.

Note: the "deployment.environment" attribute is being deprecated in
future versions of the OTel schemas and this may need to be
updated when that library is upgraded.

Fixes #7322

Signed-off-by: Brian Cullen <brianc@kahoot.com>
2025-02-04 11:35:29 -08:00