Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): add analytics rules and events support #72

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

tharropoulos
Copy link
Contributor

Change Summary

Rationale

The Typesense server provides analytics capabilities through its /analytics endpoints, but these features were not accessible through the Java client. Users needed to track search analytics and user interactions but had to implement their own HTTP calls or workarounds.

This PR adds complete support for Analytics Rules and Events.

Changes

Added Features:

  1. New Analytics Management (Analytics.java):
  • Central class for managing analytics operations
  • Provides access to rules and events APIs
  1. Analytics Rules Support (AnalyticsRules.java, AnalyticsRule.java):
  • create(): Create new analytics collection rules
  • upsert(): Create or update existing rules
  • retrieve(): Get single or all analytics rules
  • delete(): Remove analytics rules
  • Complete parameter support for rule configuration
  1. Analytics Events Tracking (AnalyticsEvents.java):
  • create(): Track custom analytics events

Code Changes:

  1. In Client.java:
  • Added analytics field and getter
  • Integrated analytics support in client initialization
  1. In Helper.java:
  • Added test support methods for analytics
  • Enhanced teardown to clean analytics rules
  • Added test collection creation for analytics data

Documentation Updates:

  1. In README.md:
  • Added comprehensive examples for analytics rules
  • Added examples for tracking custom events
  • Added code samples with use cases

Tests:

  1. New Test Classes:
  • AnalyticsRulesTest.java: Complete test coverage for rules API
  • AnalyticsEventsTest.java: Event creation and validation tests
  • Integration tests with existing collections

Context

This implementation addresses and closes the feature request in #71 by @danipenaperez for analytics support in the Java client. It provides a complete solution for both analytics rules and events tracking, giving users the full power of Typesense analytics.

The changes follow the existing client architecture patterns and include comprehensive tests and documentation to ensure reliable usage.

PR Checklist

Initial implementation of Analytics rules API for the Typesense Java client.
Includes CRUD operations for analytics rules and corresponding test coverage.

The changes include:
- New Analytics, AnalyticsRule, and AnalyticsRules classes
- Analytics rules integration in Client class
- Comprehensive test coverage for analytics operations
- Documentation updates showcasing how to use the new feature

feat(analytics): implement Analytics class
feat(analytics): add AnalyticsRule class for individual rule operations
feat(analytics): add AnalyticsRules class for bulk operations
test(analytics): add comprehensive test coverage for analytics rules
refactor(client): integrate analytics support
docs(analytics): add documenation on proper analytics rules usage
Implements analytics events tracking capabilities to complement existing rules
functionality. Adds ability to create custom analytics events with type, name
and data fields.

Changes include:
- New AnalyticsEvents class for event operations
- Integration with Analytics class
- Test coverage with sample search event creation
- Helper updates for events in analytics rules
- Documentation updates on how to use new feature

feat(analytics): add AnalyticsEvents class
test(analytics): add AnalyticsEventsTest
feat(analytics): integrate events into Analytics class
refactor(helper): update createTestAnalyticsRule for events
docs(analytics): add documenation on proper analytics rules usage
@kishorenc kishorenc merged commit fe13de1 into typesense:master Nov 4, 2024
3 checks passed
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