Skip to content

feat(logger): Improved batch featured for logger, added structure for stream mode support.#456

Merged
Murike merged 13 commits intomainfrom
feature/parity-logger
Jan 19, 2026
Merged

feat(logger): Improved batch featured for logger, added structure for stream mode support.#456
Murike merged 13 commits intomainfrom
feature/parity-logger

Conversation

@Murike
Copy link
Contributor

@Murike Murike commented Jan 12, 2026

User description

(TS SDK Parity Effort) Refactor - Galileo Logger

[sc-44815] - https://app.shortcut.com/galileo/story/44815/ts-sdk-parity-effort-refactor-galileo-logger-logger-parity

Description

  • Added ingestionHook support
  • Added Project ID and Log Stream ID Support
  • Added structure to support stream mode, including:
    1. Supporting traceId and spanId in logger creation
    2. Streaming methods (ingest and update, span and trace)
    3. All existing methods refactored to support cases of streaming mode

Obs.: Streaming will still go through further improvement in future tasks.


Generated description

Below is a concise technical summary of the changes proposed in this PR:
Refactor the GalileoLogger to support streaming mode and improve batch functionality as part of the TypeScript SDK parity effort. Introduce a TaskHandler for managing asynchronous API requests with dependency tracking and implement a robust EventSerializer for complex object serialization.

TopicDetails
Serialization & Types Enhance data serialization and type consistency across the SDK by introducing a new EventSerializer for handling complex JavaScript objects, refining toJSON methods for various span and step types, and updating type definitions to use camelCase and new JSON-serializable types.
Modified files (14)
  • src/entities/serialization.ts
  • src/types/logging/session.types.ts
  • src/types/logging/span.types.ts
  • src/types/logging/step.types.ts
  • src/types/logging/trace.types.ts
  • src/types/metrics.types.ts
  • src/utils/experiments.ts
  • src/utils/log-streams.ts
  • src/utils/metrics.ts
  • src/utils/serialization.ts
  • tests/entities/serialization.test.ts
  • tests/types/logging/step.types.test.ts
  • tests/utils/experiments.test.ts
  • tests/utils/metrics.test.ts
Latest Contributors(2)
UserCommitDate
Murikefeat-metrics-Added-mis...November 24, 2025
juandrucker@rungalileo.iofeat-support-ingesting...July 25, 2025
Streaming & Logger Core Implement streaming mode support in GalileoLogger, including the TaskHandler for managing concurrent asynchronous tasks, AsyncLocalStorage for context propagation, and updated API client methods for trace and span ingestion and updates. This also includes new configuration options for projectId, logStreamId, traceId, and spanId.
Modified files (12)
  • package-lock.json
  • package.json
  • src/api-client/galileo-client.ts
  • src/api-client/services/trace-service.ts
  • src/singleton.ts
  • src/types/logging/logger.types.ts
  • src/utils/galileo-logger.ts
  • src/utils/retry-utils.ts
  • src/utils/task-handler.ts
  • tests/utils/galileo-logger.test.ts
  • tests/utils/retry-utils.test.ts
  • tests/utils/task-handler.test.ts
Latest Contributors(2)
UserCommitDate
Murikefeat-experiments-Added...January 09, 2026
jweiler@galileo.aichore-deps-Bump-versio...December 22, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@Murike Murike force-pushed the feature/parity-logger branch from a1accf4 to 9160788 Compare January 12, 2026 11:50
Copy link

@fernandocorreia-galileo fernandocorreia-galileo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at test coverage. This is what Claude reported:

Missing Tests for New Features

  • No tests for streaming mode functionality
  • No tests for TaskHandler class
  • No tests for retry logic
  • No tests for EventSerializer edge cases
  • Tests only cover batch mode scenarios (tests/utils/galileo-logger.test.ts:154-256)

Also see the other comments below.

throw error;
}
// Non-retryable exception - log and return null
console.error(`Unrecoverable failure or unrecognized error: ${error}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a retry function like this one must either return a union type of T | Error, or at least have a hook for error handling like onExhausted?: (error: Error, attemptsMade: number) => void;. Logging to console and silently failing is not a solid foundation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss the design choice of logging errors for streaming mode vs other options.

return false;
}
return (
statusCode === 404 ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retrying on 404 by default does not seem to make sense.

What's the use case that you have in mind for this? Is this for retrying until a resource is ingested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get 404 if the trace we try to update doesn't exist, so we retry in case there was a delay on ingesting it in a previous task.
Although trace updating should have the ingestion as a parent task, this retry exists as precaution.

Image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that this should be a generic function that can be used for any operation, not just traces.

In a future iteration I recommend refactoring this to use a more restrictive set of retriable errors, and allow specific use cases to add new ones.

@Murike
Copy link
Contributor Author

Murike commented Jan 15, 2026

Please look at test coverage. This is what Claude reported:

Missing Tests for New Features

* No tests for streaming mode functionality

* No tests for TaskHandler class

* No tests for retry logic

* No tests for EventSerializer edge cases

* Tests only cover batch mode scenarios (tests/utils/galileo-logger.test.ts:154-256)

Also see the other comments below.

Added missing test cases. These will be reviewed with following tasks that continue work on streaming mode.

return false;
}
return (
statusCode === 404 ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that this should be a generic function that can be used for any operation, not just traces.

In a future iteration I recommend refactoring this to use a more restrictive set of retriable errors, and allow specific use cases to add new ones.

@Murike Murike force-pushed the feature/parity-logger branch from 68a31a8 to 250f2a5 Compare January 16, 2026 21:42
@Murike Murike merged commit 4183d80 into main Jan 19, 2026
8 checks passed
@Murike Murike deleted the feature/parity-logger branch January 19, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants