Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 20809-support-ccs-i…
Browse files Browse the repository at this point in the history
…n-email-notifications
  • Loading branch information
kingzacko1 committed Nov 5, 2024
2 parents c967c9d + 4505606 commit 55b7b37
Show file tree
Hide file tree
Showing 78 changed files with 731 additions and 560 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/notify-upgrade-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow sends a Slack notification to the configured channels
# when the UPGRADING.md file is updated. This is used by the docs team.

name: "Notify UPGRADING.md update"
run-name: "Notify UPGRADING.md update (${{ github.ref_name}}/${{ github.sha }})"

on:
push:
branches:
- "master"
- "[0-9].[0-9]" # Stable branches
paths:
- "UPGRADING.md"

jobs:
notify:
runs-on: "ubuntu-latest"

steps:
- name: "Send Slack message"
uses: "slackapi/slack-github-action@v1"
env:
SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
with:
channel-id: "${{ vars.SLACK_UPGRADE_NOTIFY_CHANNELS }}"
slack-message: >
The Graylog [${{ github.ref_name }}/UPGRADING.md](https://github.com/Graylog2/graylog2-server/blob/${{ github.sha }}/UPGRADING.md) was updated in commit [${{ github.sha }}](https://github.com/Graylog2/graylog2-server/commit/${{ github.sha }}).
5 changes: 5 additions & 0 deletions changelog/unreleased/issue-20790.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type = "fixed"
message = "Fixing output class name for prometheus exporter."

issues = ["20790"]
pulls = ["20844"]
5 changes: 5 additions & 0 deletions changelog/unreleased/pr-20847.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type = "f"
message = "Fixes issue where some event types did not display all actions that should have been available."

issues = ["graylog-plugin-enterprise#8638"]
pulls = ["20847"]
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void handleInvalidPropertiesOnRootLevel() {
"foo": 23
}
""")
.body("message", equalTo("Unable to map property foo.\nKnown properties include: parameters, id, queries"))
.body("message", equalTo("Unable to map property foo.\nKnown properties include: parameters, id, queries, skip_no_streams_check"))
.body("line", equalTo(2))
.body("column", equalTo(14))
.body("path", equalTo("foo"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ApproximatedAutoIntervalFactory {

private static Double scalingForAutoTimeRange(long durationOfTimeRangeInSeconds, Duration durationOfTimeRange) {
final Duration autoIntervalDuration = boundaries.get(Duration.ofSeconds(durationOfTimeRangeInSeconds));
return (double) autoIntervalDuration.getSeconds() / (double) durationOfTimeRange.getSeconds();
return (double) autoIntervalDuration.toSeconds() / (double) durationOfTimeRange.toSeconds();
}

private static Duration parseInterval(String interval) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public abstract class Search implements ContentPackable<SearchEntity>, Parameter
public static final String FIELD_REQUIRES = "requires";
public static final String FIELD_CREATED_AT = "created_at";
public static final String FIELD_OWNER = "owner";
public static final String FIELD_SKIP_NO_STREAMS_CHECK = "skip_no_streams_check";

// generated during build to help quickly find a parameter by name.
private ImmutableMap<String, Parameter> parameterIndex;
Expand Down Expand Up @@ -95,6 +96,9 @@ public Search withOwner(@Nonnull String owner) {
@JsonProperty(FIELD_CREATED_AT)
public abstract DateTime createdAt();

@JsonProperty(FIELD_SKIP_NO_STREAMS_CHECK)
public abstract boolean skipNoStreamsCheck();

@Override
@JsonIgnore
public Optional<Parameter> getParameter(String parameterName) {
Expand Down Expand Up @@ -137,7 +141,7 @@ public Search addStreamsToQueriesWithoutStreams(Supplier<Set<String>> defaultStr

final Set<String> defaultStreams = defaultStreamsSupplier.get();

if (defaultStreams.isEmpty()) {
if (!skipNoStreamsCheck() && defaultStreams.isEmpty()) {
throw new MissingStreamPermissionException("User doesn't have access to any streams",
Collections.emptySet());
}
Expand Down Expand Up @@ -283,14 +287,18 @@ public abstract static class Builder {
@JsonProperty(FIELD_CREATED_AT)
public abstract Builder createdAt(DateTime createdAt);

@JsonProperty(FIELD_SKIP_NO_STREAMS_CHECK)
public abstract Builder skipNoStreamsCheck(boolean skipNoStreamsCheck);

abstract Search autoBuild();

@JsonCreator
public static Builder create() {
return new AutoValue_Search.Builder()
.requires(Collections.emptyMap())
.createdAt(DateTime.now(DateTimeZone.UTC))
.parameters(ImmutableSet.of());
.parameters(ImmutableSet.of())
.skipNoStreamsCheck(false);
}

public Search build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public abstract class SearchDTO {
@JsonProperty
public abstract Set<Parameter> parameters();

@JsonProperty
public abstract boolean skipNoStreamsCheck();

static SearchDTO fromSearch(Search search) {
return SearchDTO.Builder.create()
.id(search.id())
Expand Down Expand Up @@ -80,13 +83,17 @@ public Builder queries(QueryDTO... queries) {
@JsonProperty
public abstract Builder parameters(Set<Parameter> parameters);

@JsonProperty
public abstract Builder skipNoStreamsCheck(boolean skipNoStreamsCheck);

public abstract SearchDTO build();

@JsonCreator
static Builder create() {
return new AutoValue_SearchDTO.Builder()
.queries(new LinkedHashSet<>())
.parameters(of());
.parameters(of())
.skipNoStreamsCheck(false);
}
}

Expand All @@ -98,6 +105,7 @@ public Search toSearch() {
.id(id())
.queries(queries)
.parameters(ImmutableSet.copyOf(parameters()))
.skipNoStreamsCheck(skipNoStreamsCheck())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public MongoDbIndexTools(final MongoCollection<T> db) {

// MongoDB Indexes cannot be altered once created.
public static void ensureTTLIndex(MongoCollection<Document> collection, Duration ttl, String fieldUpdatedAt) {
final IndexOptions indexOptions = new IndexOptions().expireAfter(ttl.getSeconds(), TimeUnit.SECONDS);
final IndexOptions indexOptions = new IndexOptions().expireAfter(ttl.toSeconds(), TimeUnit.SECONDS);
final Bson updatedAtKey = Indexes.ascending(fieldUpdatedAt);
for (Document document : collection.listIndexes()) {
final Set<String> keySet = document.get(INDEX_DOCUMENT_KEY, Document.class).keySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private Lock waitForLock(String resource, Class<?> caller, String context, Index
try {
return RetryerBuilder.<Optional<Lock>>newBuilder()
.withRetryListener(loggingRetryListener(caller, indexSet, waitConfig))
.withStopStrategy(StopStrategies.stopAfterDelay(waitConfig.lockAcquireTimeout().getSeconds(), TimeUnit.SECONDS))
.withStopStrategy(StopStrategies.stopAfterDelay(waitConfig.lockAcquireTimeout().toSeconds(), TimeUnit.SECONDS))
.withWaitStrategy(WaitStrategies.fixedWait(waitConfig.delayBetweenAttempts().toMillis(), TimeUnit.MILLISECONDS))
.retryIfResult(Optional::isEmpty)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private ScheduledFuture<?> scheduleConsumerRun() {
} catch (Exception e) {
inputFailureRecorder.setFailing(getClass(), "Could not launch AMQP consumer.", e);
}
}, 0, connectionRecoveryInterval().getSeconds(), TimeUnit.SECONDS);
}, 0, connectionRecoveryInterval().toSeconds(), TimeUnit.SECONDS);
}

private void cancelConsumerRunScheduler() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected void triggerShutdown() {
shutdownTask.set(scheduler.schedule(() -> {
LOG.error("Notification queue was not drained within {}. Forcefully terminating.", shutdownTimeout);
this.executionThread.interrupt();
}, shutdownTimeout.getSeconds(), TimeUnit.SECONDS));
}, shutdownTimeout.toSeconds(), TimeUnit.SECONDS));
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions graylog2-server/src/main/resources/prometheus-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -961,19 +961,19 @@ metric_mappings:
match_pattern: "org.graylog2.lookup.adapters.HTTPJSONPathDataAdapter.httpURLErrors"

- metric_name: "blocking_elasticsearch_output_batch_size"
match_pattern: "org.graylog2.outputs.BlockingBatchedESOutput.batchSize"
match_pattern: "org.graylog2.outputs.BatchedMessageFilterOutput.batchSize"

- metric_name: "blocking_elasticsearch_output_buffer_flushes"
match_pattern: "org.graylog2.outputs.BlockingBatchedESOutput.bufferFlushes"
match_pattern: "org.graylog2.outputs.BatchedMessageFilterOutput.bufferFlushes"

- metric_name: "blocking_elasticsearch_output_buffer_flushes_requested"
match_pattern: "org.graylog2.outputs.BlockingBatchedESOutput.bufferFlushesRequested"
match_pattern: "org.graylog2.outputs.BatchedMessageFilterOutput.bufferFlushesRequested"

- metric_name: "blocking_elasticsearch_output_buffer_flush_failures"
match_pattern: "org.graylog2.outputs.BlockingBatchedESOutput.bufferFlushFailures"
match_pattern: "org.graylog2.outputs.BatchedMessageFilterOutput.bufferFlushFailures"

- metric_name: "blocking_elasticsearch_output_process_time"
match_pattern: "org.graylog2.outputs.BlockingBatchedESOutput.processTime"
match_pattern: "org.graylog2.outputs.BatchedMessageFilterOutput.processTime"

- metric_name: "elasticsearch_output_failures"
match_pattern: "org.graylog2.outputs.ElasticSearchOutput.failures"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void waitUntilReady() {
}
return success.stream().anyMatch(s -> outputFrame.getUtf8String().matches("(?s)" + s));
};
waitingConsumer.waitUntil(waitPredicate, startupTimeout.getSeconds(), TimeUnit.SECONDS, 1);
waitingConsumer.waitUntil(waitPredicate, startupTimeout.toSeconds(), TimeUnit.SECONDS, 1);

} catch (IOException iox) {
throw new ContainerLaunchException("Failed with Exception: " + iox.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void ensureTTLIndex(MongoDBTestService mongodb) {
final Set<String> keySet = doc.get("key", Document.class).keySet();
if (keySet.contains(FIELD_UPDATED_AT)) {
final long expireAfterSeconds = doc.get("expireAfterSeconds", Number.class).longValue();
if (Objects.equals(expireAfterSeconds, Duration.ofSeconds(72).getSeconds())) {
if (Objects.equals(expireAfterSeconds, Duration.ofSeconds(72).toSeconds())) {
found = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion graylog2-web-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@reduxjs/toolkit": "^2.2.0",
"@tanstack/query-sync-storage-persister": "^4.33.0",
"@tanstack/react-query-persist-client": "^4.33.0",
"ace-builds": "1.36.2",
"ace-builds": "1.36.4",
"bootstrap": "3.4.1",
"bson-objectid": "^2.0.3",
"chroma-js": "^2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dependencies": {
"@babel/eslint-parser": "7.16.5",
"@tanstack/eslint-plugin-query": "4.36.1",
"@typescript-eslint/eslint-plugin": "8.12.1",
"@typescript-eslint/parser": "8.12.1",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-import-resolver-webpack": "0.13.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
"dependencies": {
"@graylog/sawmill": "2.0.23",
"@tanstack/react-query": "4.36.1",
"@types/create-react-class": "15.6.8",
"@types/jquery": "3.5.32",
"@types/react": "18.3.12",
"babel-preset-graylog": "file:../babel-preset-graylog",
"create-react-class": "15.7.0",
"eslint-config-graylog": "file:../eslint-config-graylog",
"formik": "2.4.6",
"history": "^5.3.0",
Expand All @@ -53,7 +51,7 @@
"styled-components": "6.1.1",
"typescript": "5.6.3",
"use-query-params": "^2.2.0",
"webpack": "5.95.0",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "4.2.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@jest/types": "29.6.1",
"@testing-library/dom": "9.3.4",
"@testing-library/jest-dom": "6.6.2",
"@testing-library/jest-dom": "6.6.3",
"@testing-library/react": "14.3.0",
"@testing-library/react-hooks": "^8.0.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Graylog, Inc. <[email protected]>",
"license": "SSPL-1.0",
"dependencies": {
"postcss-styled-syntax": "0.6.4",
"postcss-styled-syntax": "0.7.0",
"stylelint": "16.10.0",
"stylelint-config-recommended": "14.0.1",
"stylelint-config-standard": "36.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
```js
import createReactClass from 'create-react-class';
import { Button } from 'components/bootstrap';

const BootstrapModalConfirmExample = createReactClass({
getInitialState() {
return {
class BootstrapModalConfirmExample extends React.Component {
constructor(props) {
super(props);
this.state = {
showModal: false,
confirmed: undefined,
};
},
}

openConfirmation() {
this.setState({ showModal: true });
},
};

onCancel() {
this.setState({ confirmed: false, showModal: false });
},
};

onConfirm(callback) {
this.setState({ confirmed: true, showModal: false });
callback();
},
};

render() {
const { confirmed, showModal } = this.state;
Expand All @@ -40,7 +40,7 @@ const BootstrapModalConfirmExample = createReactClass({
</div>
);
}
});
}

<BootstrapModalConfirmExample />
```
18 changes: 9 additions & 9 deletions graylog2-web-interface/src/components/common/ColorPicker.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
```js
import createReactClass from 'create-react-class';

const ColorPickerExample = createReactClass({
getInitialState() {
return {
class ColorPickerExample extends React.Component {
constructor(props) {
super(props);
this.state = {
color: undefined,
};
},
this.handleColorChange = this.handleColorChange.bind(this);
};

handleColorChange(color) {
this.setState({ color: color });
},
};

render() {
const { color } = this.state;
Expand All @@ -20,8 +20,8 @@ const ColorPickerExample = createReactClass({
<ColorPicker color={color} onChange={this.handleColorChange} />
</div>
);
},
});
};
}

<ColorPickerExample />
```
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
```js
import createReactClass from 'create-react-class';
import { Button } from 'components/bootstrap';

const ColorPickerOverlayExample = createReactClass({
getInitialState() {
return {
class ColorPickerOverlayExample extends React.Component {
constructor(props) {
this.state = {
color: undefined,
};
},
this.handleColorChange = this.handleColorChange.bind(this);
}

handleColorChange(color, _, hidePopover) {
hidePopover();
this.setState({ color: color });
},
};

render() {
const { color } = this.state;
Expand All @@ -27,8 +27,8 @@ const ColorPickerOverlayExample = createReactClass({
onChange={this.handleColorChange} />
</div>
);
},
});
};
}

<ColorPickerOverlayExample />
```
Loading

0 comments on commit 55b7b37

Please sign in to comment.