Skip to content

Commit

Permalink
Merge pull request #128 from pixxelhq/master
Browse files Browse the repository at this point in the history
v5.10.1-Pixxel.SNAPSHOT-2.14.0
  • Loading branch information
swarup-n authored Sep 2, 2024
2 parents 7598587 + 58d170e commit 26941bd
Show file tree
Hide file tree
Showing 37 changed files with 223 additions and 88 deletions.
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>distribution</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cascading/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>cascading</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/ccsds-frames/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>ccsds-frames</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cfdp-udp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>cfdp-udp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cfdp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>cfdp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/perftest1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>perftest1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/perftest2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>perftest2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<groupId>org.yamcs.examples</groupId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>pus</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>replication1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>replication2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>replication3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>simulation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>snippets</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>templates</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion packet-viewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>packet-viewer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>

<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion simulator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>simulator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>yamcs-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>yamcs-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.1-Pixxel.SNAPSHOT-2.13.13</version>
<version>5.10.1-Pixxel.SNAPSHOT-2.14.0</version>
</parent>

<artifactId>yamcs-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void doCancel() {
public void algorithmRun(List<RawEngValue> inputValues, Object result, List<ParameterValue> outputValues) {
if (log.isTraceEnabled()) {
CommandId cmdId = activeCommand.getCommandId();
log.trace("command: {} algorithm {} stage{} executed: returnValue: {} , outputValues: {}",
log.trace("command: {} algorithm: {} stage: {} executed: returnValue: {} , outputValues: {}",
StringConverter.toString(cmdId), alg.getName(), cv.getStage(), result, outputValues);
}
if (result == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public void start() {
log.debug("All verifiers are disabled");
CommandHistoryPublisher cmdHistPublisher = processor.getCommandHistoryPublisher();
cmdVerifiers.forEach(cv -> cmdHistPublisher.publishAck(activeCommand.getCommandId(), getHistKey(cv),
processor.getCurrentTime(),
AckStatus.DISABLED));
processor.getCurrentTime(), AckStatus.DISABLED));
return;
}

Expand Down Expand Up @@ -113,9 +112,10 @@ public void start() {
}
}
verifiers.add(verifier);

if (scheduleNow) {
scheduleVerifier(verifier, checkWindow.getTimeToStartChecking(), checkWindow.getTimeToStopChecking());
} else {
log.debug("Not scheduling {} because it depends on the {}", cv, prevVerifier.getStage());
}
prevVerifier = verifier;
}
Expand All @@ -128,6 +128,10 @@ public void start() {
private void collectCmdVerifiers(MetaCommand cmd, List<CommandVerifier> cmdVerifiers,
Map<String, VerifierConfig> verifierOverride) {
CommandHistoryPublisher cmdHistPublisher = processor.getCommandHistoryPublisher();
MetaCommand basecmd = cmd.getBaseMetaCommand();
if (basecmd != null) {
collectCmdVerifiers(basecmd, cmdVerifiers, verifierOverride);
}

for (CommandVerifier cv : cmd.getCommandVerifiers()) {
boolean found = false;
Expand All @@ -144,19 +148,15 @@ private void collectCmdVerifiers(MetaCommand cmd, List<CommandVerifier> cmdVerif
} else {
if (extraOptions.getDisable()) {
cmdHistPublisher.publishAck(activeCommand.getCommandId(), getHistKey(cv),
processor.getCurrentTime(),
AckStatus.DISABLED);
processor.getCurrentTime(), AckStatus.DISABLED);
log.debug("skipping verifier {}", cv.getStage());
continue;
}
cmdVerifiers.add(overrideVerifier(cv, extraOptions));
}
}
}
MetaCommand basecmd = cmd.getBaseMetaCommand();
if (basecmd != null) {
collectCmdVerifiers(basecmd, cmdVerifiers, verifierOverride);
}

}

