-
Notifications
You must be signed in to change notification settings - Fork 29
Dependency/SDK updates; waiting on a Seq.Api 2026.1 build #456
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
61006d3
Dependency/SDK updates; waiting on a Seq.Api 2026.1 build
nblumhardt e478234
Include `seqcli view *` commands and other metrics updates
nblumhardt 2b43664
Update inconsistent copyright headers
nblumhardt 8727d75
Update retention policy test case to use 2025.2-compatible features; …
nblumhardt 63ad195
Misssing ignoreCase: true
nblumhardt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "10.0.201" | ||
| "version": "10.0.203" | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| // Copyright 2018 Datalust Pty Ltd and Contributors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Seq.Api.Model.Shared; | ||
| using Seq.Api.Model.Signals; | ||
| using SeqCli.Api; | ||
| using SeqCli.Cli.Features; | ||
| using SeqCli.Config; | ||
| using SeqCli.Util; | ||
| using Serilog; | ||
|
|
||
| namespace SeqCli.Cli.Commands.View; | ||
|
|
||
| [Command("view", "create", "Create a metrics view", | ||
| Example = "seqcli view create -t 'API' -g '@Scope.name' -f \"@Resource.service.name = 'seq_cafe_web'\"")] | ||
| class CreateCommand : Command | ||
| { | ||
| readonly ConnectionFeature _connection; | ||
| readonly OutputFormatFeature _output; | ||
| readonly StoragePathFeature _storagePath; | ||
|
|
||
| string? _title, _description, _filter; | ||
| readonly List<string> _groups = []; | ||
| bool _isProtected; | ||
|
|
||
| public CreateCommand() | ||
| { | ||
| Options.Add( | ||
| "t=|title=", | ||
| "A title for the view", | ||
| t => _title = ArgumentString.Normalize(t)); | ||
|
|
||
| Options.Add( | ||
| "description=", | ||
| "A description for the view", | ||
| d => _description = ArgumentString.Normalize(d)); | ||
|
|
||
| Options.Add( | ||
| "f=|filter=", | ||
| "Expression filter to associate with the view", | ||
| f => _filter = ArgumentString.Normalize(f)); | ||
|
|
||
| Options.Add( | ||
| "g=|group=", | ||
| "Group key expression to associate with the view; this argument can be used multiple times", | ||
| c => _groups.Add(ArgumentString.Normalize(c) ?? throw new ArgumentException("Group keys require a value."))); | ||
|
|
||
| Options.Add( | ||
| "protected", | ||
| "Specify that the view is editable only by administrators", | ||
| _ => _isProtected = true); | ||
|
|
||
| _connection = Enable<ConnectionFeature>(); | ||
| _output = Enable<OutputFormatFeature>(); | ||
| _storagePath = Enable<StoragePathFeature>(); | ||
| } | ||
|
|
||
| protected override async Task<int> Run() | ||
| { | ||
| var config = RuntimeConfigurationLoader.Load(_storagePath); | ||
| var connection = SeqConnectionFactory.Connect(_connection, config); | ||
|
|
||
| if (string.IsNullOrEmpty(_title)) | ||
| { | ||
| Log.Error("A title must be specified"); | ||
| return 1; | ||
| } | ||
|
|
||
| var view = await connection.Views.TemplateAsync(); | ||
| view.OwnerId = null; | ||
|
|
||
| view.Title = _title; | ||
| view.Description = _description; | ||
| view.IsProtected = _isProtected; | ||
|
|
||
| if (_filter != null) | ||
| { | ||
| view.Filters = new[] | ||
| { | ||
| new DescriptiveFilterPart | ||
| { | ||
| Filter = (await connection.Expressions.ToStrictAsync(_filter)).StrictExpression, | ||
| FilterNonStrict = _filter | ||
| } | ||
| }.ToList(); | ||
| } | ||
|
|
||
| foreach (var group in _groups) | ||
| view.GroupKeyExpressions.Add(group); | ||
|
|
||
| view = await connection.Views.AddAsync(view); | ||
|
|
||
| _output.GetOutputFormat(config).WriteEntity(view); | ||
|
|
||
| return 0; | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright 2018 Datalust Pty Ltd and Contributors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| using System; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using SeqCli.Api; | ||
| using SeqCli.Cli.Features; | ||
| using SeqCli.Config; | ||
|
|
||
| namespace SeqCli.Cli.Commands.View; | ||
|
|
||
| [Command("view", "list", "List available metrics views", Example="seqcli view list")] | ||
| class ListCommand : Command | ||
| { | ||
| readonly EntityIdentityFeature _entityIdentity; | ||
| readonly ConnectionFeature _connection; | ||
| readonly OutputFormatFeature _output; | ||
| readonly EntityOwnerFeature _entityOwner; | ||
| readonly StoragePathFeature _storagePath; | ||
|
|
||
| public ListCommand() | ||
| { | ||
| _entityIdentity = Enable(new EntityIdentityFeature("view", "list")); | ||
| _entityOwner = Enable(new EntityOwnerFeature("view", "list", "listed", _entityIdentity)); | ||
| _output = Enable<OutputFormatFeature>(); | ||
| _storagePath = Enable<StoragePathFeature>(); | ||
| _connection = Enable<ConnectionFeature>(); | ||
| } | ||
|
|
||
| protected override async Task<int> Run() | ||
| { | ||
| var config = RuntimeConfigurationLoader.Load(_storagePath); | ||
| var connection = SeqConnectionFactory.Connect(_connection, config); | ||
|
|
||
| var list = _entityIdentity.Id != null ? [await connection.Views.FindAsync(_entityIdentity.Id)] | ||
| : | ||
| (await connection.Views.ListAsync(ownerId: _entityOwner.OwnerId, shared: _entityOwner.IncludeShared)) | ||
| .Where(signal => _entityIdentity.Title == null || _entityIdentity.Title == signal.Title); | ||
|
|
||
| _output.GetOutputFormat(config).ListEntities(list); | ||
|
|
||
| return 0; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
DataSourceis a value type (enum), this will fall back toStreamby default for older API versions that don't supply a data source explicitly (these only supportstreamanyway).