Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ics-software
phoebus
Commits
81680efa
Unverified
Commit
81680efa
authored
Sep 05, 2022
by
Georg Weiss
Committed by
GitHub
Sep 05, 2022
Browse files
Merge pull request #2369 from ControlSystemStudio/alarm_logger_fix
Alarm Logger fixes
parents
951f124d
85dc7c41
Pipeline
#119829
passed with stage
in 11 minutes and 53 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
services/alarm-logger/src/main/java/org/phoebus/alarm/logging/ElasticClientHelper.java
View file @
81680efa
...
...
@@ -291,7 +291,7 @@ public class ElasticClientHelper {
exists
=
client
.
indices
().
existsIndexTemplate
(
ExistsIndexTemplateRequest
.
of
(
i
->
i
.
name
(
ALARM_CONFIG_TEMPLATE
))).
value
();
if
(!
exists
)
{
try
(
InputStream
is
=
ElasticClientHelper
.
class
.
getResourceAsStream
(
"/alarms_c
md
_template.json"
))
{
try
(
InputStream
is
=
ElasticClientHelper
.
class
.
getResourceAsStream
(
"/alarms_c
onfig
_template.json"
))
{
PutIndexTemplateRequest
templateRequest
=
new
PutIndexTemplateRequest
.
Builder
()
.
name
(
ALARM_CONFIG_TEMPLATE
)
.
indexPatterns
(
Arrays
.
asList
(
ALARM_CONFIG_TEMPLATE_PATTERN
))
...
...
services/alarm-logger/src/main/java/org/phoebus/alarm/logging/rest/SearchController.java
View file @
81680efa
...
...
@@ -2,20 +2,11 @@ package org.phoebus.alarm.logging.rest;
import
co.elastic.clients.elasticsearch.ElasticsearchClient
;
import
co.elastic.clients.elasticsearch._types.ElasticsearchVersionInfo
;
import
co.elastic.clients.elasticsearch._types.FieldSort
;
import
co.elastic.clients.elasticsearch._types.SortOptions
;
import
co.elastic.clients.elasticsearch._types.SortOrder
;
import
co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery
;
import
co.elastic.clients.elasticsearch._types.query_dsl.Query
;
import
co.elastic.clients.elasticsearch.core.InfoResponse
;
import
co.elastic.clients.elasticsearch.core.SearchRequest
;
import
co.elastic.clients.elasticsearch.core.SearchResponse
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.phoebus.alarm.logging.AlarmLoggingService
;
import
org.phoebus.alarm.logging.ElasticClientHelper
;
import
org.phoebus.applications.alarm.messages.AlarmStateMessage
;
import
org.phoebus.framework.preferences.PreferencesReader
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -24,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -34,20 +23,18 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
/**
* A REST service for quering the alarm message history
* A REST service for quer
y
ing the alarm message history
*
* @author Kunal Shroff
*/
@RestController
@RequestMapping
(
"/alarm-history"
)
public
class
SearchController
{
static
final
Logger
logger
=
Logger
.
getLogger
(
SearchController
.
class
.
getName
());
private
final
PreferencesReader
prefs
=
new
PreferencesReader
(
AlarmLoggingService
.
class
,
"/application.properties"
);
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
/**
*
* @return Information about the alarm logging service
*/
@GetMapping
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment