Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into adding-null-string-value-check
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Mar 11, 2024
2 parents a84320f + 6fb2ef4 commit e663428
Show file tree
Hide file tree
Showing 19 changed files with 184 additions and 38 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG]'
labels: 'bug, untriaged'
assignees: ''
---
### What is the bug?
_A clear and concise description of the bug._

### How can one reproduce the bug?
_Steps to reproduce the behavior._

### What is the expected behavior?
_A clear and concise description of what you expected to happen._

### What is your host/environment?
_Operating system, version._

### Do you have any screenshots?
_If applicable, add screenshots to help explain your problem._

### Do you have any additional context?
_Add any other context about the problem._
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Request a feature in this project
title: '[FEATURE]'
labels: 'enhancement, untriaged'
assignees: ''
---
### Is your feature request related to a problem?
_A clear and concise description of what the problem is, e.g. I'm always frustrated when [...]._

### What solution would you like?
_A clear and concise description of what you want to happen._

### What alternatives have you considered?
_A clear and concise description of any alternative solutions or features you've considered._

### Do you have any additional context?
_Add any other context or screenshots about the feature request here._
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Proposal
about: Suggest an idea for a specific feature you wish to propose to the community for comment
title: '[PROPOSAL]'
labels: proposal
assignees: ''
---
## What/Why
### What are you proposing?
_In a few sentences, describe the feature and its core capabilities._

### What users have asked for this feature?
_Highlight any research, proposals, requests or anecdotes that signal this is the right thing to build. Include links to GitHub Issues, Forums, Stack Overflow, Twitter, Etc_

### What problems are you trying to solve?
_Summarize the core use cases and user problems and needs you are trying to solve. Describe the most important user needs, pain points and jobs as expressed by the user asks above. Template: When \<a situation arises> , a \<type of user> wants to \<do something>, so they can \<expected outcome>. (Example: When **searching by postal code**, **a buyer** wants to **be required to enter a valid code** so they **don’t waste time searching for a clearly invalid postal code.**)_

### What is the developer experience going to be?
_Does this have a REST API? If so, please describe the API and any impact it may have to existing APIs. In a brief summary (not a spec), highlight what new REST APIs or changes to REST APIs are planned. as well as any other API, CLI or Configuration changes that are planned as part of this feature._

#### Are there any security considerations?
_Describe if the feature has any security considerations or impact. What is the security model of the new APIs? Features should be integrated into the OpenSearch security suite and so if they are not, we should highlight the reasons here._

#### Are there any breaking changes to the API
_If this feature will require breaking changes to any APIs, ouline what those are and why they are needed. What is the path to minimizing impact? (example, add new API and deprecate the old one)_

### What is the user experience going to be?
_Describe the feature requirements and or user stories. You may include low-fidelity sketches, wireframes, APIs stubs, or other examples of how a user would use the feature via CLI, OpenSearch Dashboards, REST API, etc. Using a bulleted list or simple diagrams to outline features is okay. If this is net new functionality, call this out as well._

#### Are there breaking changes to the User Experience?
_Will this change the existing user experience? Will this be a breaking change from a user flow or user experience perspective?_

### Why should it be built? Any reason not to?
_Describe the value that this feature will bring to the OpenSearch community, as well as what impact it has if it isn't built, or new risks if it is. Highlight opportunities for additional research._

### What will it take to execute?
_Describe what it will take to build this feature. Are there any assumptions you may be making that could limit scope or add limitations? Are there performance, cost, or technical constraints that may impact the user experience? Does this feature depend on other feature work? What additional risks are there?_

### Any remaining open questions?
_What are known enhancements to this feature? Any enhancements that may be out of scope but that we will want to track long term? List any other open questions that may need to be answered before proceeding with an implementation._
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tag and publish a release

on:
push:
tags:
- 'v*.*.*'
branches: [ test-release ]

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Set release version Name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 17.0
uses: actions/setup-java@v1
with:
java-version: 17.0
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew -Dtests.security.manager=false build
- name: Rename build assets
run: cp ./build/distributions/opensearch-ubi-*.zip ./opensearch-ubi-plugin-${{ env.RELEASE_VERSION }}.zip
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "./opensearch-ubi-plugin-${{ env.RELEASE_VERSION }}.zip"
token: ${{ secrets.GITHUB_TOKEN }}
tag: "release-${{ env.RELEASE_VERSION }}"
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "release-${{ env.RELEASE_VERSION }}"
#upload_url: ${{ steps.create_release.outputs.upload_url }}
files: ./opensearch-ubi-plugin-${{ env.RELEASE_VERSION }}.zip
name: ${{ env.RELEASE_VERSION }}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ apply plugin: 'maven-publish'
opensearchplugin {
name 'opensearch-ubi'
description 'OpenSearch User Behavior Insights Plugin'
classname 'org.opensearch.ubi.UserBehaviorInsightsPlugin'
classname 'com.o19s.ubi.UserBehaviorInsightsPlugin'
licenseFile rootProject.file('LICENSE.txt')
noticeFile rootProject.file('NOTICE.txt')
}

group = 'org.opensearch'
group = 'com.o19s'
version = "${ubiVersion}-os${opensearchVersion}"

