Skip to content

Commit

Permalink
Update notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 committed Nov 14, 2023
1 parent 35bf148 commit 5364180
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 9 deletions.
11 changes: 11 additions & 0 deletions base/science-tech-maths/programming/dev-tools/datadog/datadog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Datadog

## Logs format

Datadog has some reserved fields in the JSON structure and if you use these fields for something else, the log will not be indexed and then not visible in the log search page.
Here are the reserved fields: Date attributes: @timestamp, timestamp, _timestamp, Timestamp, eventTime, date, published_date, syslog.timestamp
Host attributes: host, hostname, syslog.hostname
Service attributes: service, syslog.appname, dd.service
Status attributes: status, severity, level, syslog.severity
Trace Id attributes: dd.trace_id, contextMap.dd.trace_id
Message attributes: message, msg, logSo for example, if you use { "status": "SUCCESS" } in your JSON log, it will not be indexed because status accepts only log level values such as INFO, DEBUG, etc...
58 changes: 49 additions & 9 deletions base/science-tech-maths/programming/languages/graphql/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ Requests to a GraphQL server can be:

From the point of view of the client, the most common GraphQL operations are likely to be queries and mutations. If we were to think about them in terms of the create, read, update and delete (CRUD) model, a query would be equivalent to read. All the others (create, update, and delete) are handled by mutations.

## Some general concepts

### GraphQL document
## GraphQL document

A string written in the GraphQL language that defines one or more operations and fragments.

Expand Down Expand Up @@ -184,7 +182,7 @@ mutation {
}
```

### Operation
## Operation

A single query, mutation, or subscription that can be interpreted by a GraphQL execution engine.

Expand All @@ -199,7 +197,7 @@ A single query, mutation, or subscription that can be interpreted by a GraphQL e
- Because GraphQL is statically typed, it can actually validate for you that you are passing in the right variables.
- Variables are passed separately from the query document in a transport-specific way, In today’s GraphQL server implementations, that’s usually JSON.

### Selection set
## Selection set

![selection set](selection-set.png)

Expand All @@ -209,7 +207,7 @@ The selection set:
- A set of fields requested in an operation, or nested within another field.
- A GraphQL query must contain a selection set on any field that returns an object type, and selection sets are not allowed on fields that return scalar types, such as Int or String.

### Aliases
## Aliases

```graphql
query MyQuery {
Expand Down Expand Up @@ -237,7 +235,7 @@ returns:
}
```

### Fragments
## Fragments

![fragments](fragments.png)

Expand All @@ -248,7 +246,7 @@ Fragment definition:
- Fragment name: The name of each fragment has to be unique within a GraphQL document.
- Type condition: GraphQL operations always start at the query, mutation, or subscription type in your schema, but fragments can be used in any selection set.

### GraphQL schema
## GraphQL schema

On the server, we create a **GraphQL schema** written in SDL (schema definition language) based on the data we need to build our app UIs.

Expand Down Expand Up @@ -344,7 +342,7 @@ The schema tells the server what queries clients are allowed to make, and how di

That’s what resolve functions are for!

### Resolvers
## Resolvers

For each type, we write the **resolver functions**, connecting the data to our graph. Perhaps we get the Job data from an external API. And maybe we get the Location data from the Google Maps API.

Expand All @@ -358,6 +356,48 @@ posts(author){
}
```

## __typename

The `__typename` field is a meta field that returns the name of the object type currently being queried.

```graphql
{
search(text: "an") {
__typename
... on Human {
name
}
... on Droid {
name
}
... on Starship {
name
}
}
}
```

returns:

```json
{
"search": [
{
"__typename": "Human",
"name": "Han Solo"
},
{
"__typename": "Human",
"name": "Leia Organa"
},
{
"__typename": "Starship",
"name": "TIE Advanced x1"
}
]
}
```

## More

- <https://medium.com/naresh-bhatia/graphql-concepts-i-wish-someone-explained-to-me-a-year-ago-514d5b3c0eab>
Expand Down

0 comments on commit 5364180

Please sign in to comment.