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

Fix metrics - gameId not appearing #35

Merged
merged 8 commits into from
Oct 18, 2022
Merged

Conversation

mflilian
Copy link
Contributor

@mflilian mflilian commented Oct 14, 2022

What?

To remove unnecessary middleware extension call from the API.
Right now Datadog is reading the metrics from this middleware, that's why the updates (including the addition of gameId tag) are not appearing.
Also, it was added to histories, history and ps/v2/history routes the implementation of the GameID tag.

Pre-requisites

  1. Start the database and populate MongoDB with make deps setup/mongo;
  2. Connect into mongoDB and run the following command:
> use chat

> db.messages.insertMany([
  {
    _id: ObjectId("61f18d6e901b304d707fd803"),
    id: 'urn:uuid:fe67bc4a-6517-4c96-a89d-09b7fe6e1e8e',
    player_id: '3727a9b4-dfa9-457a-9257-d2a7090d6955',
    game_id: 'mygame',
    topic: 'chat/mygame/room/general',
    message: 'Hello World',
    timestamp: 1643220334,
    blocked: false,
    metadata: {
      blocked: false,
      Type: 1,
      Time: NumberLong("637788171338607270"),
      Sender: { PlayerId: '3727a9b4-dfa9-457a-9257-d2a7090d6955', Name: 'Sonia Abrao' },
      Message: 'Hello World',
      Mentions: [],
      Id: 'urn:uuid:fe67bc4a-6517-4c96-a89d-09b7fe6e1e8e',
      GameId: 'mygame'
    },
    should_moderate: true,
    original_payload: {
      blocked: false,
      Type: 1,
      Time: NumberLong("637788171338607270"),
      Sender: { PlayerId: '3727a9b4-dfa9-457a-9257-d2a7090d6955', Name: 'Bob' },
      Message: 'Hello World',
      Mentions: [],
      Id: 'urn:uuid:fe67bc4a-6517-4c96-a89d-09b7fe6e1e8e',
      GameId: 'mygame'
    }
  }
])
  1. Start the API with make run.

Test case

Retrieving messages from a player should log the provided caller

  • Given I am an API consumer
  • When I try to query my game messages
curl --location --request GET 'http://localhost:8888/history/chat/mygame/room/general?userid=mygame:metagame-mygame&limit=10'
  • Then I should return a JSON array with my messages and a request log informing the provided gameID, as you can see in the image bellow

image

Same thing should happen with histories and ps/v2/history routes.

@mflilian mflilian changed the title Fix metrics - gameId Fix metrics - gameId not appearing Oct 14, 2022
@coveralls
Copy link

coveralls commented Oct 14, 2022

Coverage Status

Coverage increased (+1.1%) to 73.14% when pulling be4f61c on bugfix/gameid-metrics into 9cf9fa6 on master.

@mflilian mflilian merged commit 0532753 into master Oct 18, 2022
@mflilian mflilian self-assigned this Nov 11, 2022
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.

None yet

3 participants