Skip to content

Commit

Permalink
bug: Add missing request timestamp for mlobs logger (#568)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. Run unit tests and ensure that they are passing
2. If your change introduces any API changes, make sure to update the
e2e tests
3. Make sure documentation is updated for your PR!

-->
# Description
<!-- Briefly describe the motivation for the change. Please include
illustrations where appropriate. -->
The current mlobs logger does not populate the request timestamp, which
result in error when writing to the sink.

# Modifications
<!-- Summarize the key code changes. -->

# Tests
<!-- Besides the existing / updated automated tests, what specific
scenarios should be tested? Consider the backward compatibility of the
changes, whether corner cases are covered, etc. Please describe the
tests and check the ones that have been completed. Eg:
- [x] Deploying new and existing standard models
- [ ] Deploying PyFunc models
-->

# Checklist
- [ ] Added PR label
- [ ] Added unit test, integration, and/or e2e tests
- [ ] Tested locally
- [ ] Updated documentation
- [ ] Update Swagger spec if the PR introduce API changes
- [ ] Regenerated Golang and Python client if the PR introduces API
changes

# Release Notes
<!--
Does this PR introduce a user-facing change?
If no, just write "NONE" in the release-note block below.
If yes, a release note is required. Enter your extended release note in
the block below.
If the PR requires additional action from users switching to the new
release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note

```
  • Loading branch information
khorshuheng authored Apr 3, 2024
1 parent c1039ae commit 47b1ee6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/pkg/inference-logger/logger/mlobs_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"

"google.golang.org/protobuf/types/known/timestamppb"

upiv1 "github.com/caraml-dev/universal-prediction-interface/gen/go/grpc/caraml/upi/v1"
"github.com/confluentinc/confluent-kafka-go/v2/kafka"
"go.uber.org/zap"
Expand Down Expand Up @@ -70,6 +72,7 @@ func NewMLObsSink(

func (m *MLObsSink) newPredictionLog(rawLogEntry *LogEntry) (*upiv1.PredictionLog, error) {
predictionLog := &upiv1.PredictionLog{}
predictionLog.RequestTimestamp = timestamppb.Now()
standardModelRequest := &StandardModelRequest{}
err := json.Unmarshal(rawLogEntry.RequestPayload.Body, standardModelRequest)
if err != nil {
Expand Down

0 comments on commit 47b1ee6

Please sign in to comment.