private CommandVerifier overrideVerifier(CommandVerifier cv, VerifierConfig extraOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import org.yamcs.logging.Log;
import org.yamcs.parameter.AggregateValue;
import org.yamcs.parameter.ArrayValue;
import org.yamcs.parameter.ParameterConsumer;
Expand Down
4 changes: 4 additions & 0 deletions yamcs-core/src/main/java/org/yamcs/commanding/Verifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@ void finishNOK() {
public State getState() {
return state;
}

public String getStage() {
return cv.getStage();
}
}
62 changes: 62 additions & 0 deletions yamcs-core/src/main/java/org/yamcs/logging/Log.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
package org.yamcs.logging;

import java.time.Instant;
import java.time.ZoneId;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.MessageFormatter;
import org.yamcs.TmPacket;
import org.yamcs.logging.sentry.SentryEventBuilder;
import org.yamcs.logging.sentry.SentryMessageBuilder;
import org.yamcs.tctm.pus.services.tm.PusTmCcsdsPacket;
import org.yamcs.utils.StringConverter;

import io.sentry.Sentry;
import io.sentry.SentryEvent;
import io.sentry.SentryLevel;
import io.sentry.protocol.Message;

public class Log {

Expand Down Expand Up @@ -64,6 +77,55 @@ public boolean isDebugEnabled() {
return julLogger.isLoggable(Level.FINE);
}

public String getStringMessage() {
return "Service Type: %s\n\nSubService Type: %s\n\nPacket: %s\n\nGentime: %s\n\nERT: %s\n\nLink: %s";
}

public List<String> getSentryParams(TmPacket tmPacket) {
byte[] b = tmPacket.getPacket();
return List.of(
Integer.toString(PusTmCcsdsPacket.getMessageType(b)),
Integer.toString(PusTmCcsdsPacket.getMessageSubType(b)),
StringConverter.arrayToHexString(b, true),
Instant.ofEpochMilli(tmPacket.getGenerationTime()).atZone(ZoneId.of("GMT")).toInstant().toString(),
Instant.ofEpochMilli(tmPacket.getEarthReceptionTime().getMillis()).atZone(ZoneId.of("GMT")).toInstant().toString()
);
}

public void logSentryWarning(Throwable e, String message, String logger, List<String> params) {
Message m = new SentryMessageBuilder()
.withMessage(message)
.withParams(params)
.build();
SentryEvent event = new SentryEventBuilder()
.withMessage(m)
.withLevel(SentryLevel.WARNING)
.withLogger(logger)
.withThrowable(e)
.build();

captureSentryEvent(event);
}

public void logSentryFatal(Throwable e, String message, String logger, List<String> params) {
Message m = new SentryMessageBuilder()
.withMessage(message)
.withParams(params)
.build();
SentryEvent event = new SentryEventBuilder()
.withMessage(m)
.withLevel(SentryLevel.FATAL)
.withLogger(logger)
.withThrowable(e)
.build();

captureSentryEvent(event);
}

private void captureSentryEvent(SentryEvent event) {
Sentry.captureEvent(event);
}

/**
* Send a log message at DEBUG level.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.yamcs.logging.sentry;

import io.sentry.SentryEvent;
import io.sentry.SentryLevel;
import io.sentry.protocol.Message;

public class SentryEventBuilder {
private final SentryEvent event;

public SentryEventBuilder() {
this.event = new SentryEvent();
}

public SentryEventBuilder withMessage(Message message) {
this.event.setMessage(message);
return this;
}

public SentryEventBuilder withLevel(SentryLevel level) {
this.event.setLevel(level);
return this;
}

public SentryEventBuilder withLogger(String logger) {
this.event.setLogger(logger);
return this;
}

public SentryEventBuilder withThrowable(Throwable e) {
this.event.setThrowable(e);
return this;
}

public SentryEvent build() {
return this.event;
}
}
Loading

0 comments on commit 26941bd

Please sign in to comment.