// disabling some unnecessary validations for this plugin
Expand Down Expand Up @@ -61,7 +61,7 @@ publishing {
pom {
name = "opensearch-ubi"
description = "Provides User Behavior Insights for OpenSearch"
groupId = "org.opensearch"
groupId = "com.o19s"
licenses {
license {
name = "The Apache License, Version 2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi;
package com.o19s.ubi;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -32,11 +32,11 @@
import org.opensearch.rest.RestHeaderDefinition;
import org.opensearch.script.ScriptService;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.ubi.action.UserBehaviorInsightsActionFilter;
import org.opensearch.ubi.rest.UserBehaviorInsightsRestHandler;
import org.opensearch.ubi.events.OpenSearchEventManager;
import org.opensearch.ubi.model.HeaderConstants;
import org.opensearch.ubi.model.SettingsConstants;
import com.o19s.ubi.action.UserBehaviorInsightsActionFilter;
import com.o19s.ubi.rest.UserBehaviorInsightsRestHandler;
import com.o19s.ubi.events.OpenSearchEventManager;
import com.o19s.ubi.model.HeaderConstants;
import com.o19s.ubi.model.SettingsConstants;
import org.opensearch.watcher.ResourceWatcherService;

import java.util.ArrayList;
Expand All @@ -59,6 +59,9 @@ public class UserBehaviorInsightsPlugin extends Plugin implements ActionPlugin {

private ActionFilter userBehaviorLoggingFilter;

/**
* A map that caches store settings to avoid round-trip calls to the index.
*/
public static final Map<String, String> storeSettings = new HashMap<>();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
* compatible open source license.
*/

package org.opensearch.ubi.action;

package com.o19s.ubi.action;

import com.o19s.ubi.UserBehaviorInsightsPlugin;
import com.o19s.ubi.model.HeaderConstants;
import com.o19s.ubi.model.QueryRequest;
import com.o19s.ubi.model.QueryResponse;
import com.o19s.ubi.model.SettingsConstants;
import com.o19s.ubi.utils.UbiUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionRequest;
Expand All @@ -25,12 +31,6 @@
import org.opensearch.search.SearchHit;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.ubi.UserBehaviorInsightsPlugin;
import org.opensearch.ubi.model.HeaderConstants;
import org.opensearch.ubi.model.QueryRequest;
import org.opensearch.ubi.model.QueryResponse;
import org.opensearch.ubi.model.SettingsConstants;
import org.opensearch.ubi.utils.UbiUtils;

import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* compatible open source license.
*/

package org.opensearch.ubi.events;
package com.o19s.ubi.events;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.ubi.events.queues.EventQueue;
import org.opensearch.ubi.events.queues.InternalQueue;
import com.o19s.ubi.events.queues.EventQueue;
import com.o19s.ubi.events.queues.InternalQueue;

/**
* Base class for managing client-side events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.events;
package com.o19s.ubi.events;

/**
* A client-side event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.events;
package com.o19s.ubi.events;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* compatible open source license.
*/

package org.opensearch.ubi.events.queues;
package com.o19s.ubi.events.queues;

import org.opensearch.ubi.events.Event;
import com.o19s.ubi.events.Event;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* compatible open source license.
*/

package org.opensearch.ubi.events.queues;
package com.o19s.ubi.events.queues;

import org.opensearch.ubi.events.Event;
import com.o19s.ubi.events.Event;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.model;
package com.o19s.ubi.model;

/**
* HTTP headers used by the plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.model;
package com.o19s.ubi.model;

/**
* A query received by OpenSearch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.model;
package com.o19s.ubi.model;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.model;
package com.o19s.ubi.model;

/**
* Settings constants used by the plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
* compatible open source license.
*/

package org.opensearch.ubi.rest;
package com.o19s.ubi.rest;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.o19s.ubi.UserBehaviorInsightsPlugin;
import com.o19s.ubi.events.Event;
import com.o19s.ubi.model.HeaderConstants;
import com.o19s.ubi.model.SettingsConstants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.admin.indices.create.CreateIndexRequest;
Expand All @@ -27,12 +31,8 @@
import org.opensearch.rest.BaseRestHandler;
import org.opensearch.rest.BytesRestResponse;
import org.opensearch.rest.RestRequest;
import org.opensearch.ubi.UserBehaviorInsightsPlugin;
import org.opensearch.ubi.events.Event;
import org.opensearch.ubi.events.OpenSearchEventManager;
import org.opensearch.ubi.model.HeaderConstants;
import org.opensearch.ubi.model.SettingsConstants;
import org.opensearch.ubi.utils.UbiUtils;
import com.o19s.ubi.events.OpenSearchEventManager;
import com.o19s.ubi.utils.UbiUtils;

import java.io.IOException;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.ubi.utils;
package com.o19s.ubi.utils;

import org.opensearch.common.util.io.Streams;

Expand Down
18 changes: 18 additions & 0 deletions tag-and-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -e

GRADLE_PROPERTIES_FILE=gradle.properties

function getProperty {
PROP_KEY=$1
PROP_VALUE=`cat $GRADLE_PROPERTIES_FILE | grep "$PROP_KEY" | cut -d'=' -f2`
echo $PROP_VALUE
}

OPENSEARCH_VERSION=$(getProperty "opensearchVersion")
UBI_VERSION=$(getProperty "ubiVersion")

TAG_VERSION="v${UBI_VERSION}-os${OPENSEARCH_VERSION}"
echo "Tagging as ${TAG_VERSION}"

git tag -a "${TAG_VERSION}" -m "${TAG_VERSION}"
git push --tags

0 comments on commit e663428

Please sign in to comment.