-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eval: add event message type (#1629)
Update messages parsing to handle simple pass-through events. They get logged out just like diagnostic messages.
- Loading branch information
1 parent
36a8e80
commit 3709900
Showing
7 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
atlas-eval/src/main/scala/com/netflix/atlas/eval/model/EventMessage.scala
This file contains 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,35 @@ | ||
/* | ||
* Copyright 2014-2024 Netflix, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package com.netflix.atlas.eval.model | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator | ||
import com.fasterxml.jackson.databind.JsonNode | ||
import com.netflix.atlas.json.Json | ||
import com.netflix.atlas.json.JsonSupport | ||
|
||
/** | ||
* Message type use for events to forward to a consumer. | ||
*/ | ||
case class EventMessage(payload: JsonNode) extends JsonSupport { | ||
|
||
override def encode(gen: JsonGenerator): Unit = { | ||
gen.writeStartObject() | ||
gen.writeStringField("type", "event") | ||
gen.writeFieldName("payload") | ||
Json.encode(gen, payload) | ||
gen.writeEndObject() | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
atlas-eval/src/main/scala/com/netflix/atlas/eval/model/LwcEvent.scala
This file contains 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,31 @@ | ||
/* | ||
* Copyright 2014-2024 Netflix, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package com.netflix.atlas.eval.model | ||
|
||
import com.fasterxml.jackson.databind.JsonNode | ||
import com.netflix.atlas.json.JsonSupport | ||
|
||
/** | ||
* Raw event data to pass through to the consumer. | ||
* | ||
* @param id | ||
* Identifies the expression that resulted in this datapoint being generated. | ||
* @param payload | ||
* Raw event payload. | ||
*/ | ||
case class LwcEvent(id: String, payload: JsonNode) extends JsonSupport { | ||
val `type`: String = "event" | ||
} |
This file contains 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 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 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 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 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